Htmlcollection with nodelist in browser difference (1/4)

Source: Internet
Author: User

Htmlcollection Interface Definition

Interface Htmlcollection
{
ReadOnly attribute unsigned long length;
Node item (in unsigned long index);
Node Nameditem (in Domstring name);
}

What must be said for the Htmlcollection collection object is the Nameditem method. Look at the explanation of the specification.
Original:
Nameditem method
This method retrieves a node using a name. With [HTML 4.01] documents, it's a node with a matching id attribute. If it doesn ' t find one, it then searches for a node with a matching name attribute, but only on those elements that are AL lowed a name attribute. With [XHTML 1.0] Documents, this method is only searches to nodes with a matching id attribute. This is case insensitive in HTML documents and case sensitive in XHTML documents.

--------------------------------------------------------------------------------

Translation:
Nameditem Method:
This method obtains the node through the ' name ' attribute.
In the html4.01 document, it first searches for the value of the node's ID attribute. If no matching node is found, search for the node with which the Name property matches. That is, under the html4.01 DTD, browsers should take precedence over IDs to get nodes. Second is name.
In the XHTML 1.0 document, only the node that matches the id is searched.
For the value of the node (ID or name) attribute, this method ignores the case difference in the HTML document and is in the XHTML document. The case is different.


The bold part above is very important, and there is no such thing as a guide. Some of the problems that come up later are very difficult to determine. Because many browsers are not implemented the same way.

Home 1 2 3 4 last page

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.