JS in the method of words and meaning

Source: Internet
Author: User

What the browser object is, it is the top-level scope in JS programming, all the methods and attributes in JS are the descendants of this object (window).

Document or Document object, in layman's words: whatever we can see is encoded, it belongs to the document.

The ID is used to get an HTML element so that we can use JS to control the operation (Document.getelemetnbyid).

A Collection object (document.getElementsByTagName) that obtains a set of HTML elements through a tag name throughout the page.

The method for creating elements in JS (createelement).

The method for adding child elements in JS (added at the end of the element) (appendchild).

JS always adds a method (InsertBefore) to the front of an element.

JS to create the text node (createtextnode).

Determines the node type, which is the element node (NodeType ()) If the return value is 1.

What is the first child node that represents the firstchild Last child node with what is represented by LastChild

The collection of all child nodes with what represents the childNodes parent node with what is represented parentnode

JS indicates what the previous sibling node is previoussibling indicates what the next sibling node is nextsilbing

Gets the value of the element property getattribute Sets the value of the element property Setattribite

Indicates that the replication node clonechild represents the deletion of child nodes removechlid

Insert the NewNode node in front of TargetNode with what is represented InsertBefore

The difference between childnodes and children

ChildNodes gets the element in the child node, the text, the comment node, and children can only get the elements in the child nodes (except for IE8 below)

What is documentfragment and what does it do, and how does it affect the performance of the browser?

The DocumentFragment node is not part of the document tree, and the inherited ParentNode property is always null.
However, it has a special behavior that makes it very useful to insert a documentfragment node into the document tree instead of the documentfragment itself, but all of its descendant nodes. This makes documentfragment a useful placeholder for temporarily storing nodes that are inserted into a document at once. It also facilitates the cut, copy, and paste operations of the document

At the same time, we understand that when the page Dom needs to be manipulated, it will inevitably lead to multiple redraws and reflow. This will increase the burden on the page. Affect page performance. So we can create such a temporary placeholder.

JS in the method of words and meaning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.