Element.idl 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #import <Animations/Animatable.idl>
  2. #import <ARIA/ARIAMixin.idl>
  3. #import <DOM/Attr.idl>
  4. #import <DOM/ChildNode.idl>
  5. #import <DOM/DOMTokenList.idl>
  6. #import <DOM/NamedNodeMap.idl>
  7. #import <DOM/Node.idl>
  8. #import <DOM/NodeList.idl>
  9. #import <DOM/ParentNode.idl>
  10. #import <DOM/ShadowRoot.idl>
  11. #import <DOM/Slottable.idl>
  12. #import <Geometry/DOMRect.idl>
  13. #import <Geometry/DOMRectList.idl>
  14. #import <HTML/HTMLSlotElement.idl>
  15. #import <HTML/Window.idl>
  16. enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
  17. dictionary ScrollIntoViewOptions : ScrollOptions {
  18. ScrollLogicalPosition block = "start";
  19. ScrollLogicalPosition inline = "nearest";
  20. };
  21. // https://dom.spec.whatwg.org/#element
  22. [Exposed=Window]
  23. interface Element : Node {
  24. readonly attribute DOMString? namespaceURI;
  25. readonly attribute DOMString? prefix;
  26. readonly attribute DOMString localName;
  27. readonly attribute DOMString tagName;
  28. [Reflect, CEReactions] attribute DOMString id;
  29. [Reflect=class, CEReactions] attribute DOMString className;
  30. [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
  31. [Reflect, CEReactions, Unscopable] attribute DOMString slot;
  32. boolean hasAttributes();
  33. [SameObject] readonly attribute NamedNodeMap attributes;
  34. sequence<DOMString> getAttributeNames();
  35. DOMString? getAttribute(DOMString qualifiedName);
  36. DOMString? getAttributeNS([FlyString] DOMString? namespace, [FlyString] DOMString localName);
  37. [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
  38. [CEReactions] undefined setAttributeNS([FlyString] DOMString? namespace , [FlyString] DOMString qualifiedName , DOMString value);
  39. [CEReactions] undefined removeAttribute([FlyString] DOMString qualifiedName);
  40. [CEReactions] undefined removeAttributeNS([FlyString] DOMString? namespace, [FlyString] DOMString localName);
  41. [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
  42. boolean hasAttribute(DOMString qualifiedName);
  43. boolean hasAttributeNS([FlyString] DOMString? namespace, [FlyString] DOMString localName);
  44. Attr? getAttributeNode([FlyString] DOMString qualifiedName);
  45. Attr? getAttributeNodeNS([FlyString] DOMString? namespace, [FlyString] DOMString localName);
  46. [CEReactions] Attr? setAttributeNode(Attr attr);
  47. [CEReactions] Attr? setAttributeNodeNS(Attr attr);
  48. [CEReactions] Attr removeAttributeNode(Attr attr);
  49. ShadowRoot attachShadow(ShadowRootInit init);
  50. [ImplementedAs=shadow_root_for_bindings] readonly attribute ShadowRoot? shadowRoot;
  51. boolean matches(DOMString selectors);
  52. Element? closest(DOMString selectors);
  53. [ImplementedAs=matches] boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
  54. HTMLCollection getElementsByTagName([FlyString] DOMString tagName);
  55. HTMLCollection getElementsByTagNameNS([FlyString] DOMString? namespace, [FlyString] DOMString localName);
  56. HTMLCollection getElementsByClassName(DOMString className);
  57. [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
  58. undefined insertAdjacentText(DOMString where, DOMString data); // legacy
  59. // https://dom.spec.whatwg.org/#interface-nondocumenttypechildnode
  60. readonly attribute Element? nextElementSibling;
  61. readonly attribute Element? previousElementSibling;
  62. // https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
  63. DOMRectList getClientRects();
  64. DOMRect getBoundingClientRect();
  65. [FIXME] boolean checkVisibility(optional CheckVisibilityOptions options = {});
  66. undefined scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {});
  67. undefined scroll(optional ScrollToOptions options = {});
  68. undefined scroll(unrestricted double x, unrestricted double y);
  69. [ImplementedAs=scroll] undefined scrollTo(optional ScrollToOptions options = {});
  70. [ImplementedAs=scroll] undefined scrollTo(unrestricted double x, unrestricted double y);
  71. undefined scrollBy(optional ScrollToOptions options = {});
  72. undefined scrollBy(unrestricted double x, unrestricted double y);
  73. attribute unrestricted double scrollTop;
  74. attribute unrestricted double scrollLeft;
  75. readonly attribute long scrollWidth;
  76. readonly attribute long scrollHeight;
  77. readonly attribute long clientTop;
  78. readonly attribute long clientLeft;
  79. readonly attribute long clientWidth;
  80. readonly attribute long clientHeight;
  81. readonly attribute double currentCSSZoom;
  82. // https://html.spec.whatwg.org/#dom-parsing-and-serialization
  83. // FIXME: [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
  84. [CEReactions] undefined setHTMLUnsafe(DOMString html);
  85. DOMString getHTML(optional GetHTMLOptions options = {});
  86. // FIXME: [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
  87. [CEReactions, LegacyNullToEmptyString] attribute DOMString innerHTML;
  88. // FIXME: [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) outerHTML;
  89. [CEReactions, LegacyNullToEmptyString] attribute DOMString outerHTML;
  90. // FIXME: [CEReactions] undefined insertAdjacentHTML(DOMString position, (TrustedHTML or DOMString) string);
  91. [CEReactions] undefined insertAdjacentHTML(DOMString position, DOMString text);
  92. };
  93. dictionary GetHTMLOptions {
  94. boolean serializableShadowRoots = false;
  95. sequence<ShadowRoot> shadowRoots = [];
  96. };
  97. dictionary ShadowRootInit {
  98. required ShadowRootMode mode;
  99. boolean delegatesFocus = false;
  100. SlotAssignmentMode slotAssignment = "named";
  101. boolean clonable = false;
  102. boolean serializable = false;
  103. };
  104. Element includes ParentNode;
  105. Element includes ChildNode;
  106. // https://www.w3.org/TR/wai-aria-1.2/#idl_element
  107. Element includes ARIAMixin;
  108. Element includes Slottable;
  109. // https://www.w3.org/TR/web-animations-1/#extensions-to-the-element-interface
  110. Element includes Animatable;