-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShadowRoot.cljs
208 lines (145 loc) · 6.39 KB
/
ShadowRoot.cljs
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
(ns web.shadow-dom.ShadowRoot
"The ShadowRoot interface of the Shadow DOM API is the root node
a DOM subtree that is rendered separately from a document's main
tree."
(:refer-clojure :exclude []))
(defn get-selection
"Method.
The getSelection() property of the `web.shadow-dom.DocumentOrShadowRoot`
returns a `web.other.Selection` object representing the range
text selected by the user, or the current position of the caret.
`var selection = documentOrShadowRootInstance.getSelection()`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/getSelection`"
[this ]
(-> this (.getSelection)))
(defn element-from-point
"Method.
The elementFromPoint() method—available on both the `web.Document`
`web.shadow-dom.ShadowRoot` objects—returns the topmost `web.Element`
the specified coordinates (relative to the viewport).
`var element = document.elementFromPoint(x, y);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/elementFromPoint`"
[this x y]
(-> this (.elementFromPoint x y)))
(defn elements-from-point
"Method.
The elementsFromPoint() property of the `web.shadow-dom.DocumentOrShadowRoot`
returns an array of all elements at the specified coordinates
to the viewport).
`var elements = document.elementsFromPoint(x, y);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/elementsFromPoint`"
[this x y]
(-> this (.elementsFromPoint x y)))
(defn caret-position-from-point
"Method.
The caretPositionFromPoint() property of the `web.shadow-dom.DocumentOrShadowRoot`
returns a `web.cssdom.CaretPosition` object, containing the DOM
along with the caret and caret's character offset within that
`var caretPosition = document.caretPositionFromPoint(float x, float y);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/caretPositionFromPoint`"
[this & args]
(-> this .-caretPositionFromPoint (.apply this (clj->js args))))
(defn delegates-focus
"Property.
The delegatesFocus read-only property of the `web.shadow-dom.ShadowRoot`
returns a boolean that indicates whether delegatesFocus was set
the shadow was attached (see `Element.attachShadow()`).
`var df = shadowRoot.delegatesFocus`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus`"
[this]
(-> this (.-delegatesFocus)))
(defn set-delegates-focus!
"Property.
The delegatesFocus read-only property of the `web.shadow-dom.ShadowRoot`
returns a boolean that indicates whether delegatesFocus was set
the shadow was attached (see `Element.attachShadow()`).
`var df = shadowRoot.delegatesFocus`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus`"
[this val]
(aset this "delegatesFocus" val))
(defn host
"Property.
The host read-only property of the `web.shadow-dom.ShadowRoot`
a reference to the DOM element the ShadowRoot is attached to.
`var element = shadowRoot.host`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host`"
[this]
(-> this (.-host)))
(defn set-host!
"Property.
The host read-only property of the `web.shadow-dom.ShadowRoot`
a reference to the DOM element the ShadowRoot is attached to.
`var element = shadowRoot.host`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host`"
[this val]
(aset this "host" val))
(defn inner-html
"Property.
The innerHTML property of the `web.shadow-dom.ShadowRoot` interface
or returns a reference to the DOM tree inside the ShadowRoot.
`var domString = shadowRoot.innerHTML
shadowRoot.innerHTML = domString`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/innerHTML`"
[this]
(-> this (.-innerHTML)))
(defn set-inner-html!
"Property.
The innerHTML property of the `web.shadow-dom.ShadowRoot` interface
or returns a reference to the DOM tree inside the ShadowRoot.
`var domString = shadowRoot.innerHTML
shadowRoot.innerHTML = domString`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/innerHTML`"
[this val]
(aset this "innerHTML" val))
(defn mode
"Property.
The mode property of the `web.shadow-dom.ShadowRoot` specifies
mode — either open or closed. This defines whether or not the
root's internal features are accessible from JavaScript.
`var mode = shadowRoot.mode`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode`"
[this]
(-> this (.-mode)))
(defn set-mode!
"Property.
The mode property of the `web.shadow-dom.ShadowRoot` specifies
mode — either open or closed. This defines whether or not the
root's internal features are accessible from JavaScript.
`var mode = shadowRoot.mode`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode`"
[this val]
(aset this "mode" val))
(defn active-element
"Property.
The activeElement read-only property of the `web.Document` and
interfaces returns the `web.Element` within the DOM or shadow
tree that currently has focus.
`var element = DocumentOrShadowRoot.activeElement`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement`"
[this]
(-> this (.-activeElement)))
(defn set-active-element!
"Property.
The activeElement read-only property of the `web.Document` and
interfaces returns the `web.Element` within the DOM or shadow
tree that currently has focus.
`var element = DocumentOrShadowRoot.activeElement`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/activeElement`"
[this val]
(aset this "activeElement" val))
(defn style-sheets
"Property.
The styleSheets read-only property of the `web.shadow-dom.DocumentOrShadowRoot`
returns a `web.cssdom.StyleSheetList` of `web.cssdom.CSSStyleSheet`
for stylesheets explicitly linked into or embedded in a document.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/styleSheets`"
[this]
(-> this (.-styleSheets)))
(defn set-style-sheets!
"Property.
The styleSheets read-only property of the `web.shadow-dom.DocumentOrShadowRoot`
returns a `web.cssdom.StyleSheetList` of `web.cssdom.CSSStyleSheet`
for stylesheets explicitly linked into or embedded in a document.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/styleSheets`"
[this val]
(aset this "styleSheets" val))