Node.idl 3.0 KB

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