-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParentNode.cljs
170 lines (117 loc) · 5.18 KB
/
ParentNode.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
(ns web.ParentNode
"The ParentNode mixin contains methods and properties that are
to all types of `web.Node` objects that can have children."
(:refer-clojure :exclude []))
(defn append
"Method.
The ParentNode.append() method inserts a set of `web.Node` objects
`web.dom.DOMString` objects after the last child of the ParentNode.
objects are inserted as equivalent `web.Text` nodes.
`[Throws, Unscopable]
void ParentNode.append((Node or DOMString)... nodes);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/append`"
[this & args]
(-> this .-append (.apply this (clj->js args))))
(defn prepend
"Method.
The ParentNode.prepend() method inserts a set of `web.Node` objects
`web.dom.DOMString` objects before the first child of the `web.ParentNode`.
objects are inserted as equivalent `web.Text` nodes.
`ParentNode.prepend(...nodesToPrepend);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/prepend`"
[this & args]
(-> this .-prepend (.apply this (clj->js args))))
(defn query-selector
"Method.
The `web.ParentNode` mixin defines the querySelector() method
returning an `web.Element` representing the first element matching
specified group of selectors which are descendants of the object
which the method was called.
`element = parentNode.querySelector(selectors);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/querySelector`"
[this selectors]
(-> this (.querySelector selectors)))
(defn query-selector-all
"Method.
The `web.ParentNode` mixin defines the querySelectorAll() method
returning a `web.NodeList` representing a list of elements matching
specified group of selectors which are descendants of the object
which the method was called.
`elementList = parentNode.querySelectorAll(selectors);`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/querySelectorAll`"
[this selectors]
(-> this (.querySelectorAll selectors)))
(defn child-element-count
"Property.
The ParentNode.childElementCount read-only property returns an
long representing the number of child elements of the given element.
`var count = node.childElementCount;
count
The return value, which is an unsigned long (simply an integer) type.
node
An object representing a `web.Document`, `web.web-components.DocumentFragment`, or `web.Element`.`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/childElementCount`"
[this]
(-> this (.-childElementCount)))
(defn set-child-element-count!
"Property.
The ParentNode.childElementCount read-only property returns an
long representing the number of child elements of the given element.
`var count = node.childElementCount;
count
The return value, which is an unsigned long (simply an integer) type.
node
An object representing a `web.Document`, `web.web-components.DocumentFragment`, or `web.Element`.`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/childElementCount`"
[this val]
(aset this "childElementCount" val))
(defn children
"Property.
The `web.ParentNode` property children is a read-only property
returns a live `web.dom.HTMLCollection` which contains all of
child `elements` of the node upon which it was called.
`var children = node.children;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children`"
[this]
(-> this (.-children)))
(defn set-children!
"Property.
The `web.ParentNode` property children is a read-only property
returns a live `web.dom.HTMLCollection` which contains all of
child `elements` of the node upon which it was called.
`var children = node.children;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/children`"
[this val]
(aset this "children" val))
(defn first-element-child
"Property.
The ParentNode.firstElementChild read-only property returns the
first child `web.Element`, or null if there are no child elements.
`var element = node.firstElementChild;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/firstElementChild`"
[this]
(-> this (.-firstElementChild)))
(defn set-first-element-child!
"Property.
The ParentNode.firstElementChild read-only property returns the
first child `web.Element`, or null if there are no child elements.
`var element = node.firstElementChild;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/firstElementChild`"
[this val]
(aset this "firstElementChild" val))
(defn last-element-child
"Property.
The ParentNode.lastElementChild read-only property returns the
last child `web.Element` or null if there are no child elements.
`var element = node.lastElementChild;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/lastElementChild`"
[this]
(-> this (.-lastElementChild)))
(defn set-last-element-child!
"Property.
The ParentNode.lastElementChild read-only property returns the
last child `web.Element` or null if there are no child elements.
`var element = node.lastElementChild;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/lastElementChild`"
[this val]
(aset this "lastElementChild" val))