js-Authoritative Guide Study notes 15

Source: Internet
Author: User
Tags tag name

15th. Scripted documents

1. The Document Object Model DOM is the underlying API for representing and manipulating HTML and XML document content.

2,Document, Element, text is the sub-class of node .

3. Querying one or more elements of a document is as follows: with the specified id attribute, with the specified name attribute, with the specified tag name, with the specified CSS class, matching the specified CSS selector .

4. The Name property of HTML originally intended to assign a name to the form element, using the value of the property when the form data was submitted to the server.

5. TheName property is valid only in a few HTML elements, including forms, form elements, IFRAME, and IMG elements .

6, Getelementsbyname () only available for HTML documents, returns a NodeList object. Behaves like a read-only group that contains several element objects.

7. Set the Name property for form, IMG, IFRAME, applet, embed, object element, that is, a property with the Name property value in the Document object .

8. If the given name has only one element, the value of the automatically created document property corresponds to the element itself, and if there are multiple elements, the value of the document property is a NodeList object that behaves as an array containing these elements. Document properties created for several named IFRAME elements are special: they refer to the window object of these frames instead of the element object .

9. The HTMLDocument class defines some shortcut properties to access a wide variety of nodes, such as images, forms , links to img, form, a (with href attribute). The Htmlcollection object.

10. The documentelement attribute of the document class refers to the root element of the documentation . In an HTML document, it always refers to an HTML element.

11. Document Method Queryselectorall (), accepts a string parameter that contains a CSS selector, returns a NodeList object that represents all the elements of a matching selector in the document. This NodeList object is not real-time.

12, Queryselector () returns the first matching element.

13. Node's attribute NodeType represents the type of the node. 9 represents the document node, 1 represents the element node, 3 represents the text node, 8 represents the comment node, and 11 represents the DocumentFragment node .

14. The children property of the element object, similar to ChildNodes, is also a NodeList object, but the children list contains only the element object .

15. The text and comment nodes do not have a children property, meaning that the Node.parentnode property cannot return a text or comment node .

16. The Style property value of any HTML element is a cssstyledeclaration object, not a string.

17. The element type also defines the getattribute () and setattribute () methods to query and set non-standard HTML attributes. Hasattribute () and removeattribute () are used to detect whether a named property exists and to delete a property entirely.

18. In HTML5 documents, any lowercase attribute names prefixed with data-are valid. HTML5 also defines the DataSet attribute on the element object, which refers to an object whose individual properties correspond to the data-attribute that removes the prefix.

19. The DataSet attribute is a real-time, bidirectional interface to the Data-property. setting or deleting a property of a dataset is equivalent to removing the data-property of the corresponding element.

20. For the element object, the Attributes property is a read-only class Array object that represents all the attributes of the element, similar to nodelist.

js-Authoritative Guide Study notes 15

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.