在chrome控制台中,使用document.getElementByClassName
时,它将返回一个数组。
但是当我扩展数组时,数组的每个元素都显示了附加细节,这些细节是什么,以及当我打印单个元素时为什么它们不出现。
HTMLCollection(5) [div.example, div.example, p.example, span.example, button.example]
0: div.example
accessKey: ""
align: ""
assignedSlot: null
attributeStyleMap: StylePropertyMap {size: 1}
attributes: NamedNodeMap {0: class, 1: style, class: class, style: style, length: 2}
autocapitalize: ""
答案 0 :(得分:0)
它们是什么?
Element
的属性。
当我打印单个元素时为什么它们不出现
元素的默认log
(至少在Chrome中是Node元素本身)。 console.dir
将与getElementByClassName
打印相同。