JavaScript Learning Notes (10)----Client detection and DOM

Source: Internet
Author: User

Client-side detection:

(i) Capacity testing

Capability detection is the ability to identify browsers.

The ability to detect a particular browser before writing code. For example, a script might want to detect the existence of a function before calling it.

(ii) Quirks detection

Quirks are actually bugs in the browser implementation. Quirks detection usually involves running a small piece of code and then determining whether a browser has a quirk.

(iii) User agent detection

The browser is identified by detecting the user-agent string.

Dom

(i) Node hierarchy

In an HTML page, the document element is used as a

Each piece of markup can be represented by a node in the tree: The HTML element is represented by an element node, the attribute is represented by an attribute node, the document type is represented by a document type node, and the comment is represented by an annotation node.

There are 12 node types, all of which inherit from a base type.

1.Node type

All node types in JavaScript inherit from the node type, so all node types share the same basic properties and methods.

Each node has a NodeType property that indicates the type of the node.

12 numeric Changlianglai indicates the node type:

1 = = Node.element_node

2 = = Node.attribute_node

3 = = Node.text_node

4 = = Node.cdata_section_node

5 = = Node.entity_reference_node

6 = = Node.entity_node

7 = = Node.processing_instruction_node

8 = = Node.comment_node

9 = = Node.document_node

Ten = = Node.document_type_node

= = Node.document_fragment_node

* = Notation_node

JavaScript Learning Notes (10)----Client detection and DOM

Related Article

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.