interface HTMLCollection
{
readonly attribute unsigned long length;
Node item(in unsigned long index);
Node namedItem(in DOMString name);
}
原文:
namedItem method This method retrieves a Node using a name. With [HTML 4.01] documents, it first searches for 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 allowed a name attribute. With [XHTML 1.0] documents, this method only searches for Nodes with a matching id attribute. This method is case insensitive in HTML documents and case sensitive in XHTML documents. 翻译:
namedItem 方法:
此方法获通过 "name"属性来获取节点.
在HTML4.01文档中,它首先搜索的是节点的ID属性的值. 如果没找到匹配节点,才去搜索name 属性与之匹配的节点. 即HTML4.01 DTD下,浏览器们应该优先通过ID来获取节点.其次才是name.
在XHTML 1.0文档中,则仅搜索ID与之匹配的节点.
对于节点(id or name)属性的值,此方法在HTML文档中忽略大小写区别,而在XHTML文档中.则要区别大小写.
|
微软MSDN上查到的 NodeList实现 ,虽然这些资料告诉我们 NodeList继承了 Microsoft.SpeechServer.Dom.Collections.Collection Class . 但是事实却并不如此. 事实上,ie浏览器的NodeList不具备 ICollection接口定义的 namedItem 和 tags 两个方法. 实现了他们的 只有HTMLCollection类型.
此文档是 Speech Server 2007 用的,所以应该仅供参考.只能说明IE浏览器中的NodeList 还是遵守标准的.
<strong><span><span style="COLOR: #a8a8a8">public sealed class NodeList : Collection, INodeList, IEnumerable, IExpando, IReflect</span></span></strong> Nach dem Login kopieren Nach dem Login kopieren <span style="COLOR: #a8a8a8"><strong><span><span><strong><span style="COLOR: #a8a8a8">NodeList的继承链:</span></strong></span></span></strong></span> Nach dem Login kopieren
System.Object
Microsoft.SpeechServer.Dom.Shim
Microsoft.SpeechServer.Dom.DynamicShim
Microsoft.SpeechServer.Dom.Collections.Collection
Microsoft.SpeechServer.Dom.Collections.NodeList
Collection 实现的ICollection接口定义的属性和方法表
public properties : item(msdn上说item是重载,我表示诧异...),length
public methods : item,namedItem,tags
|
The NodeList object returned by the querySelectorAll() method must be static, not live ([DOM-LEVEL-3-CORE], section 1.1.1)
Members Table
The following table lists the members exposed by the StaticNodeList object.
Attributes/PropertiesMethods
Method Description item Retrieves an object from a childNodes or StaticNodeList collection.
Remarks
The collection will be empty if the querySelectorAll method returned no matches.
If the element tree is changed relative to the one or more original selectors used to generate the StaticNodeList collection, the collection (being static) will not be updated when the element tree changes.
限定方
|
方法\浏览器 | IE8 | IE9 beta7930.16406 | FireFox4.0 beta7 | Chrome10.0 Dev | Safari5.02 | Opear11 |
W3C DOM2 | getElementsByTagName |
HTMLCollection |
HTMLCollection
|
HTMLCollection
|
NodeList
|
NodeList
|
NodeList
|
WHATWG HTML5
|
getElementsByClassName |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
NodeList
|
NodeList
|
NodeList
|
W3C DOM1
|
getElementsByName |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
NodeList
|
NodeList
|
NodeList
|
W3c Selectors API 1
|
querySelectorAll | StaticNodeList |
StaticNodeList
|
NodeList(Static)(注0) |
NodeList(Static)
|
NodeList(Static)
|
NodeList(Static)
|
W3C DOM1
|
childNodes | NodeList |
NodeList
|
NodeList
|
NodeList
|
NodeList
|
NodeList
|
MS
|
children
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1 |
document.links
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1
|
document.images |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1
|
document.anchors |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1
|
document.forms |
HTMLCollection |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1 | document.applets |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1 | formElement.elements |
HTMLFormElement |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1 | selectElement.options |
HTMLSelectElement
|
HTMLSelectElement
|
HTMLOptionsCollection
|
HTMLOptionsCollection
|
HTMLOptionsCollection
|
HTMLOptionsCollection
|
w3c DOM1 | tableElement.rows |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
w3c DOM1 | rowElement.cells |
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
HTMLCollection
|
MS | document.all |
HTMLCollection
|
HTMLCollection
|
(S)-(注4)
(Q)object HTML document.all class
|
HTMLAllCollection(注1)
|
HTMLAllCollection(注2)
|
HTMLCollection(注3)
|
注4:Freifox在非标准模式,才支持document.all 且是一个很奇怪的东西.其构造器是Object. 这东西从FireFox 0.8时代貌似就有了.一直到现在的4.0 beta8 ...