summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM/Element.idl
blob: c152206aa23fbfa0cd572b9c7b7799bd61fa7581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#import <CSS/CSSStyleDeclaration.idl>
#import <DOM/Attr.idl>
#import <DOM/ARIAMixin.idl>
#import <DOM/ChildNode.idl>
#import <DOM/DOMTokenList.idl>
#import <DOM/InnerHTML.idl>
#import <DOM/NamedNodeMap.idl>
#import <DOM/Node.idl>
#import <DOM/NodeList.idl>
#import <DOM/ParentNode.idl>
#import <Geometry/DOMRect.idl>
#import <Geometry/DOMRectList.idl>

enum ScrollBehavior { "auto", "smooth" };
dictionary ScrollOptions {
    ScrollBehavior behavior = "auto";
};

enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
dictionary ScrollIntoViewOptions : ScrollOptions {
    ScrollLogicalPosition block = "start";
    ScrollLogicalPosition inline = "nearest";
};

// https://dom.spec.whatwg.org/#element
[Exposed=Window]
interface Element : Node {
    readonly attribute DOMString? namespaceURI;
    readonly attribute DOMString? prefix;
    readonly attribute DOMString localName;
    readonly attribute DOMString tagName;

    DOMString? getAttribute(DOMString qualifiedName);
    undefined setAttribute(DOMString qualifiedName, DOMString value);
    [CEReactions] undefined setAttributeNS(DOMString? namespace , DOMString qualifiedName , DOMString value);
    undefined removeAttribute(DOMString qualifiedName);
    [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
    boolean hasAttribute(DOMString qualifiedName);
    boolean hasAttributes();
    [SameObject] readonly attribute NamedNodeMap attributes;
    sequence<DOMString> getAttributeNames();

    Attr? getAttributeNode(DOMString qualifiedName);

    HTMLCollection getElementsByTagName(DOMString tagName);
    HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
    HTMLCollection getElementsByClassName(DOMString className);

    [Reflect] attribute DOMString id;
    [Reflect=class] attribute DOMString className;
    [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;

    boolean matches(DOMString selectors);
    Element? closest(DOMString selectors);

    // legacy alias of .matches
    [ImplementedAs=matches] boolean webkitMatchesSelector(DOMString selectors);

    readonly attribute Element? nextElementSibling;
    readonly attribute Element? previousElementSibling;

    [ImplementedAs=style_for_bindings] readonly attribute CSSStyleDeclaration style;

    DOMRect getBoundingClientRect();
    DOMRectList getClientRects();

    attribute unrestricted double scrollTop;
    attribute unrestricted double scrollLeft;
    readonly attribute long scrollWidth;
    readonly attribute long scrollHeight;
    readonly attribute long clientTop;
    readonly attribute long clientLeft;
    readonly attribute long clientWidth;
    readonly attribute long clientHeight;

    [CEReactions] Element? insertAdjacentElement(DOMString where, Element element);
    undefined insertAdjacentText(DOMString where, DOMString data);
    [CEReactions] undefined insertAdjacentHTML(DOMString position, DOMString text);

    undefined scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {});

};

Element includes ParentNode;
Element includes ChildNode;
Element includes InnerHTML;
// https://www.w3.org/TR/wai-aria-1.2/#idl_element
Element includes ARIAMixin;