javascript - why Object.getOwnPropertyNames for a DOM returns empty array? -
in following simplest html snippet:
<button class="clickme" id="clickme">click me</button>
i use following javascript code query dom , want inspect properties , methods on objects returned getelementbyid:
var btn=document.getelementbyid('clickme');console.log(object.getownpropertynames(btn));
my question is: 1. why above log dumps out [] empty string?? 2. type of returned value getelementbyid?
thanks~!
- why above log dumps out [] empty string
all properties of object (element) inherited node, , own parent, eventtarget, , implements of parentnode, childnode, nondocumenttypechildnode, , animatable.
since has no direct property of own, returns empty array.
- what type of returned value getelementbyid?
it returns element.
Comments
Post a Comment