Node.idl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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] Node appendChild(Node node);
  27. [ImplementedAs=pre_insert, CEReactions] Node insertBefore(Node node, Node? child);
  28. [CEReactions] Node replaceChild(Node node, Node child);
  29. [ImplementedAs=pre_remove, CEReactions] Node removeChild(Node child);
  30. [ImplementedAs=clone_node_binding, CEReactions] Node cloneNode(optional boolean deep = false);
  31. boolean contains(Node? other);
  32. boolean isEqualNode(Node? otherNode);
  33. boolean isSameNode(Node? otherNode);
  34. const unsigned short ELEMENT_NODE = 1;
  35. const unsigned short ATTRIBUTE_NODE = 2;
  36. const unsigned short TEXT_NODE = 3;
  37. const unsigned short CDATA_SECTION_NODE = 4;
  38. const unsigned short ENTITY_REFERENCE_NODE = 5;
  39. const unsigned short ENTITY_NODE = 6;
  40. const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
  41. const unsigned short COMMENT_NODE = 8;
  42. const unsigned short DOCUMENT_NODE = 9;
  43. const unsigned short DOCUMENT_TYPE_NODE = 10;
  44. const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
  45. const unsigned short NOTATION_NODE = 12;
  46. unsigned short compareDocumentPosition(Node? otherNode);
  47. // Node.compareDocumentPosition() constants
  48. const unsigned short DOCUMENT_POSITION_DISCONNECTED = 1;
  49. const unsigned short DOCUMENT_POSITION_PRECEDING = 2;
  50. const unsigned short DOCUMENT_POSITION_FOLLOWING = 4;
  51. const unsigned short DOCUMENT_POSITION_CONTAINS = 8;
  52. const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 16;
  53. const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
  54. };
  55. dictionary GetRootNodeOptions {
  56. boolean composed = false;
  57. };