How do I view the attribute descriptor of an attribute in a tag element object?

A tag on the page, such as div (id= "test"), gets its js object and, var obj =
document.getElementById ("test"). I want to see the property descriptor of one of its properties, but undefined, is here to consult my predecessors.
Object.getOwnpropertyDescriptor (obj, "attributes"); undefined

is returned
Mar.16,2021

tested it and found that it did return undefined . Here's my thought process:

  1. Object.getOwnPropertyDescriptor you can see from the method name that this attribute must be the own attribute , not the attribute on the prototype chain, so is attributes not the own attribute of the dom element ?
  2. use Object.hasOwnProperty to verify, and sure enough, it returns false . Since it is not an own property, Object.getOwnPropertyDescriptor returns undefined . But why not have their own attributes?
  3. uses Object.hasOwnProperty to test the objects on the prototype chain of obj , and returns false .
  4. conclusion: it may be that the dom object has done special treatment. So what if I still want to see this property descriptor?
  5. since attributes is not an inherent property of obj , then I can create a js object , and then set the attributes attribute to obj.attributes .
  6. sure enough, it came out. The screenshot of verification is as follows:

clipboard.png

Menu