pseudo-dom 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +626 -116
- package/browser/pseudo-dom.js +849 -407
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/classes/PseudoEventListener.d.ts +25 -25
- package/dist/classes/PseudoEventListener.js +37 -34
- package/dist/classes/PseudoEventListener.min.js +1 -1
- package/dist/classes/PseudoHTMLDocument.d.ts +2 -2
- package/dist/classes/PseudoHTMLDocument.js +10 -21
- package/dist/classes/PseudoHTMLDocument.min.js +1 -1
- package/dist/classes/PseudoNodeList.js +14 -8
- package/dist/classes/PseudoNodeList.min.js +1 -1
- package/dist/factories/generateNode.d.ts +2 -10
- package/dist/factories/generateNode.js +9 -42
- package/dist/factories/generateNode.min.js +1 -1
- package/dist/functions/getParentNodes.d.ts +8 -6
- package/dist/functions/getParentNodes.js +16 -9
- package/dist/functions/getParentNodes.min.js +1 -1
- package/dist/functions/getParentNodesFromAttribute.d.ts +7 -7
- package/dist/functions/getParentNodesFromAttribute.js +21 -1
- package/dist/functions/getParentNodesFromAttribute.min.js +1 -1
- package/dist/functions.d.ts +1 -1
- package/dist/interfaces/PseudoEventTarget.d.ts +2 -2
- package/dist/services/DocumentFragmentService.d.ts +9 -0
- package/dist/services/DocumentFragmentService.js +16 -1
- package/dist/services/DocumentFragmentService.min.js +1 -1
- package/dist/services/DocumentService.d.ts +8 -0
- package/dist/services/DocumentService.js +15 -1
- package/dist/services/DocumentService.min.js +1 -1
- package/dist/services/ElementService.d.ts +6 -6
- package/dist/services/ElementService.js +28 -17
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/EventService.d.ts +16 -4
- package/dist/services/EventService.js +59 -31
- package/dist/services/EventService.min.js +1 -1
- package/dist/services/EventTargetService.d.ts +41 -9
- package/dist/services/EventTargetService.js +121 -52
- package/dist/services/EventTargetService.min.js +1 -1
- package/dist/services/NodeService.d.ts +31 -16
- package/dist/services/NodeService.js +90 -33
- package/dist/services/NodeService.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,15 +7,20 @@ Mock the DOM for server side-side DOM state and in tests.
|
|
|
7
7
|
Pseudo DOM recreates the browser DOM API (following the MDN documentation) so DOM-dependent code can run in Node, for
|
|
8
8
|
example in tests, without a real or headless browser. It is written in TypeScript and ships type definitions.
|
|
9
9
|
|
|
10
|
-
Working today: `EventService` (Event)
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`
|
|
18
|
-
|
|
10
|
+
Working today: `EventService` (Event) and `EventTargetService` (EventTarget), which dispatch an event through the tree the
|
|
11
|
+
way the DOM does (capture down from the root, the target, then bubbling back up, with `stopPropagation`,
|
|
12
|
+
`stopImmediatePropagation`, `once`, `passive`, `preventDefault` and the default action of the target; clicking a submit
|
|
13
|
+
button sends a `submit` event to its form), `NodeService`
|
|
14
|
+
(Node: a real tree with `parentNode`, `previousSibling` / `nextSibling`, `firstChild` / `lastChild`, `appendChild`,
|
|
15
|
+
`insertBefore`, `removeChild`, `replaceChild`, `contains` and `getRootNode`; nodes move when they are added somewhere
|
|
16
|
+
else, document fragments insert their children, and a node cannot be put inside itself), `ElementService` /
|
|
17
|
+
`HTMLElementService` (Element and HTMLElement, including attributes, `NamedNodeMap`, `classList`), `AttrService`,
|
|
18
|
+
`DOMTokenListService`, `NamedNodeMapService`, `DocumentService` / `DocumentFragmentService`, `PseudoNodeList`, and
|
|
19
|
+
`generateDocument` for creating a document.
|
|
20
|
+
|
|
21
|
+
Not implemented yet (these throw a "not implemented" error or are missing): `cloneNode`, `compareDocumentPosition`, `isEqualNode`, `querySelector` /
|
|
22
|
+
`querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the Element and Document APIs. The API
|
|
23
|
+
will change before 1.0.
|
|
19
24
|
## Modules
|
|
20
25
|
|
|
21
26
|
<dl>
|
|
@@ -37,7 +42,10 @@ Element and Document APIs. The API will change before 1.0.
|
|
|
37
42
|
<dd><p>Simulate the behaviour of the HTMLElement Class when there is no DOM available.</p>
|
|
38
43
|
</dd>
|
|
39
44
|
<dt><a href="#EventTargetService">EventTargetService</a></dt>
|
|
40
|
-
<dd><p>Simulate the behaviour of the EventTarget Class when there is no DOM available
|
|
45
|
+
<dd><p>Simulate the behaviour of the EventTarget Class when there is no DOM available.
|
|
46
|
+
Dispatching an event sends it through the tree the way the DOM does: down from the root to the target (capture
|
|
47
|
+
listeners), to the target itself, then back up to the root (the listeners which are not capture listeners, when the
|
|
48
|
+
event bubbles).</p>
|
|
41
49
|
</dd>
|
|
42
50
|
<dt><a href="#EventService">EventService</a></dt>
|
|
43
51
|
<dd><p>Simulate the behaviour of the Event Class when there is no DOM available.</p>
|
|
@@ -45,6 +53,13 @@ Element and Document APIs. The API will change before 1.0.
|
|
|
45
53
|
<dt><a href="#ElementService">ElementService</a> ⇐ <code>PseudoNode</code></dt>
|
|
46
54
|
<dd><p>Simulate the behaviour of the Element Class when there is no DOM available.</p>
|
|
47
55
|
</dd>
|
|
56
|
+
<dt><a href="#DocumentService">DocumentService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
57
|
+
<dd><p>Simulate the behaviour of the Document Class when there is no DOM available.</p>
|
|
58
|
+
</dd>
|
|
59
|
+
<dt><a href="#DocumentFragmentService">DocumentFragmentService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
60
|
+
<dd><p>Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
|
|
61
|
+
not part of a tree, when it is inserted its children are moved into the tree instead.</p>
|
|
62
|
+
</dd>
|
|
48
63
|
<dt><a href="#DOMTokenListService">DOMTokenListService</a></dt>
|
|
49
64
|
<dd><p>Simulate the behaviour of the DOMTokenList Class when there is no DOM available.</p>
|
|
50
65
|
</dd>
|
|
@@ -52,7 +67,8 @@ Element and Document APIs. The API will change before 1.0.
|
|
|
52
67
|
<dd><p>Simulate the behaviour of the Attr Class when there is no DOM available.</p>
|
|
53
68
|
</dd>
|
|
54
69
|
<dt><a href="#LinkedNode">LinkedNode</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
55
|
-
<dd><p>A node which is stored in a TreeLinker
|
|
70
|
+
<dd><p>A node which is stored in a TreeLinker (for example by a list built from an array of values). It finds its siblings
|
|
71
|
+
from that linker, and its parent from the linker's parent when it has not been given one by appendChild.</p>
|
|
56
72
|
</dd>
|
|
57
73
|
<dt><a href="#PseudoNodeList">PseudoNodeList</a> ⇐ <code>LinkedTreeList</code></dt>
|
|
58
74
|
<dd><p>A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
@@ -76,6 +92,15 @@ the linkers that hold them.</p>
|
|
|
76
92
|
## Functions
|
|
77
93
|
|
|
78
94
|
<dl>
|
|
95
|
+
<dt><a href="#getParentNodesFromAttribute">getParentNodesFromAttribute(attr, value, node)</a> ⇒ <code>Array.<PseudoNode></code></dt>
|
|
96
|
+
<dd><p>A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
97
|
+
This function will check all the parents starting from node, and scan the attributes
|
|
98
|
+
property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.</p>
|
|
99
|
+
</dd>
|
|
100
|
+
<dt><a href="#getParentNodes">getParentNodes(node)</a> ⇒ <code>Array.<PseudoNode></code></dt>
|
|
101
|
+
<dd><p>Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
102
|
+
order in which an event travels down through them). A node which has no parent has no ancestors.</p>
|
|
103
|
+
</dd>
|
|
79
104
|
<dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
|
|
80
105
|
<dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
|
|
81
106
|
</dd>
|
|
@@ -114,22 +139,38 @@ Simulate the behaviour of the Node Class when there is no DOM available.
|
|
|
114
139
|
|
|
115
140
|
* [NodeService](#NodeService) ⇐ <code>PseudoEventTarget</code>
|
|
116
141
|
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
142
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
117
143
|
* [.cloneNode()](#NodeService+cloneNode)
|
|
118
144
|
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
119
|
-
* [.contains()](#NodeService+contains)
|
|
120
|
-
* [.insertBefore()](#NodeService+insertBefore)
|
|
145
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
146
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
121
147
|
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
122
148
|
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
123
|
-
* [.replaceChild()](#NodeService+replaceChild)
|
|
149
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
124
150
|
|
|
125
151
|
<a name="NodeService+appendChild"></a>
|
|
126
152
|
|
|
127
153
|
### nodeService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
154
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
155
|
+
|
|
128
156
|
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
157
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
129
158
|
|
|
130
|
-
| Param | Type |
|
|
131
|
-
| --- | --- |
|
|
132
|
-
| childNode | <code>PseudoNode</code> |
|
|
159
|
+
| Param | Type | Description |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
162
|
+
|
|
163
|
+
<a name="NodeService+childInserted"></a>
|
|
164
|
+
|
|
165
|
+
### nodeService.childInserted(child)
|
|
166
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
167
|
+
(for example elements applying default events) can do so.
|
|
168
|
+
|
|
169
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
170
|
+
|
|
171
|
+
| Param | Type | Description |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
133
174
|
|
|
134
175
|
<a name="NodeService+cloneNode"></a>
|
|
135
176
|
|
|
@@ -153,23 +194,32 @@ Not implemented yet.
|
|
|
153
194
|
|
|
154
195
|
<a name="NodeService+contains"></a>
|
|
155
196
|
|
|
156
|
-
### nodeService.contains()
|
|
157
|
-
|
|
197
|
+
### nodeService.contains(otherNode) ⇒ <code>boolean</code>
|
|
198
|
+
Check whether a node is this node or one of its descendants.
|
|
158
199
|
|
|
159
200
|
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
160
|
-
**Throws**:
|
|
161
201
|
|
|
162
|
-
|
|
202
|
+
| Param | Type | Description |
|
|
203
|
+
| --- | --- | --- |
|
|
204
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
163
205
|
|
|
164
206
|
<a name="NodeService+insertBefore"></a>
|
|
165
207
|
|
|
166
|
-
### nodeService.insertBefore()
|
|
167
|
-
|
|
208
|
+
### nodeService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
209
|
+
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
|
|
210
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
168
211
|
|
|
169
212
|
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
213
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
170
214
|
**Throws**:
|
|
171
215
|
|
|
172
|
-
- <code>Error</code>
|
|
216
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
| Param | Type | Default | Description |
|
|
220
|
+
| --- | --- | --- | --- |
|
|
221
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
222
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
173
223
|
|
|
174
224
|
<a name="NodeService+isEqualNode"></a>
|
|
175
225
|
|
|
@@ -184,9 +234,10 @@ Not implemented yet.
|
|
|
184
234
|
<a name="NodeService+removeChild"></a>
|
|
185
235
|
|
|
186
236
|
### nodeService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
187
|
-
Remove
|
|
237
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
188
238
|
|
|
189
239
|
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
240
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
190
241
|
**Throws**:
|
|
191
242
|
|
|
192
243
|
- <code>Error</code> When the node is not a child of this node
|
|
@@ -194,17 +245,24 @@ Remove the given child from this node.
|
|
|
194
245
|
|
|
195
246
|
| Param | Type | Description |
|
|
196
247
|
| --- | --- | --- |
|
|
197
|
-
| childElement | <code>PseudoNode</code> | The child node
|
|
248
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
198
249
|
|
|
199
250
|
<a name="NodeService+replaceChild"></a>
|
|
200
251
|
|
|
201
|
-
### nodeService.replaceChild()
|
|
202
|
-
|
|
252
|
+
### nodeService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
253
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
203
254
|
|
|
204
255
|
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
256
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
205
257
|
**Throws**:
|
|
206
258
|
|
|
207
|
-
- <code>Error</code>
|
|
259
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
| Param | Type | Description |
|
|
263
|
+
| --- | --- | --- |
|
|
264
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
265
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
208
266
|
|
|
209
267
|
<a name="NamedNodeMapService"></a>
|
|
210
268
|
|
|
@@ -259,6 +317,9 @@ Simulate the HTMLElement object when the Dom is not available
|
|
|
259
317
|
|
|
260
318
|
## EventTargetService
|
|
261
319
|
Simulate the behaviour of the EventTarget Class when there is no DOM available.
|
|
320
|
+
Dispatching an event sends it through the tree the way the DOM does: down from the root to the target (capture
|
|
321
|
+
listeners), to the target itself, then back up to the root (the listeners which are not capture listeners, when the
|
|
322
|
+
event bubbles).
|
|
262
323
|
|
|
263
324
|
**Kind**: global class
|
|
264
325
|
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
@@ -274,8 +335,12 @@ Simulate the behaviour of the EventTarget Class when there is no DOM available.
|
|
|
274
335
|
|
|
275
336
|
* [EventTargetService](#EventTargetService)
|
|
276
337
|
* [.listenersFor(type)](#EventTargetService+listenersFor) ⇒ <code>LinkedList</code>
|
|
277
|
-
* [.runEvents(event)](#EventTargetService+runEvents) ⇒ <code
|
|
338
|
+
* [.runEvents(event)](#EventTargetService+runEvents) ⇒ <code>Array.<\*></code>
|
|
339
|
+
* [.removeListener(type, listener)](#EventTargetService+removeListener)
|
|
278
340
|
* [.setDefaultEvent(type, callback)](#EventTargetService+setDefaultEvent)
|
|
341
|
+
* [.addEventListener(type, callback, [useCapture])](#EventTargetService+addEventListener)
|
|
342
|
+
* [.removeEventListener(type, callback, [options])](#EventTargetService+removeEventListener)
|
|
343
|
+
* [.dispatchEvent(event)](#EventTargetService+dispatchEvent) ⇒ <code>boolean</code>
|
|
279
344
|
|
|
280
345
|
<a name="EventTargetService+listenersFor"></a>
|
|
281
346
|
|
|
@@ -290,17 +355,30 @@ The listeners registered for a type of event, creating the (empty) list of them
|
|
|
290
355
|
|
|
291
356
|
<a name="EventTargetService+runEvents"></a>
|
|
292
357
|
|
|
293
|
-
### eventTargetService.runEvents(event) ⇒ <code
|
|
294
|
-
Run
|
|
295
|
-
|
|
296
|
-
and listeners
|
|
358
|
+
### eventTargetService.runEvents(event) ⇒ <code>Array.<\*></code>
|
|
359
|
+
Run the listeners registered on this target for the type of the event which apply to the phase the event is in
|
|
360
|
+
(at the target, the capture listeners run before the others). Listeners which are added while this runs do not run
|
|
361
|
+
for this event, and listeners which are removed while it runs no longer do. Running stops as soon as immediate
|
|
362
|
+
propagation is stopped. A listener which throws does not stop the others.
|
|
363
|
+
|
|
364
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
365
|
+
**Returns**: <code>Array.<\*></code> - The errors which the listeners threw
|
|
366
|
+
|
|
367
|
+
| Param | Type | Description |
|
|
368
|
+
| --- | --- | --- |
|
|
369
|
+
| event | [<code>EventService</code>](#EventService) | The event, which is at a phase and has a current target |
|
|
370
|
+
|
|
371
|
+
<a name="EventTargetService+removeListener"></a>
|
|
372
|
+
|
|
373
|
+
### eventTargetService.removeListener(type, listener)
|
|
374
|
+
Take a listener out of the registered listeners, so that it does not run again.
|
|
297
375
|
|
|
298
376
|
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
299
|
-
**Returns**: <code>\*</code> - true when there was nothing registered, otherwise the last value returned from a handler (null when none ran)
|
|
300
377
|
|
|
301
378
|
| Param | Type |
|
|
302
379
|
| --- | --- |
|
|
303
|
-
|
|
|
380
|
+
| type | <code>string</code> |
|
|
381
|
+
| listener | [<code>PseudoEventListener</code>](#PseudoEventListener) |
|
|
304
382
|
|
|
305
383
|
<a name="EventTargetService+setDefaultEvent"></a>
|
|
306
384
|
|
|
@@ -314,6 +392,54 @@ Register the function to run when nothing else has prevented the default for thi
|
|
|
314
392
|
| type | <code>string</code> |
|
|
315
393
|
| callback | <code>function</code> |
|
|
316
394
|
|
|
395
|
+
<a name="EventTargetService+addEventListener"></a>
|
|
396
|
+
|
|
397
|
+
### eventTargetService.addEventListener(type, callback, [useCapture])
|
|
398
|
+
Registers an event handler of a specific event type. Adding the same handler again for the same type and phase does
|
|
399
|
+
nothing, like the DOM.
|
|
400
|
+
|
|
401
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
402
|
+
|
|
403
|
+
| Param | Type | Default | Description |
|
|
404
|
+
| --- | --- | --- | --- |
|
|
405
|
+
| type | <code>string</code> | | The type of event to listen for |
|
|
406
|
+
| callback | <code>function</code> \| <code>Object</code> | | The function to call (or an object with a handleEvent function) |
|
|
407
|
+
| [useCapture] | <code>Object</code> \| <code>boolean</code> | <code>false</code> | Listen while the event travels down to the target (true), or an object with capture, once and passive |
|
|
408
|
+
|
|
409
|
+
<a name="EventTargetService+removeEventListener"></a>
|
|
410
|
+
|
|
411
|
+
### eventTargetService.removeEventListener(type, callback, [options])
|
|
412
|
+
Removes an event listener, the one which was added with the same type, handler and phase.
|
|
413
|
+
|
|
414
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
415
|
+
|
|
416
|
+
| Param | Type | Default | Description |
|
|
417
|
+
| --- | --- | --- | --- |
|
|
418
|
+
| type | <code>string</code> | | The type of event |
|
|
419
|
+
| callback | <code>function</code> \| <code>Object</code> | | The handler which was added |
|
|
420
|
+
| [options] | <code>Object</code> \| <code>boolean</code> | <code>false</code> | Whether the listener was a capture listener (true), or an object with capture |
|
|
421
|
+
|
|
422
|
+
<a name="EventTargetService+dispatchEvent"></a>
|
|
423
|
+
|
|
424
|
+
### eventTargetService.dispatchEvent(event) ⇒ <code>boolean</code>
|
|
425
|
+
Dispatches an event to this target and through the tree: capture listeners of the ancestors from the root down,
|
|
426
|
+
then the listeners of this target, then (when the event bubbles) the other listeners of the ancestors from the
|
|
427
|
+
parent up to the root. stopPropagation() stops it reaching further targets, stopImmediatePropagation() also stops
|
|
428
|
+
the remaining listeners of the current target. Afterwards, unless the default was prevented, the default action
|
|
429
|
+
of this target (see setDefaultEvent) runs. The event can be dispatched again afterwards.
|
|
430
|
+
|
|
431
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
432
|
+
**Returns**: <code>boolean</code> - False when the event was cancelable and a listener prevented the default, otherwise true
|
|
433
|
+
**Throws**:
|
|
434
|
+
|
|
435
|
+
- <code>Error</code> When the event is already being dispatched, or (after the whole dispatch has finished) the error
|
|
436
|
+
which a listener threw (an error with all of them in its errors property when several did)
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
| Param | Type | Description |
|
|
440
|
+
| --- | --- | --- |
|
|
441
|
+
| event | [<code>EventService</code>](#EventService) | The event to dispatch |
|
|
442
|
+
|
|
317
443
|
<a name="EventService"></a>
|
|
318
444
|
|
|
319
445
|
## EventService
|
|
@@ -359,9 +485,9 @@ Simulate the behaviour of the Event Class when there is no DOM available.
|
|
|
359
485
|
| --- | --- | --- |
|
|
360
486
|
| typeArg | <code>string</code> | |
|
|
361
487
|
| [eventOptions] | <code>Object</code> | <code>{}</code> |
|
|
362
|
-
| [eventOptions.bubbles] | <code>boolean</code> | <code>
|
|
363
|
-
| [eventOptions.cancelable] | <code>boolean</code> | <code>
|
|
364
|
-
| [eventOptions.composed] | <code>boolean</code> | <code>
|
|
488
|
+
| [eventOptions.bubbles] | <code>boolean</code> | <code>false</code> |
|
|
489
|
+
| [eventOptions.cancelable] | <code>boolean</code> | <code>false</code> |
|
|
490
|
+
| [eventOptions.composed] | <code>boolean</code> | <code>false</code> |
|
|
365
491
|
|
|
366
492
|
<a name="EventService+inner"></a>
|
|
367
493
|
|
|
@@ -421,7 +547,7 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
421
547
|
* [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
|
|
422
548
|
* [new ElementService([settings])](#new_ElementService_new)
|
|
423
549
|
* [.applyDefaultEvent()](#ElementService+applyDefaultEvent) ⇒ <code>function</code>
|
|
424
|
-
* [.
|
|
550
|
+
* [.childInserted(child)](#ElementService+childInserted)
|
|
425
551
|
* [.hasAttribute(attributeName)](#ElementService+hasAttribute) ⇒ <code>boolean</code>
|
|
426
552
|
* [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
|
|
427
553
|
* [.getAttribute(attributeName)](#ElementService+getAttribute) ⇒ <code>string</code> \| <code>null</code>
|
|
@@ -436,8 +562,8 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
436
562
|
| [settings] | <code>Object</code> | <code>{}</code> | |
|
|
437
563
|
| [settings.tagName] | <code>string</code> | <code>"''"</code> | The name of the tag this element represents |
|
|
438
564
|
| [settings.attributes] | <code>Array.<{name: string, value: \*}></code> | <code>[]</code> | The attributes (also assigned as properties) to start with |
|
|
439
|
-
| [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The
|
|
440
|
-
| [settings.children] | <code>Array
|
|
565
|
+
| [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The node to add this element to as its last child |
|
|
566
|
+
| [settings.children] | <code>Array.<PseudoNode></code> | <code>[]</code> | The nodes to start as children |
|
|
441
567
|
|
|
442
568
|
<a name="ElementService+applyDefaultEvent"></a>
|
|
443
569
|
|
|
@@ -445,14 +571,16 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
445
571
|
Some elements have default behaviour, this registers it when the element is added.
|
|
446
572
|
|
|
447
573
|
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
448
|
-
<a name="ElementService+
|
|
574
|
+
<a name="ElementService+childInserted"></a>
|
|
575
|
+
|
|
576
|
+
### elementService.childInserted(child)
|
|
577
|
+
An element which is added as a child gets its default events (for example a submit button submits its form).
|
|
449
578
|
|
|
450
|
-
### elementService.appendChild(childElement) ⇒ <code>PseudoNode</code>
|
|
451
579
|
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
452
580
|
|
|
453
|
-
| Param | Type |
|
|
454
|
-
| --- | --- |
|
|
455
|
-
|
|
|
581
|
+
| Param | Type | Description |
|
|
582
|
+
| --- | --- | --- |
|
|
583
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
456
584
|
|
|
457
585
|
<a name="ElementService+hasAttribute"></a>
|
|
458
586
|
|
|
@@ -500,6 +628,279 @@ Remove an attribute from the element.
|
|
|
500
628
|
| --- | --- |
|
|
501
629
|
| attributeName | <code>string</code> |
|
|
502
630
|
|
|
631
|
+
<a name="DocumentService"></a>
|
|
632
|
+
|
|
633
|
+
## DocumentService ⇐ [<code>NodeService</code>](#NodeService)
|
|
634
|
+
Simulate the behaviour of the Document Class when there is no DOM available.
|
|
635
|
+
|
|
636
|
+
**Kind**: global class
|
|
637
|
+
**Extends**: [<code>NodeService</code>](#NodeService)
|
|
638
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
639
|
+
|
|
640
|
+
* [DocumentService](#DocumentService) ⇐ [<code>NodeService</code>](#NodeService)
|
|
641
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
642
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
643
|
+
* [.cloneNode()](#NodeService+cloneNode)
|
|
644
|
+
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
645
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
646
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
647
|
+
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
648
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
649
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
650
|
+
|
|
651
|
+
<a name="NodeService+appendChild"></a>
|
|
652
|
+
|
|
653
|
+
### documentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
654
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
655
|
+
|
|
656
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
657
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
658
|
+
|
|
659
|
+
| Param | Type | Description |
|
|
660
|
+
| --- | --- | --- |
|
|
661
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
662
|
+
|
|
663
|
+
<a name="NodeService+childInserted"></a>
|
|
664
|
+
|
|
665
|
+
### documentService.childInserted(child)
|
|
666
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
667
|
+
(for example elements applying default events) can do so.
|
|
668
|
+
|
|
669
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
670
|
+
|
|
671
|
+
| Param | Type | Description |
|
|
672
|
+
| --- | --- | --- |
|
|
673
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
674
|
+
|
|
675
|
+
<a name="NodeService+cloneNode"></a>
|
|
676
|
+
|
|
677
|
+
### documentService.cloneNode()
|
|
678
|
+
Not implemented yet.
|
|
679
|
+
|
|
680
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
681
|
+
**Throws**:
|
|
682
|
+
|
|
683
|
+
- <code>Error</code>
|
|
684
|
+
|
|
685
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
686
|
+
|
|
687
|
+
### documentService.compareDocumentPosition()
|
|
688
|
+
Not implemented yet.
|
|
689
|
+
|
|
690
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
691
|
+
**Throws**:
|
|
692
|
+
|
|
693
|
+
- <code>Error</code>
|
|
694
|
+
|
|
695
|
+
<a name="NodeService+contains"></a>
|
|
696
|
+
|
|
697
|
+
### documentService.contains(otherNode) ⇒ <code>boolean</code>
|
|
698
|
+
Check whether a node is this node or one of its descendants.
|
|
699
|
+
|
|
700
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
701
|
+
|
|
702
|
+
| Param | Type | Description |
|
|
703
|
+
| --- | --- | --- |
|
|
704
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
705
|
+
|
|
706
|
+
<a name="NodeService+insertBefore"></a>
|
|
707
|
+
|
|
708
|
+
### documentService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
709
|
+
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
|
|
710
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
711
|
+
|
|
712
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
713
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
714
|
+
**Throws**:
|
|
715
|
+
|
|
716
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
| Param | Type | Default | Description |
|
|
720
|
+
| --- | --- | --- | --- |
|
|
721
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
722
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
723
|
+
|
|
724
|
+
<a name="NodeService+isEqualNode"></a>
|
|
725
|
+
|
|
726
|
+
### documentService.isEqualNode()
|
|
727
|
+
Not implemented yet.
|
|
728
|
+
|
|
729
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
730
|
+
**Throws**:
|
|
731
|
+
|
|
732
|
+
- <code>Error</code>
|
|
733
|
+
|
|
734
|
+
<a name="NodeService+removeChild"></a>
|
|
735
|
+
|
|
736
|
+
### documentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
737
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
738
|
+
|
|
739
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
740
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
741
|
+
**Throws**:
|
|
742
|
+
|
|
743
|
+
- <code>Error</code> When the node is not a child of this node
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
| Param | Type | Description |
|
|
747
|
+
| --- | --- | --- |
|
|
748
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
749
|
+
|
|
750
|
+
<a name="NodeService+replaceChild"></a>
|
|
751
|
+
|
|
752
|
+
### documentService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
753
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
754
|
+
|
|
755
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
756
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
757
|
+
**Throws**:
|
|
758
|
+
|
|
759
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
| Param | Type | Description |
|
|
763
|
+
| --- | --- | --- |
|
|
764
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
765
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
766
|
+
|
|
767
|
+
<a name="DocumentFragmentService"></a>
|
|
768
|
+
|
|
769
|
+
## DocumentFragmentService ⇐ [<code>NodeService</code>](#NodeService)
|
|
770
|
+
Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
|
|
771
|
+
not part of a tree, when it is inserted its children are moved into the tree instead.
|
|
772
|
+
|
|
773
|
+
**Kind**: global class
|
|
774
|
+
**Extends**: [<code>NodeService</code>](#NodeService)
|
|
775
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
776
|
+
|
|
777
|
+
* [DocumentFragmentService](#DocumentFragmentService) ⇐ [<code>NodeService</code>](#NodeService)
|
|
778
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
779
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
780
|
+
* [.cloneNode()](#NodeService+cloneNode)
|
|
781
|
+
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
782
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
783
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
784
|
+
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
785
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
786
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
787
|
+
|
|
788
|
+
<a name="NodeService+appendChild"></a>
|
|
789
|
+
|
|
790
|
+
### documentFragmentService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
791
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
792
|
+
|
|
793
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
794
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
795
|
+
|
|
796
|
+
| Param | Type | Description |
|
|
797
|
+
| --- | --- | --- |
|
|
798
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
799
|
+
|
|
800
|
+
<a name="NodeService+childInserted"></a>
|
|
801
|
+
|
|
802
|
+
### documentFragmentService.childInserted(child)
|
|
803
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
804
|
+
(for example elements applying default events) can do so.
|
|
805
|
+
|
|
806
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
807
|
+
|
|
808
|
+
| Param | Type | Description |
|
|
809
|
+
| --- | --- | --- |
|
|
810
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
811
|
+
|
|
812
|
+
<a name="NodeService+cloneNode"></a>
|
|
813
|
+
|
|
814
|
+
### documentFragmentService.cloneNode()
|
|
815
|
+
Not implemented yet.
|
|
816
|
+
|
|
817
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
818
|
+
**Throws**:
|
|
819
|
+
|
|
820
|
+
- <code>Error</code>
|
|
821
|
+
|
|
822
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
823
|
+
|
|
824
|
+
### documentFragmentService.compareDocumentPosition()
|
|
825
|
+
Not implemented yet.
|
|
826
|
+
|
|
827
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
828
|
+
**Throws**:
|
|
829
|
+
|
|
830
|
+
- <code>Error</code>
|
|
831
|
+
|
|
832
|
+
<a name="NodeService+contains"></a>
|
|
833
|
+
|
|
834
|
+
### documentFragmentService.contains(otherNode) ⇒ <code>boolean</code>
|
|
835
|
+
Check whether a node is this node or one of its descendants.
|
|
836
|
+
|
|
837
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
838
|
+
|
|
839
|
+
| Param | Type | Description |
|
|
840
|
+
| --- | --- | --- |
|
|
841
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
842
|
+
|
|
843
|
+
<a name="NodeService+insertBefore"></a>
|
|
844
|
+
|
|
845
|
+
### documentFragmentService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
846
|
+
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
|
|
847
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
848
|
+
|
|
849
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
850
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
851
|
+
**Throws**:
|
|
852
|
+
|
|
853
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
| Param | Type | Default | Description |
|
|
857
|
+
| --- | --- | --- | --- |
|
|
858
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
859
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
860
|
+
|
|
861
|
+
<a name="NodeService+isEqualNode"></a>
|
|
862
|
+
|
|
863
|
+
### documentFragmentService.isEqualNode()
|
|
864
|
+
Not implemented yet.
|
|
865
|
+
|
|
866
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
867
|
+
**Throws**:
|
|
868
|
+
|
|
869
|
+
- <code>Error</code>
|
|
870
|
+
|
|
871
|
+
<a name="NodeService+removeChild"></a>
|
|
872
|
+
|
|
873
|
+
### documentFragmentService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
874
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
875
|
+
|
|
876
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
877
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
878
|
+
**Throws**:
|
|
879
|
+
|
|
880
|
+
- <code>Error</code> When the node is not a child of this node
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
| Param | Type | Description |
|
|
884
|
+
| --- | --- | --- |
|
|
885
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
886
|
+
|
|
887
|
+
<a name="NodeService+replaceChild"></a>
|
|
888
|
+
|
|
889
|
+
### documentFragmentService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
890
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
891
|
+
|
|
892
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
893
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
894
|
+
**Throws**:
|
|
895
|
+
|
|
896
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
| Param | Type | Description |
|
|
900
|
+
| --- | --- | --- |
|
|
901
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
902
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
903
|
+
|
|
503
904
|
<a name="DOMTokenListService"></a>
|
|
504
905
|
|
|
505
906
|
## DOMTokenListService
|
|
@@ -528,13 +929,14 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
|
528
929
|
* [AttrService](#AttrService) ⇐ [<code>NodeService</code>](#NodeService)
|
|
529
930
|
* [new AttrService(name, [value], [ownerElement], [namespaceURI], [prefix])](#new_AttrService_new)
|
|
530
931
|
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
932
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
531
933
|
* [.cloneNode()](#NodeService+cloneNode)
|
|
532
934
|
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
533
|
-
* [.contains()](#NodeService+contains)
|
|
534
|
-
* [.insertBefore()](#NodeService+insertBefore)
|
|
935
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
936
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
535
937
|
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
536
938
|
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
537
|
-
* [.replaceChild()](#NodeService+replaceChild)
|
|
939
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
538
940
|
|
|
539
941
|
<a name="new_AttrService_new"></a>
|
|
540
942
|
|
|
@@ -551,12 +953,28 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
|
551
953
|
<a name="NodeService+appendChild"></a>
|
|
552
954
|
|
|
553
955
|
### attrService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
956
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
957
|
+
|
|
554
958
|
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
555
959
|
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
960
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
556
961
|
|
|
557
|
-
| Param | Type |
|
|
558
|
-
| --- | --- |
|
|
559
|
-
| childNode | <code>PseudoNode</code> |
|
|
962
|
+
| Param | Type | Description |
|
|
963
|
+
| --- | --- | --- |
|
|
964
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
965
|
+
|
|
966
|
+
<a name="NodeService+childInserted"></a>
|
|
967
|
+
|
|
968
|
+
### attrService.childInserted(child)
|
|
969
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
970
|
+
(for example elements applying default events) can do so.
|
|
971
|
+
|
|
972
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
973
|
+
**Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
|
|
974
|
+
|
|
975
|
+
| Param | Type | Description |
|
|
976
|
+
| --- | --- | --- |
|
|
977
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
560
978
|
|
|
561
979
|
<a name="NodeService+cloneNode"></a>
|
|
562
980
|
|
|
@@ -582,25 +1000,34 @@ Not implemented yet.
|
|
|
582
1000
|
|
|
583
1001
|
<a name="NodeService+contains"></a>
|
|
584
1002
|
|
|
585
|
-
### attrService.contains()
|
|
586
|
-
|
|
1003
|
+
### attrService.contains(otherNode) ⇒ <code>boolean</code>
|
|
1004
|
+
Check whether a node is this node or one of its descendants.
|
|
587
1005
|
|
|
588
1006
|
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
589
1007
|
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
590
|
-
**Throws**:
|
|
591
1008
|
|
|
592
|
-
|
|
1009
|
+
| Param | Type | Description |
|
|
1010
|
+
| --- | --- | --- |
|
|
1011
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
593
1012
|
|
|
594
1013
|
<a name="NodeService+insertBefore"></a>
|
|
595
1014
|
|
|
596
|
-
### attrService.insertBefore()
|
|
597
|
-
|
|
1015
|
+
### attrService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
1016
|
+
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
|
|
1017
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
598
1018
|
|
|
599
1019
|
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
600
1020
|
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
1021
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
601
1022
|
**Throws**:
|
|
602
1023
|
|
|
603
|
-
- <code>Error</code>
|
|
1024
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
| Param | Type | Default | Description |
|
|
1028
|
+
| --- | --- | --- | --- |
|
|
1029
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
1030
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
604
1031
|
|
|
605
1032
|
<a name="NodeService+isEqualNode"></a>
|
|
606
1033
|
|
|
@@ -616,10 +1043,11 @@ Not implemented yet.
|
|
|
616
1043
|
<a name="NodeService+removeChild"></a>
|
|
617
1044
|
|
|
618
1045
|
### attrService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
619
|
-
Remove
|
|
1046
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
620
1047
|
|
|
621
1048
|
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
622
1049
|
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
1050
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
623
1051
|
**Throws**:
|
|
624
1052
|
|
|
625
1053
|
- <code>Error</code> When the node is not a child of this node
|
|
@@ -627,23 +1055,31 @@ Remove the given child from this node.
|
|
|
627
1055
|
|
|
628
1056
|
| Param | Type | Description |
|
|
629
1057
|
| --- | --- | --- |
|
|
630
|
-
| childElement | <code>PseudoNode</code> | The child node
|
|
1058
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
631
1059
|
|
|
632
1060
|
<a name="NodeService+replaceChild"></a>
|
|
633
1061
|
|
|
634
|
-
### attrService.replaceChild()
|
|
635
|
-
|
|
1062
|
+
### attrService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
1063
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
636
1064
|
|
|
637
1065
|
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
638
1066
|
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
1067
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
639
1068
|
**Throws**:
|
|
640
1069
|
|
|
641
|
-
- <code>Error</code>
|
|
1070
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
| Param | Type | Description |
|
|
1074
|
+
| --- | --- | --- |
|
|
1075
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
1076
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
642
1077
|
|
|
643
1078
|
<a name="LinkedNode"></a>
|
|
644
1079
|
|
|
645
1080
|
## LinkedNode ⇐ [<code>NodeService</code>](#NodeService)
|
|
646
|
-
A node which is stored in a TreeLinker
|
|
1081
|
+
A node which is stored in a TreeLinker (for example by a list built from an array of values). It finds its siblings
|
|
1082
|
+
from that linker, and its parent from the linker's parent when it has not been given one by appendChild.
|
|
647
1083
|
|
|
648
1084
|
**Kind**: global class
|
|
649
1085
|
**Extends**: [<code>NodeService</code>](#NodeService)
|
|
@@ -652,13 +1088,14 @@ A node which is stored in a TreeLinker and answers questions about its position
|
|
|
652
1088
|
* [LinkedNode](#LinkedNode) ⇐ [<code>NodeService</code>](#NodeService)
|
|
653
1089
|
* [new LinkedNode(linker, value)](#new_LinkedNode_new)
|
|
654
1090
|
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
1091
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
655
1092
|
* [.cloneNode()](#NodeService+cloneNode)
|
|
656
1093
|
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
657
|
-
* [.contains()](#NodeService+contains)
|
|
658
|
-
* [.insertBefore()](#NodeService+insertBefore)
|
|
1094
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
1095
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
659
1096
|
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
660
1097
|
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
661
|
-
* [.replaceChild()](#NodeService+replaceChild)
|
|
1098
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
662
1099
|
|
|
663
1100
|
<a name="new_LinkedNode_new"></a>
|
|
664
1101
|
|
|
@@ -672,12 +1109,28 @@ A node which is stored in a TreeLinker and answers questions about its position
|
|
|
672
1109
|
<a name="NodeService+appendChild"></a>
|
|
673
1110
|
|
|
674
1111
|
### linkedNode.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
1112
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
1113
|
+
|
|
675
1114
|
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
676
1115
|
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
1116
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
677
1117
|
|
|
678
|
-
| Param | Type |
|
|
679
|
-
| --- | --- |
|
|
680
|
-
| childNode | <code>PseudoNode</code> |
|
|
1118
|
+
| Param | Type | Description |
|
|
1119
|
+
| --- | --- | --- |
|
|
1120
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
1121
|
+
|
|
1122
|
+
<a name="NodeService+childInserted"></a>
|
|
1123
|
+
|
|
1124
|
+
### linkedNode.childInserted(child)
|
|
1125
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
1126
|
+
(for example elements applying default events) can do so.
|
|
1127
|
+
|
|
1128
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
1129
|
+
**Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
|
|
1130
|
+
|
|
1131
|
+
| Param | Type | Description |
|
|
1132
|
+
| --- | --- | --- |
|
|
1133
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
681
1134
|
|
|
682
1135
|
<a name="NodeService+cloneNode"></a>
|
|
683
1136
|
|
|
@@ -703,25 +1156,34 @@ Not implemented yet.
|
|
|
703
1156
|
|
|
704
1157
|
<a name="NodeService+contains"></a>
|
|
705
1158
|
|
|
706
|
-
### linkedNode.contains()
|
|
707
|
-
|
|
1159
|
+
### linkedNode.contains(otherNode) ⇒ <code>boolean</code>
|
|
1160
|
+
Check whether a node is this node or one of its descendants.
|
|
708
1161
|
|
|
709
1162
|
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
710
1163
|
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
711
|
-
**Throws**:
|
|
712
1164
|
|
|
713
|
-
|
|
1165
|
+
| Param | Type | Description |
|
|
1166
|
+
| --- | --- | --- |
|
|
1167
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
714
1168
|
|
|
715
1169
|
<a name="NodeService+insertBefore"></a>
|
|
716
1170
|
|
|
717
|
-
### linkedNode.insertBefore()
|
|
718
|
-
|
|
1171
|
+
### linkedNode.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
1172
|
+
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
|
|
1173
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
719
1174
|
|
|
720
1175
|
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
721
1176
|
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
1177
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
722
1178
|
**Throws**:
|
|
723
1179
|
|
|
724
|
-
- <code>Error</code>
|
|
1180
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
| Param | Type | Default | Description |
|
|
1184
|
+
| --- | --- | --- | --- |
|
|
1185
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
1186
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
725
1187
|
|
|
726
1188
|
<a name="NodeService+isEqualNode"></a>
|
|
727
1189
|
|
|
@@ -737,10 +1199,11 @@ Not implemented yet.
|
|
|
737
1199
|
<a name="NodeService+removeChild"></a>
|
|
738
1200
|
|
|
739
1201
|
### linkedNode.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
740
|
-
Remove
|
|
1202
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
741
1203
|
|
|
742
1204
|
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
743
1205
|
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
1206
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
744
1207
|
**Throws**:
|
|
745
1208
|
|
|
746
1209
|
- <code>Error</code> When the node is not a child of this node
|
|
@@ -748,18 +1211,25 @@ Remove the given child from this node.
|
|
|
748
1211
|
|
|
749
1212
|
| Param | Type | Description |
|
|
750
1213
|
| --- | --- | --- |
|
|
751
|
-
| childElement | <code>PseudoNode</code> | The child node
|
|
1214
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
752
1215
|
|
|
753
1216
|
<a name="NodeService+replaceChild"></a>
|
|
754
1217
|
|
|
755
|
-
### linkedNode.replaceChild()
|
|
756
|
-
|
|
1218
|
+
### linkedNode.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
1219
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
757
1220
|
|
|
758
1221
|
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
759
1222
|
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
1223
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
760
1224
|
**Throws**:
|
|
761
1225
|
|
|
762
|
-
- <code>Error</code>
|
|
1226
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
| Param | Type | Description |
|
|
1230
|
+
| --- | --- | --- |
|
|
1231
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
1232
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
763
1233
|
|
|
764
1234
|
<a name="PseudoNodeList"></a>
|
|
765
1235
|
|
|
@@ -807,7 +1277,7 @@ Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
|
|
|
807
1277
|
| --- | --- | --- |
|
|
808
1278
|
| head | <code>PseudoHTMLElement</code> | A reference to the Head child element |
|
|
809
1279
|
| body | <code>PseudoHTMLElement</code> | A reference to the Body child element |
|
|
810
|
-
| createElement | <code>function</code> | Generate a new PseudoHTMLElement
|
|
1280
|
+
| createElement | <code>function</code> | Generate a new PseudoHTMLElement (which is not in the document until it is appended) |
|
|
811
1281
|
|
|
812
1282
|
|
|
813
1283
|
* [PseudoHTMLDocument](#PseudoHTMLDocument) ⇐ <code>PseudoHTMLElement</code>
|
|
@@ -836,7 +1306,7 @@ Create document body element
|
|
|
836
1306
|
<a name="PseudoHTMLDocument+createElement"></a>
|
|
837
1307
|
|
|
838
1308
|
### pseudoHTMLDocument.createElement(tagName) ⇒ <code>PseudoHTMLElement</code>
|
|
839
|
-
Create and return a PseudoHTMLElement
|
|
1309
|
+
Create and return a PseudoHTMLElement, which is not added to the document until it is appended somewhere
|
|
840
1310
|
|
|
841
1311
|
**Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
842
1312
|
|
|
@@ -861,22 +1331,52 @@ Handle events as they are stored and implemented.
|
|
|
861
1331
|
|
|
862
1332
|
|
|
863
1333
|
* [PseudoEventListener](#PseudoEventListener)
|
|
1334
|
+
* [new PseudoEventListener(eventType, [options], handleEvent, [originalCallback])](#new_PseudoEventListener_new)
|
|
864
1335
|
* [.callback](#PseudoEventListener+callback)
|
|
1336
|
+
* [.capture](#PseudoEventListener+capture)
|
|
1337
|
+
* [.passive](#PseudoEventListener+passive)
|
|
1338
|
+
* [.removed](#PseudoEventListener+removed)
|
|
865
1339
|
* [.handleEvent(event)](#PseudoEventListener+handleEvent) ⇒ <code>\*</code>
|
|
866
1340
|
* [.doCapturePhase(event)](#PseudoEventListener+doCapturePhase) ⇒ <code>boolean</code>
|
|
867
1341
|
* [.doTargetPhase(event)](#PseudoEventListener+doTargetPhase) ⇒ <code>boolean</code>
|
|
868
|
-
* [.doBubblePhase(event)](#PseudoEventListener+doBubblePhase) ⇒ <code>boolean</code>
|
|
1342
|
+
* [.doBubblePhase(event)](#PseudoEventListener+doBubblePhase) ⇒ <code>boolean</code>
|
|
869
1343
|
* [.skipPhase(event)](#PseudoEventListener+skipPhase) ⇒ <code>boolean</code>
|
|
870
|
-
* [.
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1344
|
+
* [.rejectEvent(event)](#PseudoEventListener+rejectEvent) ⇒ <code>boolean</code>
|
|
1345
|
+
|
|
1346
|
+
<a name="new_PseudoEventListener_new"></a>
|
|
1347
|
+
|
|
1348
|
+
### new PseudoEventListener(eventType, [options], handleEvent, [originalCallback])
|
|
1349
|
+
|
|
1350
|
+
| Param | Type | Default | Description |
|
|
1351
|
+
| --- | --- | --- | --- |
|
|
1352
|
+
| eventType | <code>string</code> | | The type of event this listens for |
|
|
1353
|
+
| [options] | <code>Object</code> | | The capture, once and passive options |
|
|
1354
|
+
| handleEvent | <code>function</code> | | The function which is called with the event, already bound to what it should run as |
|
|
1355
|
+
| [originalCallback] | <code>function</code> | <code>handleEvent</code> | The function (or object) which was given when registering, used to find this listener again |
|
|
874
1356
|
|
|
875
1357
|
<a name="PseudoEventListener+callback"></a>
|
|
876
1358
|
|
|
877
1359
|
### pseudoEventListener.callback
|
|
878
1360
|
The function (or object with handleEvent) which was originally given when registering, used to find this listener again for removal.
|
|
879
1361
|
|
|
1362
|
+
**Kind**: instance property of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
1363
|
+
<a name="PseudoEventListener+capture"></a>
|
|
1364
|
+
|
|
1365
|
+
### pseudoEventListener.capture
|
|
1366
|
+
Whether this listener listens in the capture phase (and at the target) rather than in the bubble phase.
|
|
1367
|
+
|
|
1368
|
+
**Kind**: instance property of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
1369
|
+
<a name="PseudoEventListener+passive"></a>
|
|
1370
|
+
|
|
1371
|
+
### pseudoEventListener.passive
|
|
1372
|
+
Whether the listener promises not to prevent the default (preventDefault does nothing while it runs).
|
|
1373
|
+
|
|
1374
|
+
**Kind**: instance property of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
1375
|
+
<a name="PseudoEventListener+removed"></a>
|
|
1376
|
+
|
|
1377
|
+
### pseudoEventListener.removed
|
|
1378
|
+
Whether this listener has been removed, a removed listener does not run even if the event already started.
|
|
1379
|
+
|
|
880
1380
|
**Kind**: instance property of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
881
1381
|
<a name="PseudoEventListener+handleEvent"></a>
|
|
882
1382
|
|
|
@@ -890,6 +1390,8 @@ The function (or object with handleEvent) which was originally given when regist
|
|
|
890
1390
|
<a name="PseudoEventListener+doCapturePhase"></a>
|
|
891
1391
|
|
|
892
1392
|
### pseudoEventListener.doCapturePhase(event) ⇒ <code>boolean</code>
|
|
1393
|
+
A capture listener runs while the event travels down to the target.
|
|
1394
|
+
|
|
893
1395
|
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
894
1396
|
|
|
895
1397
|
| Param | Type |
|
|
@@ -899,6 +1401,8 @@ The function (or object with handleEvent) which was originally given when regist
|
|
|
899
1401
|
<a name="PseudoEventListener+doTargetPhase"></a>
|
|
900
1402
|
|
|
901
1403
|
### pseudoEventListener.doTargetPhase(event) ⇒ <code>boolean</code>
|
|
1404
|
+
Every listener of the target itself runs, capture listeners first.
|
|
1405
|
+
|
|
902
1406
|
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
903
1407
|
|
|
904
1408
|
| Param | Type |
|
|
@@ -907,7 +1411,9 @@ The function (or object with handleEvent) which was originally given when regist
|
|
|
907
1411
|
|
|
908
1412
|
<a name="PseudoEventListener+doBubblePhase"></a>
|
|
909
1413
|
|
|
910
|
-
### pseudoEventListener.doBubblePhase(event) ⇒ <code>boolean</code>
|
|
1414
|
+
### pseudoEventListener.doBubblePhase(event) ⇒ <code>boolean</code>
|
|
1415
|
+
A listener which is not a capture listener runs while the event travels back up (when it bubbles).
|
|
1416
|
+
|
|
911
1417
|
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
912
1418
|
|
|
913
1419
|
| Param | Type |
|
|
@@ -923,46 +1429,50 @@ The function (or object with handleEvent) which was originally given when regist
|
|
|
923
1429
|
| --- | --- |
|
|
924
1430
|
| event | <code>PseudoEvent</code> |
|
|
925
1431
|
|
|
926
|
-
<a name="PseudoEventListener+
|
|
1432
|
+
<a name="PseudoEventListener+rejectEvent"></a>
|
|
1433
|
+
|
|
1434
|
+
### pseudoEventListener.rejectEvent(event) ⇒ <code>boolean</code>
|
|
1435
|
+
Whether this listener should not run for the event as it is now (it was removed, or it is for another phase).
|
|
1436
|
+
Stopping propagation is handled by the dispatching, since it stops other targets and not the listeners of the
|
|
1437
|
+
current one.
|
|
927
1438
|
|
|
928
|
-
### pseudoEventListener.skipDefault(event) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
929
1439
|
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
930
1440
|
|
|
931
1441
|
| Param | Type |
|
|
932
1442
|
| --- | --- |
|
|
933
1443
|
| event | <code>PseudoEvent</code> |
|
|
934
1444
|
|
|
935
|
-
<a name="
|
|
936
|
-
|
|
937
|
-
### pseudoEventListener.stopPropagation(event) ⇒ <code>boolean</code>
|
|
938
|
-
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
1445
|
+
<a name="HTMLElementService_1"></a>
|
|
939
1446
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1447
|
+
## HTMLElementService\_1 : <code>PseudoHTMLElement</code>
|
|
1448
|
+
**Kind**: global constant
|
|
1449
|
+
<a name="getParentNodesFromAttribute"></a>
|
|
943
1450
|
|
|
944
|
-
<
|
|
1451
|
+
## getParentNodesFromAttribute(attr, value, node) ⇒ <code>Array.<PseudoNode></code>
|
|
1452
|
+
A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
1453
|
+
This function will check all the parents starting from node, and scan the attributes
|
|
1454
|
+
property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
|
|
945
1455
|
|
|
946
|
-
|
|
947
|
-
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
1456
|
+
**Kind**: global function
|
|
948
1457
|
|
|
949
|
-
| Param | Type |
|
|
950
|
-
| --- | --- |
|
|
951
|
-
|
|
|
1458
|
+
| Param | Type | Description |
|
|
1459
|
+
| --- | --- | --- |
|
|
1460
|
+
| attr | <code>string</code> | The property to compare on each ancestor (a missing property counts as false) |
|
|
1461
|
+
| value | <code>boolean</code> \| <code>number</code> \| <code>string</code> | The value the property must have |
|
|
1462
|
+
| node | <code>PseudoEventTarget</code> \| <code>PseudoNode</code> \| <code>\*</code> | The node to find the matching ancestors of |
|
|
952
1463
|
|
|
953
|
-
<a name="
|
|
1464
|
+
<a name="getParentNodes"></a>
|
|
954
1465
|
|
|
955
|
-
|
|
956
|
-
|
|
1466
|
+
## getParentNodes(node) ⇒ <code>Array.<PseudoNode></code>
|
|
1467
|
+
Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
1468
|
+
order in which an event travels down through them). A node which has no parent has no ancestors.
|
|
957
1469
|
|
|
958
|
-
|
|
959
|
-
| --- | --- |
|
|
960
|
-
| event | <code>PseudoEvent</code> |
|
|
1470
|
+
**Kind**: global function
|
|
961
1471
|
|
|
962
|
-
|
|
1472
|
+
| Param | Type | Description |
|
|
1473
|
+
| --- | --- | --- |
|
|
1474
|
+
| node | <code>PseudoEventTarget</code> \| <code>PseudoNode</code> \| <code>\*</code> | The node to find the ancestors of |
|
|
963
1475
|
|
|
964
|
-
## HTMLElementService\_1 : <code>PseudoHTMLElement</code>
|
|
965
|
-
**Kind**: global constant
|
|
966
1476
|
<a name="generateNodeList"></a>
|
|
967
1477
|
|
|
968
1478
|
## generateNodeList([innerList]) ⇒ [<code>PseudoNodeList</code>](#PseudoNodeList)
|