Skip to content

Instantly share code, notes, and snippets.

@fabioricali
Last active January 18, 2020 18:56
Show Gist options
  • Save fabioricali/f58af536f74b68ceb4d5337f8f93ffd4 to your computer and use it in GitHub Desktop.
Save fabioricali/f58af536f74b68ceb4d5337f8f93ffd4 to your computer and use it in GitHub Desktop.
HTML element unwritable properties list
const propertiesNotWritable = [];
function extract(o) {
for (let i in o.prototype) {
if (o.prototype.hasOwnProperty(i)) {
let p = Object.getOwnPropertyDescriptor(o.prototype, i);
if (!p.writable && !p.set && !propertiesNotWritable.includes(i))
propertiesNotWritable.push(i)
}
}
}
extract(Node);
extract(Element);
extract(HTMLElement);
console.log(propertiesNotWritable)
[
"ELEMENT_NODE",
"ATTRIBUTE_NODE",
"TEXT_NODE",
"CDATA_SECTION_NODE",
"ENTITY_REFERENCE_NODE",
"ENTITY_NODE",
"PROCESSING_INSTRUCTION_NODE",
"COMMENT_NODE",
"DOCUMENT_NODE",
"DOCUMENT_TYPE_NODE",
"DOCUMENT_FRAGMENT_NODE",
"NOTATION_NODE",
"DOCUMENT_POSITION_DISCONNECTED",
"DOCUMENT_POSITION_PRECEDING",
"DOCUMENT_POSITION_FOLLOWING",
"DOCUMENT_POSITION_CONTAINS",
"DOCUMENT_POSITION_CONTAINED_BY",
"DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC",
"nodeType",
"nodeName",
"baseURI",
"isConnected",
"ownerDocument",
"parentNode",
"parentElement",
"childNodes",
"firstChild",
"lastChild",
"previousSibling",
"nextSibling",
"namespaceURI",
"prefix",
"localName",
"tagName",
"attributes",
"shadowRoot",
"assignedSlot",
"scrollWidth",
"scrollHeight",
"clientTop",
"clientLeft",
"clientWidth",
"clientHeight",
"attributeStyleMap",
"previousElementSibling",
"nextElementSibling",
"children",
"firstElementChild",
"lastElementChild",
"childElementCount",
"isContentEditable",
"offsetParent",
"offsetTop",
"offsetLeft",
"offsetWidth",
"offsetHeight",
"dataset"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment