Document.idl 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #import <Animations/DocumentTimeline.idl>
  2. #import <CSS/StyleSheetList.idl>
  3. #import <DOM/CDATASection.idl>
  4. #import <DOM/Comment.idl>
  5. #import <DOM/DOMImplementation.idl>
  6. #import <DOM/DocumentFragment.idl>
  7. #import <DOM/DocumentOrShadowRoot.idl>
  8. #import <DOM/DocumentType.idl>
  9. #import <DOM/Element.idl>
  10. #import <DOM/Event.idl>
  11. #import <DOM/EventHandler.idl>
  12. #import <DOM/HTMLCollection.idl>
  13. #import <DOM/Node.idl>
  14. #import <DOM/NodeFilter.idl>
  15. #import <DOM/NodeIterator.idl>
  16. #import <DOM/NodeList.idl>
  17. #import <DOM/ParentNode.idl>
  18. #import <DOM/ProcessingInstruction.idl>
  19. #import <DOM/Range.idl>
  20. #import <DOM/Text.idl>
  21. #import <DOM/TreeWalker.idl>
  22. #import <HTML/HTMLElement.idl>
  23. #import <HTML/HTMLHeadElement.idl>
  24. #import <HTML/HTMLScriptElement.idl>
  25. #import <HTML/Location.idl>
  26. #import <Selection/Selection.idl>
  27. // https://dom.spec.whatwg.org/#document
  28. // https://html.spec.whatwg.org/multipage/dom.html#the-document-object
  29. [Exposed=Window, LegacyOverrideBuiltins]
  30. interface Document : Node {
  31. constructor();
  32. boolean hasFocus();
  33. [PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
  34. attribute USVString domain;
  35. readonly attribute DOMImplementation implementation;
  36. [ImplementedAs=url_string] readonly attribute USVString URL;
  37. readonly attribute USVString documentURI;
  38. readonly attribute DOMString characterSet;
  39. readonly attribute DOMString charset;
  40. readonly attribute DOMString inputEncoding;
  41. readonly attribute DOMString contentType;
  42. readonly attribute Window? defaultView;
  43. [CEReactions] Document open(optional DOMString unused1, optional DOMString unused2);
  44. WindowProxy? open(USVString url, DOMString name, DOMString features);
  45. [CEReactions] undefined close();
  46. [CEReactions] undefined write(DOMString... text);
  47. [CEReactions] undefined writeln(DOMString... text);
  48. attribute DOMString cookie;
  49. readonly attribute USVString referrer;
  50. readonly attribute Element? activeElement;
  51. Element? getElementById(DOMString id);
  52. HTMLCollection getElementsByName([FlyString] DOMString name);
  53. HTMLCollection getElementsByTagName(DOMString tagName);
  54. HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  55. HTMLCollection getElementsByClassName(DOMString className);
  56. [SameObject] readonly attribute HTMLCollection applets;
  57. [SameObject] readonly attribute HTMLCollection anchors;
  58. [SameObject] readonly attribute HTMLCollection images;
  59. [SameObject] readonly attribute HTMLCollection embeds;
  60. [SameObject] readonly attribute HTMLCollection plugins;
  61. [SameObject] readonly attribute HTMLCollection links;
  62. [SameObject] readonly attribute HTMLCollection forms;
  63. [SameObject] readonly attribute HTMLCollection scripts;
  64. // FIXME: Should return an HTMLAllCollection
  65. readonly attribute HTMLCollection all;
  66. [CEReactions, NewObject] Element createElement(DOMString tagName, optional (DOMString or ElementCreationOptions) options = {});
  67. [CEReactions, NewObject] Element createElementNS([FlyString] DOMString? namespace, DOMString qualifiedName, optional (DOMString or ElementCreationOptions) options = {});
  68. DocumentFragment createDocumentFragment();
  69. Text createTextNode(DOMString data);
  70. [NewObject] CDATASection createCDATASection(DOMString data);
  71. Comment createComment(DOMString data);
  72. [NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
  73. [NewObject] Attr createAttribute(DOMString localName);
  74. [NewObject] Attr createAttributeNS([FlyString] DOMString? namespace, DOMString qualifiedName);
  75. Range createRange();
  76. Event createEvent(DOMString interface);
  77. [CEReactions, NewObject] Node importNode(Node node, optional boolean deep = false);
  78. [CEReactions, ImplementedAs=adopt_node_binding] Node adoptNode(Node node);
  79. readonly attribute DOMString compatMode;
  80. readonly attribute DocumentType? doctype;
  81. readonly attribute Element? documentElement;
  82. [CEReactions] attribute HTMLElement? body;
  83. readonly attribute HTMLHeadElement? head;
  84. readonly attribute HTMLScriptElement? currentScript;
  85. readonly attribute DOMString readyState;
  86. [CEReactions] attribute DOMString title;
  87. readonly attribute boolean hidden;
  88. readonly attribute DOMString visibilityState;
  89. [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  90. [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
  91. Selection? getSelection();
  92. [CEReactions] attribute DOMString designMode;
  93. // https://www.w3.org/TR/web-animations-1/#extensions-to-the-document-interface
  94. readonly attribute DocumentTimeline timeline;
  95. // https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
  96. Element? elementFromPoint(double x, double y);
  97. sequence<Element> elementsFromPoint(double x, double y);
  98. readonly attribute Element? scrollingElement;
  99. // https://w3c.github.io/editing/docs/execCommand/
  100. [CEReactions] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
  101. boolean queryCommandEnabled(DOMString commandId);
  102. boolean queryCommandIndeterm(DOMString commandId);
  103. boolean queryCommandState(DOMString commandId);
  104. boolean queryCommandSupported(DOMString commandId);
  105. DOMString queryCommandValue(DOMString commandId);
  106. };
  107. dictionary ElementCreationOptions {
  108. DOMString is;
  109. };
  110. Document includes ParentNode;
  111. Document includes GlobalEventHandlers;
  112. Document includes DocumentOrShadowRoot;