Node.idl 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #import <DOM/Document.idl>
  2. #import <DOM/Element.idl>
  3. #import <DOM/EventTarget.idl>
  4. // https://dom.spec.whatwg.org/#node
  5. [Exposed=Window]
  6. interface Node : EventTarget {
  7. readonly attribute unsigned short nodeType;
  8. readonly attribute DOMString nodeName;
  9. readonly attribute USVString baseURI;
  10. boolean hasChildNodes();
  11. [SameObject] readonly attribute NodeList childNodes;
  12. readonly attribute Node? firstChild;
  13. readonly attribute Node? lastChild;
  14. readonly attribute Node? previousSibling;
  15. readonly attribute Node? nextSibling;
  16. readonly attribute Node? parentNode;
  17. readonly attribute Element? parentElement;
  18. readonly attribute boolean isConnected;
  19. readonly attribute Document? ownerDocument;
  20. Node getRootNode(optional GetRootNodeOptions options = {});
  21. [CEReactions] attribute DOMString? nodeValue;
  22. // FIXME: [LegacyNullToEmptyString] is not allowed on nullable types as per the Web IDL spec.
  23. // However, we only apply it to setters, so this works as a stop gap.
  24. // Replace this with something like a special cased [LegacyNullToEmptyString].
  25. [LegacyNullToEmptyString, CEReactions] attribute DOMString? textContent;
  26. [CEReactions] undefined normalize();
  27. [CEReactions] Node appendChild(Node node);
  28. [ImplementedAs=pre_insert, CEReactions] Node insertBefore(Node node, Node? child);
  29. [CEReactions] Node replaceChild(Node node, Node child);
  30. [ImplementedAs=pre_remove, CEReactions] Node removeChild(Node child);
  31. [ImplementedAs=clone_node_binding, CEReactions] Node cloneNode(optional boolean deep = false);
  32. boolean contains(Node? other);
  33. boolean isEqualNode(Node? otherNode);
  34. boolean isSameNode(Node? otherNode);
  35. const unsigned short ELEMENT_NODE = 1;
  36. const unsigned short ATTRIBUTE_NODE = 2;
  37. const unsigned short TEXT_NODE = 3;
  38. const unsigned short CDATA_SECTION_NODE = 4;
  39. const unsigned short ENTITY_REFERENCE_NODE = 5;
  40. const unsigned short ENTITY_NODE = 6;
  41. const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
  42. const unsigned short COMMENT_NODE = 8;
  43. const unsigned short DOCUMENT_NODE = 9;
  44. const unsigned short DOCUMENT_TYPE_NODE = 10;
  45. const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
  46. const unsigned short NOTATION_NODE = 12;
  47. unsigned short compareDocumentPosition(Node? otherNode);
  48. // Node.compareDocumentPosition() constants
  49. const unsigned short DOCUMENT_POSITION_DISCONNECTED = 1;
  50. const unsigned short DOCUMENT_POSITION_PRECEDING = 2;
  51. const unsigned short DOCUMENT_POSITION_FOLLOWING = 4;
  52. const unsigned short DOCUMENT_POSITION_CONTAINS = 8;
  53. const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 16;
  54. const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
  55. };
  56. dictionary GetRootNodeOptions {
  57. boolean composed = false;
  58. };