The difference between Javascript-node.children and node.childnodes

Source: Internet
Author: User

This is also because the group of Seniors interview encountered this problem, and then share a bit

The first is the interpretation of two APIs within the MDN

Children

Node.childrenis a, Read-only property, returns a live of the child of HTMLCollection elements Node .

ChildNodes

The Node.childNodes read-only property returns a live collection of child of the nodes given element where the first child Node is assigned index 0.

So children will return all element sub-nodes in the node you are looking for, and childnodes will return all nodes, such as element, text, and annotations, presumably, ↓

The difference between Javascript-node.children and node.childnodes

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.