Element.idl 6.1 KB

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