pseudo-dom 0.8.0 → 0.10.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 +971 -3
- package/browser/pseudo-dom.js +1141 -470
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/classes/PseudoHTMLDocument.d.ts +41 -41
- package/dist/classes/PseudoHTMLDocument.js +74 -74
- package/dist/factories/createDataset.d.ts +10 -0
- package/dist/factories/createDataset.js +78 -0
- package/dist/factories/createDataset.min.js +1 -0
- package/dist/factories/createStyleDeclaration.d.ts +30 -0
- package/dist/factories/createStyleDeclaration.js +64 -0
- package/dist/factories/createStyleDeclaration.min.js +1 -0
- package/dist/functions/getElementById.d.ts +13 -13
- package/dist/functions/getElementById.js +33 -33
- package/dist/interfaces/PseudoCSSStyleDeclaration.d.ts +14 -0
- package/dist/interfaces/PseudoCSSStyleDeclaration.js +5 -0
- package/dist/interfaces/PseudoCSSStyleDeclaration.min.js +1 -0
- package/dist/interfaces/PseudoDocument.d.ts +35 -35
- package/dist/interfaces/PseudoDocumentFragment.d.ts +10 -10
- package/dist/interfaces/PseudoElement.d.ts +765 -702
- package/dist/interfaces/PseudoHTMLElement.d.ts +12 -1
- package/dist/interfaces/PseudoShadowRoot.d.ts +12 -3
- package/dist/services/CSSStyleDeclarationService.d.ts +73 -0
- package/dist/services/CSSStyleDeclarationService.js +156 -0
- package/dist/services/CSSStyleDeclarationService.min.js +1 -0
- package/dist/services/DocumentFragmentService.d.ts +21 -21
- package/dist/services/DocumentFragmentService.js +42 -42
- package/dist/services/DocumentService.d.ts +46 -46
- package/dist/services/DocumentService.js +95 -95
- package/dist/services/ElementService.d.ts +361 -191
- package/dist/services/ElementService.js +717 -426
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/HTMLElementService.d.ts +31 -1
- package/dist/services/HTMLElementService.js +43 -4
- package/dist/services/HTMLElementService.min.js +1 -1
- package/dist/services/NodeService.d.ts +305 -297
- package/dist/services/NodeService.js +732 -721
- package/dist/services/NodeService.min.js +1 -1
- package/dist/services/ShadowRootService.d.ts +16 -4
- package/dist/services/ShadowRootService.js +24 -9
- package/dist/services/ShadowRootService.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,13 @@ else, document fragments insert their children, and a node cannot be put inside
|
|
|
18
18
|
`DOMTokenListService`, `NamedNodeMapService`, `DocumentService` / `DocumentFragmentService`, `PseudoNodeList`, and
|
|
19
19
|
`generateDocument` for creating a document.
|
|
20
20
|
|
|
21
|
+
`style` is a real, live `CSSStyleDeclaration`: named property access (\`el.style.backgroundColor = 'red'\`) alongside
|
|
22
|
+
\`getPropertyValue\` / \`setProperty\` / \`removeProperty\` / \`getPropertyPriority\` / \`cssText\`; an unset property
|
|
23
|
+
reads as \`''\`, like the DOM's. \`dataset\` is a live `DOMStringMap`: reading/writing/deleting a camelCase name
|
|
24
|
+
(\`el.dataset.fooBar\`) reads/writes/removes the matching \`data-foo-bar\` attribute directly, so it can never fall out
|
|
25
|
+
of sync with the attributes themselves. Both are on \`HTMLElementService\`, matching the DOM (they are not on the base
|
|
26
|
+
Element).
|
|
27
|
+
|
|
21
28
|
Standard events: `createEvent(type, init, { browser, trusted })` makes the kind of event which suits the type (a click is a
|
|
22
29
|
`MouseEvent`, a keydown a `KeyboardEvent`, ...). Like the constructor in a browser it gives nothing (no bubbling, no
|
|
23
30
|
cancelling, not trusted) unless asked, but with `browser: true` it uses `eventDefaults`, the table of how the browser
|
|
@@ -58,8 +65,28 @@ the real DOM.
|
|
|
58
65
|
\`getElementById\`, and \`textContent\` always \`null\`. \`PseudoHTMLDocument\` (what \`generateDocument\` actually
|
|
59
66
|
creates) only adds the \`html\` / \`head\` / \`body\` structure on top.
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
\`
|
|
68
|
+
Attribute helpers work like the DOM's: \`getAttributeNames\`, \`hasAttributes\`, \`toggleAttribute(name, [force])\`;
|
|
69
|
+
\`localName\` matches \`tagName\` and \`prefix\` is always null (there is no real namespace parsing);
|
|
70
|
+
\`getElementsByTagNameNS\` behaves exactly like \`getElementsByTagName\`, ignoring the namespace.
|
|
71
|
+
|
|
72
|
+
\`attachShadow({mode})\` attaches a real (\`DocumentFragmentService\`-based) \`ShadowRoot\`, with \`host\` and \`mode\`
|
|
73
|
+
set; \`element.shadowRoot\` reaches it when the mode is 'open', like the DOM's (a 'closed' one still exists, just not
|
|
74
|
+
this way); attaching a second one throws.
|
|
75
|
+
|
|
76
|
+
There is no layout engine, so anything that would need one is settable directly rather than really computed - set the
|
|
77
|
+
value a test needs and the getter/method returns it: \`clientWidth\` / \`clientHeight\` / \`clientTop\` /
|
|
78
|
+
\`clientLeft\` / \`scrollWidth\` / \`scrollHeight\` (numbers, alongside the existing \`offsetWidth\` etc.),
|
|
79
|
+
\`boundingClientRect\` (what \`getBoundingClientRect()\` returns), \`clientRects\` (\`getClientRects()\`),
|
|
80
|
+
\`animations\` (\`getAnimations()\`) and \`isVisible\` (\`checkVisibility()\`). \`scrollLeft\` / \`scrollTop\` are real,
|
|
81
|
+
plain settable numbers, and \`scroll\` / \`scrollTo\` / \`scrollBy\` (a number pair or an options object) update them
|
|
82
|
+
for real; \`scrollIntoView\` is a real callable no-op (there is no viewport to scroll within).
|
|
83
|
+
\`hasPointerCapture\` / \`setPointerCapture\` / \`releasePointerCapture\` genuinely track capture per pointer id.
|
|
84
|
+
\`requestFullscreen\` / \`requestPointerLock\` resolve, like a browser granting the request would.
|
|
85
|
+
\`computedStyleMap()\` is a thin read-only view of the element's own inline style (there is no CSS cascade).
|
|
86
|
+
|
|
87
|
+
Not implemented yet (these throw a "not implemented" error or are missing): \`innerHTML\` / \`outerHTML\` parsing, the
|
|
88
|
+
\`aria*\` reflected properties, and the \`Attr\`-node / namespaced attribute methods (\`getAttributeNode\`,
|
|
89
|
+
\`getAttributeNS\`, ...). The API will change before 1.0.
|
|
63
90
|
## Modules
|
|
64
91
|
|
|
65
92
|
<dl>
|
|
@@ -78,6 +105,10 @@ Not implemented yet (these throw a "not implemented" error or are missing): \`ge
|
|
|
78
105
|
<dd><p>Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
79
106
|
interface (the mouse, the keyboard, focus and input).</p>
|
|
80
107
|
</dd>
|
|
108
|
+
<dt><a href="#ShadowRootService">ShadowRootService</a> ⇐ <code><a href="#DocumentFragmentService">DocumentFragmentService</a></code></dt>
|
|
109
|
+
<dd><p>Simulate the behaviour of the ShadowRoot Class when there is no DOM available: a DocumentFragment attached to an
|
|
110
|
+
element via attachShadow, which sets host and mode.</p>
|
|
111
|
+
</dd>
|
|
81
112
|
<dt><a href="#PointerEventService">PointerEventService</a> ⇐ <code><a href="#MouseEventService">MouseEventService</a></code></dt>
|
|
82
113
|
<dd><p>Simulate the behaviour of the PointerEvent Class when there is no DOM available.</p>
|
|
83
114
|
</dd>
|
|
@@ -137,6 +168,13 @@ not part of a tree, when it is inserted its children are moved into the tree ins
|
|
|
137
168
|
<dt><a href="#CustomEventService">CustomEventService</a> ⇐ <code><a href="#EventService">EventService</a></code></dt>
|
|
138
169
|
<dd><p>Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.</p>
|
|
139
170
|
</dd>
|
|
171
|
+
<dt><a href="#CSSStyleDeclarationService">CSSStyleDeclarationService</a></dt>
|
|
172
|
+
<dd><p>Simulate the behaviour of the CSSStyleDeclaration Class when there is no DOM available: an ordered map of CSS
|
|
173
|
+
property/value pairs, parsed from and serialized back to a cssText string. Values are stored and returned as
|
|
174
|
+
given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS
|
|
175
|
+
engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by
|
|
176
|
+
createStyleDeclaration, which wraps an instance of this class in a Proxy.</p>
|
|
177
|
+
</dd>
|
|
140
178
|
<dt><a href="#AttrService">AttrService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
141
179
|
<dd><p>Simulate the behaviour of the Attr Class when there is no DOM available.</p>
|
|
142
180
|
</dd>
|
|
@@ -207,6 +245,12 @@ context.</p>
|
|
|
207
245
|
<dt><a href="#nearestElementSibling">nearestElementSibling(node, direction)</a> ⇒ <code>*</code> | <code>null</code></dt>
|
|
208
246
|
<dd><p>Walk up from a node (not including it) to find the nearest element, in the given direction.</p>
|
|
209
247
|
</dd>
|
|
248
|
+
<dt><a href="#kebabToCamel">kebabToCamel(name)</a> ⇒ <code>string</code></dt>
|
|
249
|
+
<dd><p>kebab-case -> camelCase ("background-color" -> "backgroundColor").</p>
|
|
250
|
+
</dd>
|
|
251
|
+
<dt><a href="#camelToKebab">camelToKebab(name)</a> ⇒ <code>string</code></dt>
|
|
252
|
+
<dd><p>camelCase -> kebab-case ("backgroundColor" -> "background-color").</p>
|
|
253
|
+
</dd>
|
|
210
254
|
<dt><a href="#createEvent">createEvent(type, [init], [options])</a> ⇒ <code><a href="#EventService">EventService</a></code></dt>
|
|
211
255
|
<dd><p>Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
|
|
212
256
|
By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
|
|
@@ -214,6 +258,9 @@ the init says so, and the event is not trusted. With browser: true the event is
|
|
|
214
258
|
it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
|
|
215
259
|
real user action (isTrusted).</p>
|
|
216
260
|
</dd>
|
|
261
|
+
<dt><a href="#dataAttributes">dataAttributes(element)</a> ⇒ <code>Array.<Array.<string>></code></dt>
|
|
262
|
+
<dd><p>Every data-* attribute name currently on the element, as [attributeName, camelCaseName] pairs.</p>
|
|
263
|
+
</dd>
|
|
217
264
|
</dl>
|
|
218
265
|
|
|
219
266
|
<a name="module_pseudoDom/simulate"></a>
|
|
@@ -346,6 +393,410 @@ Stops the propagation of events further along in the Dom.
|
|
|
346
393
|
|
|
347
394
|
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
348
395
|
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
396
|
+
<a name="ShadowRootService"></a>
|
|
397
|
+
|
|
398
|
+
## ShadowRootService ⇐ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
399
|
+
Simulate the behaviour of the ShadowRoot Class when there is no DOM available: a DocumentFragment attached to an
|
|
400
|
+
element via attachShadow, which sets host and mode.
|
|
401
|
+
|
|
402
|
+
**Kind**: global class
|
|
403
|
+
**Extends**: [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
404
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
405
|
+
|
|
406
|
+
* [ShadowRootService](#ShadowRootService) ⇐ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
407
|
+
* [.host](#ShadowRootService+host)
|
|
408
|
+
* [.mode](#ShadowRootService+mode)
|
|
409
|
+
* [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
|
|
410
|
+
* [.getElementById(id)](#DocumentFragmentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
411
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
412
|
+
* [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
|
|
413
|
+
* [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
|
|
414
|
+
* [.append(...nodes)](#NodeService+append)
|
|
415
|
+
* [.prepend(...nodes)](#NodeService+prepend)
|
|
416
|
+
* [.replaceChildren(...nodes)](#NodeService+replaceChildren)
|
|
417
|
+
* [.before(...nodes)](#NodeService+before)
|
|
418
|
+
* [.after(...nodes)](#NodeService+after)
|
|
419
|
+
* [.replaceWith(...nodes)](#NodeService+replaceWith)
|
|
420
|
+
* [.remove()](#NodeService+remove)
|
|
421
|
+
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
422
|
+
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
423
|
+
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
424
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
425
|
+
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
426
|
+
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
427
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
428
|
+
* [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
|
|
429
|
+
* [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
|
|
430
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
431
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
432
|
+
* [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
|
|
433
|
+
* [.normalize()](#NodeService+normalize)
|
|
434
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
435
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
436
|
+
|
|
437
|
+
<a name="ShadowRootService+host"></a>
|
|
438
|
+
|
|
439
|
+
### shadowRootService.host
|
|
440
|
+
The element this shadow root is attached to. Set by attachShadow.
|
|
441
|
+
|
|
442
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
443
|
+
<a name="ShadowRootService+mode"></a>
|
|
444
|
+
|
|
445
|
+
### shadowRootService.mode
|
|
446
|
+
'open' (reachable via element.shadowRoot) or 'closed' (not). Set by attachShadow.
|
|
447
|
+
|
|
448
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
449
|
+
<a name="NodeService+acceptsChildren"></a>
|
|
450
|
+
|
|
451
|
+
### shadowRootService.acceptsChildren ⇒ <code>boolean</code>
|
|
452
|
+
Whether this kind of node can have children (text, comments and attributes cannot).
|
|
453
|
+
|
|
454
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
455
|
+
**Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
|
|
456
|
+
<a name="DocumentFragmentService+getElementById"></a>
|
|
457
|
+
|
|
458
|
+
### shadowRootService.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
459
|
+
The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
|
|
460
|
+
NonElementParentNode mixin, which Document and DocumentFragment both implement).
|
|
461
|
+
|
|
462
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
463
|
+
**Overrides**: [<code>getElementById</code>](#DocumentFragmentService+getElementById)
|
|
464
|
+
|
|
465
|
+
| Param | Type |
|
|
466
|
+
| --- | --- |
|
|
467
|
+
| id | <code>string</code> |
|
|
468
|
+
|
|
469
|
+
<a name="NodeService+appendChild"></a>
|
|
470
|
+
|
|
471
|
+
### shadowRootService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
472
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
473
|
+
|
|
474
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
475
|
+
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
476
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
477
|
+
|
|
478
|
+
| Param | Type | Description |
|
|
479
|
+
| --- | --- | --- |
|
|
480
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
481
|
+
|
|
482
|
+
<a name="NodeService+cloneShallow"></a>
|
|
483
|
+
|
|
484
|
+
### shadowRootService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
|
|
485
|
+
Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
|
|
486
|
+
Kinds of node which are made with arguments override this to give them.
|
|
487
|
+
|
|
488
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
489
|
+
**Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
|
|
490
|
+
<a name="NodeService+equalsShallow"></a>
|
|
491
|
+
|
|
492
|
+
### shadowRootService.equalsShallow(other) ⇒ <code>boolean</code>
|
|
493
|
+
Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
|
|
494
|
+
afterwards. Kinds of node with more to compare (an element has attributes) override this.
|
|
495
|
+
|
|
496
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
497
|
+
**Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
|
|
498
|
+
|
|
499
|
+
| Param | Type | Description |
|
|
500
|
+
| --- | --- | --- |
|
|
501
|
+
| other | [<code>NodeService</code>](#NodeService) | The node to compare with |
|
|
502
|
+
|
|
503
|
+
<a name="NodeService+append"></a>
|
|
504
|
+
|
|
505
|
+
### shadowRootService.append(...nodes)
|
|
506
|
+
Add nodes (strings become text nodes) as the last children of this node, in the order given.
|
|
507
|
+
|
|
508
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
509
|
+
**Overrides**: [<code>append</code>](#NodeService+append)
|
|
510
|
+
**Throws**:
|
|
511
|
+
|
|
512
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
| Param | Type | Description |
|
|
516
|
+
| --- | --- | --- |
|
|
517
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
518
|
+
|
|
519
|
+
<a name="NodeService+prepend"></a>
|
|
520
|
+
|
|
521
|
+
### shadowRootService.prepend(...nodes)
|
|
522
|
+
Add nodes (strings become text nodes) as the first children of this node, in the order given.
|
|
523
|
+
|
|
524
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
525
|
+
**Overrides**: [<code>prepend</code>](#NodeService+prepend)
|
|
526
|
+
**Throws**:
|
|
527
|
+
|
|
528
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
| Param | Type | Description |
|
|
532
|
+
| --- | --- | --- |
|
|
533
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
534
|
+
|
|
535
|
+
<a name="NodeService+replaceChildren"></a>
|
|
536
|
+
|
|
537
|
+
### shadowRootService.replaceChildren(...nodes)
|
|
538
|
+
Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
|
|
539
|
+
|
|
540
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
541
|
+
**Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
|
|
542
|
+
**Throws**:
|
|
543
|
+
|
|
544
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
| Param | Type | Description |
|
|
548
|
+
| --- | --- | --- |
|
|
549
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
550
|
+
|
|
551
|
+
<a name="NodeService+before"></a>
|
|
552
|
+
|
|
553
|
+
### shadowRootService.before(...nodes)
|
|
554
|
+
Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
|
|
555
|
+
no parent.
|
|
556
|
+
|
|
557
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
558
|
+
**Overrides**: [<code>before</code>](#NodeService+before)
|
|
559
|
+
|
|
560
|
+
| Param | Type | Description |
|
|
561
|
+
| --- | --- | --- |
|
|
562
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
563
|
+
|
|
564
|
+
<a name="NodeService+after"></a>
|
|
565
|
+
|
|
566
|
+
### shadowRootService.after(...nodes)
|
|
567
|
+
Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
|
|
568
|
+
parent.
|
|
569
|
+
|
|
570
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
571
|
+
**Overrides**: [<code>after</code>](#NodeService+after)
|
|
572
|
+
|
|
573
|
+
| Param | Type | Description |
|
|
574
|
+
| --- | --- | --- |
|
|
575
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
576
|
+
|
|
577
|
+
<a name="NodeService+replaceWith"></a>
|
|
578
|
+
|
|
579
|
+
### shadowRootService.replaceWith(...nodes)
|
|
580
|
+
Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
|
|
581
|
+
when this node has no parent.
|
|
582
|
+
|
|
583
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
584
|
+
**Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
|
|
585
|
+
|
|
586
|
+
| Param | Type | Description |
|
|
587
|
+
| --- | --- | --- |
|
|
588
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
|
|
589
|
+
|
|
590
|
+
<a name="NodeService+remove"></a>
|
|
591
|
+
|
|
592
|
+
### shadowRootService.remove()
|
|
593
|
+
Remove this node from its parent. Does nothing when it has no parent.
|
|
594
|
+
|
|
595
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
596
|
+
**Overrides**: [<code>remove</code>](#NodeService+remove)
|
|
597
|
+
<a name="NodeService+toChildNode"></a>
|
|
598
|
+
|
|
599
|
+
### shadowRootService.toChildNode(value) ⇒ <code>PseudoNode</code>
|
|
600
|
+
Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
|
|
601
|
+
becomes a text node belonging to this node's document, anything else is returned as it is.
|
|
602
|
+
|
|
603
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
604
|
+
**Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
|
|
605
|
+
|
|
606
|
+
| Param | Type | Description |
|
|
607
|
+
| --- | --- | --- |
|
|
608
|
+
| value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
|
|
609
|
+
|
|
610
|
+
<a name="NodeService+getElementsByTagName"></a>
|
|
611
|
+
|
|
612
|
+
### shadowRootService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
613
|
+
Every element below this node with the given tag name (or every element when tagName is *), live.
|
|
614
|
+
|
|
615
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
616
|
+
**Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
|
|
617
|
+
|
|
618
|
+
| Param | Type |
|
|
619
|
+
| --- | --- |
|
|
620
|
+
| tagName | <code>string</code> |
|
|
621
|
+
|
|
622
|
+
<a name="NodeService+getElementsByClassName"></a>
|
|
623
|
+
|
|
624
|
+
### shadowRootService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
|
|
625
|
+
Every element below this node which has all of the given (space separated) classes, live.
|
|
626
|
+
|
|
627
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
628
|
+
**Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
|
|
629
|
+
|
|
630
|
+
| Param | Type |
|
|
631
|
+
| --- | --- |
|
|
632
|
+
| className | <code>string</code> |
|
|
633
|
+
|
|
634
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
635
|
+
|
|
636
|
+
### shadowRootService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
637
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
638
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
639
|
+
|
|
640
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
641
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
642
|
+
|
|
643
|
+
| Param | Type | Description |
|
|
644
|
+
| --- | --- | --- |
|
|
645
|
+
| namespace | <code>string</code> | Ignored |
|
|
646
|
+
| tagName | <code>string</code> | |
|
|
647
|
+
|
|
648
|
+
<a name="NodeService+querySelector"></a>
|
|
649
|
+
|
|
650
|
+
### shadowRootService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
651
|
+
The first element below this node which matches the CSS selector, in tree order, or null when there is none.
|
|
652
|
+
|
|
653
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
654
|
+
**Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
|
|
655
|
+
|
|
656
|
+
| Param | Type | Description |
|
|
657
|
+
| --- | --- | --- |
|
|
658
|
+
| selectors | <code>string</code> | A CSS selector |
|
|
659
|
+
|
|
660
|
+
<a name="NodeService+querySelectorAll"></a>
|
|
661
|
+
|
|
662
|
+
### shadowRootService.querySelectorAll(selectors) ⇒ <code>Array.<PseudoElement></code>
|
|
663
|
+
Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
|
|
664
|
+
collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
|
|
665
|
+
|
|
666
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
667
|
+
**Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
|
|
668
|
+
|
|
669
|
+
| Param | Type | Description |
|
|
670
|
+
| --- | --- | --- |
|
|
671
|
+
| selectors | <code>string</code> | A CSS selector |
|
|
672
|
+
|
|
673
|
+
<a name="NodeService+childInserted"></a>
|
|
674
|
+
|
|
675
|
+
### shadowRootService.childInserted(child)
|
|
676
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
677
|
+
(for example elements applying default events) can do so.
|
|
678
|
+
|
|
679
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
680
|
+
**Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
|
|
681
|
+
|
|
682
|
+
| Param | Type | Description |
|
|
683
|
+
| --- | --- | --- |
|
|
684
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
685
|
+
|
|
686
|
+
<a name="NodeService+cloneNode"></a>
|
|
687
|
+
|
|
688
|
+
### shadowRootService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
|
|
689
|
+
Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
|
|
690
|
+
too, all the way down.
|
|
691
|
+
|
|
692
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
693
|
+
**Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
|
|
694
|
+
|
|
695
|
+
| Param | Type | Default | Description |
|
|
696
|
+
| --- | --- | --- | --- |
|
|
697
|
+
| [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
|
|
698
|
+
|
|
699
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
700
|
+
|
|
701
|
+
### shadowRootService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
|
|
702
|
+
Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
|
|
703
|
+
itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
|
|
704
|
+
CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
|
|
705
|
+
otherwise PRECEDING or FOLLOWING by their order in the tree.
|
|
706
|
+
|
|
707
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
708
|
+
**Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
|
|
709
|
+
|
|
710
|
+
| Param | Type | Description |
|
|
711
|
+
| --- | --- | --- |
|
|
712
|
+
| otherNode | <code>PseudoNode</code> | The node to locate |
|
|
713
|
+
|
|
714
|
+
<a name="NodeService+contains"></a>
|
|
715
|
+
|
|
716
|
+
### shadowRootService.contains(otherNode) ⇒ <code>boolean</code>
|
|
717
|
+
Check whether a node is this node or one of its descendants.
|
|
718
|
+
|
|
719
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
720
|
+
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
721
|
+
|
|
722
|
+
| Param | Type | Description |
|
|
723
|
+
| --- | --- | --- |
|
|
724
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
725
|
+
|
|
726
|
+
<a name="NodeService+insertBefore"></a>
|
|
727
|
+
|
|
728
|
+
### shadowRootService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
729
|
+
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
|
|
730
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
731
|
+
|
|
732
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
733
|
+
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
734
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
735
|
+
**Throws**:
|
|
736
|
+
|
|
737
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
| Param | Type | Default | Description |
|
|
741
|
+
| --- | --- | --- | --- |
|
|
742
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
743
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
744
|
+
|
|
745
|
+
<a name="NodeService+isEqualNode"></a>
|
|
746
|
+
|
|
747
|
+
### shadowRootService.isEqualNode(otherNode) ⇒ <code>boolean</code>
|
|
748
|
+
Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
|
|
749
|
+
needs the same attributes), and children which are equal in the same order.
|
|
750
|
+
|
|
751
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
752
|
+
**Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
|
|
753
|
+
|
|
754
|
+
| Param | Type | Description |
|
|
755
|
+
| --- | --- | --- |
|
|
756
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
|
|
757
|
+
|
|
758
|
+
<a name="NodeService+normalize"></a>
|
|
759
|
+
|
|
760
|
+
### shadowRootService.normalize()
|
|
761
|
+
Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
|
|
762
|
+
|
|
763
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
764
|
+
**Overrides**: [<code>normalize</code>](#NodeService+normalize)
|
|
765
|
+
<a name="NodeService+removeChild"></a>
|
|
766
|
+
|
|
767
|
+
### shadowRootService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
768
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
769
|
+
|
|
770
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
771
|
+
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
772
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
773
|
+
**Throws**:
|
|
774
|
+
|
|
775
|
+
- <code>Error</code> When the node is not a child of this node
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
| Param | Type | Description |
|
|
779
|
+
| --- | --- | --- |
|
|
780
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
781
|
+
|
|
782
|
+
<a name="NodeService+replaceChild"></a>
|
|
783
|
+
|
|
784
|
+
### shadowRootService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
785
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
786
|
+
|
|
787
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
788
|
+
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
789
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
790
|
+
**Throws**:
|
|
791
|
+
|
|
792
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
| Param | Type | Description |
|
|
796
|
+
| --- | --- | --- |
|
|
797
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
798
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
799
|
+
|
|
349
800
|
<a name="PointerEventService"></a>
|
|
350
801
|
|
|
351
802
|
## PointerEventService ⇐ [<code>MouseEventService</code>](#MouseEventService)
|
|
@@ -465,6 +916,7 @@ Simulate the behaviour of the Node Class when there is no DOM available.
|
|
|
465
916
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
466
917
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
467
918
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
919
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
468
920
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
469
921
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
470
922
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -635,6 +1087,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
635
1087
|
| --- | --- |
|
|
636
1088
|
| className | <code>string</code> |
|
|
637
1089
|
|
|
1090
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1091
|
+
|
|
1092
|
+
### nodeService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1093
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1094
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1095
|
+
|
|
1096
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
1097
|
+
|
|
1098
|
+
| Param | Type | Description |
|
|
1099
|
+
| --- | --- | --- |
|
|
1100
|
+
| namespace | <code>string</code> | Ignored |
|
|
1101
|
+
| tagName | <code>string</code> | |
|
|
1102
|
+
|
|
638
1103
|
<a name="NodeService+querySelector"></a>
|
|
639
1104
|
|
|
640
1105
|
### nodeService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -810,6 +1275,7 @@ Simulate the behaviour of the Text Class when there is no DOM available: the tex
|
|
|
810
1275
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
811
1276
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
812
1277
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1278
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
813
1279
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
814
1280
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
815
1281
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -1019,6 +1485,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
1019
1485
|
| --- | --- |
|
|
1020
1486
|
| className | <code>string</code> |
|
|
1021
1487
|
|
|
1488
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1489
|
+
|
|
1490
|
+
### textService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1491
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1492
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1493
|
+
|
|
1494
|
+
**Kind**: instance method of [<code>TextService</code>](#TextService)
|
|
1495
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
1496
|
+
|
|
1497
|
+
| Param | Type | Description |
|
|
1498
|
+
| --- | --- | --- |
|
|
1499
|
+
| namespace | <code>string</code> | Ignored |
|
|
1500
|
+
| tagName | <code>string</code> | |
|
|
1501
|
+
|
|
1022
1502
|
<a name="NodeService+querySelector"></a>
|
|
1023
1503
|
|
|
1024
1504
|
### textService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -1203,6 +1683,7 @@ Simulate the behaviour of the Comment Class when there is no DOM available: a no
|
|
|
1203
1683
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
1204
1684
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1205
1685
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1686
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
1206
1687
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
1207
1688
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
1208
1689
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -1395,6 +1876,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
1395
1876
|
| --- | --- |
|
|
1396
1877
|
| className | <code>string</code> |
|
|
1397
1878
|
|
|
1879
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1880
|
+
|
|
1881
|
+
### commentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1882
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1883
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1884
|
+
|
|
1885
|
+
**Kind**: instance method of [<code>CommentService</code>](#CommentService)
|
|
1886
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
1887
|
+
|
|
1888
|
+
| Param | Type | Description |
|
|
1889
|
+
| --- | --- | --- |
|
|
1890
|
+
| namespace | <code>string</code> | Ignored |
|
|
1891
|
+
| tagName | <code>string</code> | |
|
|
1892
|
+
|
|
1398
1893
|
<a name="NodeService+querySelector"></a>
|
|
1399
1894
|
|
|
1400
1895
|
### commentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -1823,13 +2318,18 @@ Simulate the behaviour of the HTMLElement Class when there is no DOM available.
|
|
|
1823
2318
|
| offsetParent | <code>PseudoHTMLElement</code> | A reference to the closest positioned parent element |
|
|
1824
2319
|
| offsetTop | <code>number</code> | The position of the top side of the element based on the parent element |
|
|
1825
2320
|
| offsetWidth | <code>number</code> | The width of the element as offset by the parent element |
|
|
1826
|
-
| style | <code>
|
|
2321
|
+
| style | [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService) | The element's inline styles, live and settable per property |
|
|
2322
|
+
| dataset | <code>Object.<string, string></code> | The element's data-* attributes, live, under their camelCase names |
|
|
1827
2323
|
| title | <code>string</code> | The title attribute which affects the text visible on hover |
|
|
1828
2324
|
|
|
1829
2325
|
|
|
1830
2326
|
* [HTMLElementService](#HTMLElementService) ⇐ <code>PseudoElement</code>
|
|
1831
2327
|
* [new HTMLElementService([elementOptions])](#new_HTMLElementService_new)
|
|
2328
|
+
* [.style](#HTMLElementService+style) ⇒ [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
2329
|
+
* [.dataset](#HTMLElementService+dataset) ⇒ <code>Object.<string, string></code>
|
|
1832
2330
|
* [.canFocus](#HTMLElementService+canFocus) ⇒ <code>boolean</code>
|
|
2331
|
+
* [.cloneShallow()](#HTMLElementService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
|
|
2332
|
+
* [.equalsShallow(other)](#HTMLElementService+equalsShallow) ⇒ <code>boolean</code>
|
|
1833
2333
|
* [.click()](#HTMLElementService+click)
|
|
1834
2334
|
* [.focus()](#HTMLElementService+focus)
|
|
1835
2335
|
* [.blur()](#HTMLElementService+blur)
|
|
@@ -1847,12 +2347,43 @@ Simulate the HTMLElement object when the Dom is not available
|
|
|
1847
2347
|
| [elementOptions.parent] | <code>PseudoNode</code> \| <code>Object</code> | <code>{}</code> |
|
|
1848
2348
|
| [elementOptions.children] | <code>Array</code> | <code>[]</code> |
|
|
1849
2349
|
|
|
2350
|
+
<a name="HTMLElementService+style"></a>
|
|
2351
|
+
|
|
2352
|
+
### htmlElementService.style ⇒ [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
2353
|
+
The element's inline styles: a live CSSStyleDeclaration-like object, so both style.setProperty('color', 'red')
|
|
2354
|
+
and style.color = 'red' work.
|
|
2355
|
+
|
|
2356
|
+
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2357
|
+
<a name="HTMLElementService+dataset"></a>
|
|
2358
|
+
|
|
2359
|
+
### htmlElementService.dataset ⇒ <code>Object.<string, string></code>
|
|
2360
|
+
The element's data-* attributes, live, under their camelCase names (data-foo-bar <-> dataset.fooBar). Backed
|
|
2361
|
+
directly by getAttribute / setAttribute, so it is never out of sync with the attributes themselves.
|
|
2362
|
+
|
|
2363
|
+
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
1850
2364
|
<a name="HTMLElementService+canFocus"></a>
|
|
1851
2365
|
|
|
1852
2366
|
### htmlElementService.canFocus ⇒ <code>boolean</code>
|
|
1853
2367
|
Whether this element can have the focus: form controls and links which are not disabled, and anything with a tabindex.
|
|
1854
2368
|
|
|
1855
2369
|
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2370
|
+
<a name="HTMLElementService+cloneShallow"></a>
|
|
2371
|
+
|
|
2372
|
+
### htmlElementService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
|
|
2373
|
+
Style is not attribute-backed like most properties (see the constructor), so cloneNode needs its own copy of it.
|
|
2374
|
+
|
|
2375
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2376
|
+
<a name="HTMLElementService+equalsShallow"></a>
|
|
2377
|
+
|
|
2378
|
+
### htmlElementService.equalsShallow(other) ⇒ <code>boolean</code>
|
|
2379
|
+
Style is not attribute-backed like most properties, so isEqualNode needs to compare it separately too.
|
|
2380
|
+
|
|
2381
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2382
|
+
|
|
2383
|
+
| Param | Type | Description |
|
|
2384
|
+
| --- | --- | --- |
|
|
2385
|
+
| other | [<code>NodeService</code>](#NodeService) | The node to compare with |
|
|
2386
|
+
|
|
1856
2387
|
<a name="HTMLElementService+click"></a>
|
|
1857
2388
|
|
|
1858
2389
|
### htmlElementService.click()
|
|
@@ -2236,12 +2767,19 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2236
2767
|
|
|
2237
2768
|
* [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
|
|
2238
2769
|
* [new ElementService([settings])](#new_ElementService_new)
|
|
2770
|
+
* [.boundingClientRect](#ElementService+boundingClientRect)
|
|
2771
|
+
* [.clientRects](#ElementService+clientRects)
|
|
2772
|
+
* [.animations](#ElementService+animations)
|
|
2773
|
+
* [.isVisible](#ElementService+isVisible)
|
|
2774
|
+
* [.localName](#ElementService+localName) ⇒ <code>string</code>
|
|
2775
|
+
* [.prefix](#ElementService+prefix) ⇒ <code>string</code> \| <code>null</code>
|
|
2239
2776
|
* [.children](#ElementService+children) ⇒ <code>PseudoHTMLCollection</code>
|
|
2240
2777
|
* [.childElementCount](#ElementService+childElementCount) ⇒ <code>number</code>
|
|
2241
2778
|
* [.firstElementChild](#ElementService+firstElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2242
2779
|
* [.lastElementChild](#ElementService+lastElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2243
2780
|
* [.nextElementSibling](#ElementService+nextElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2244
2781
|
* [.previousElementSibling](#ElementService+previousElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2782
|
+
* [.shadowRoot](#ElementService+shadowRoot) ⇒ <code>PseudoShadowRoot</code> \| <code>null</code>
|
|
2245
2783
|
* [.currentAttributes()](#ElementService+currentAttributes) ⇒ <code>Array.<{name: string, value: \*}></code>
|
|
2246
2784
|
* [.cloneShallow()](#ElementService+cloneShallow) ⇒ [<code>ElementService</code>](#ElementService)
|
|
2247
2785
|
* [.equalsShallow(other)](#ElementService+equalsShallow) ⇒ <code>boolean</code>
|
|
@@ -2256,6 +2794,24 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2256
2794
|
* [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
|
|
2257
2795
|
* [.getAttribute(attributeName)](#ElementService+getAttribute) ⇒ <code>string</code> \| <code>null</code>
|
|
2258
2796
|
* [.removeAttribute(attributeName)](#ElementService+removeAttribute) ⇒ <code>undefined</code>
|
|
2797
|
+
* [.getAttributeNames()](#ElementService+getAttributeNames) ⇒ <code>Array.<string></code>
|
|
2798
|
+
* [.hasAttributes()](#ElementService+hasAttributes) ⇒ <code>boolean</code>
|
|
2799
|
+
* [.toggleAttribute(attributeName, [force])](#ElementService+toggleAttribute) ⇒ <code>boolean</code>
|
|
2800
|
+
* [.getBoundingClientRect()](#ElementService+getBoundingClientRect) ⇒ <code>DOMRect</code>
|
|
2801
|
+
* [.getClientRects()](#ElementService+getClientRects) ⇒ <code>Array.<DOMRect></code>
|
|
2802
|
+
* [.getAnimations()](#ElementService+getAnimations) ⇒ <code>Array.<\*></code>
|
|
2803
|
+
* [.checkVisibility()](#ElementService+checkVisibility) ⇒ <code>boolean</code>
|
|
2804
|
+
* [.computedStyleMap()](#ElementService+computedStyleMap) ⇒ <code>Object</code>
|
|
2805
|
+
* [.hasPointerCapture(pointerId)](#ElementService+hasPointerCapture) ⇒ <code>boolean</code>
|
|
2806
|
+
* [.setPointerCapture(pointerId)](#ElementService+setPointerCapture) ⇒ <code>undefined</code>
|
|
2807
|
+
* [.releasePointerCapture(pointerId)](#ElementService+releasePointerCapture) ⇒ <code>undefined</code>
|
|
2808
|
+
* [.scroll([x], [y])](#ElementService+scroll) ⇒ <code>undefined</code>
|
|
2809
|
+
* [.scrollTo([x], [y])](#ElementService+scrollTo) ⇒ <code>undefined</code>
|
|
2810
|
+
* [.scrollBy([x], [y])](#ElementService+scrollBy) ⇒ <code>undefined</code>
|
|
2811
|
+
* [.scrollIntoView()](#ElementService+scrollIntoView) ⇒ <code>undefined</code>
|
|
2812
|
+
* [.requestFullscreen()](#ElementService+requestFullscreen) ⇒ <code>Promise.<void></code>
|
|
2813
|
+
* [.requestPointerLock()](#ElementService+requestPointerLock) ⇒ <code>Promise.<void></code>
|
|
2814
|
+
* [.attachShadow(options)](#ElementService+attachShadow) ⇒ <code>PseudoShadowRoot</code>
|
|
2259
2815
|
|
|
2260
2816
|
<a name="new_ElementService_new"></a>
|
|
2261
2817
|
|
|
@@ -2269,6 +2825,44 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2269
2825
|
| [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The node to add this element to as its last child |
|
|
2270
2826
|
| [settings.children] | <code>Array.<PseudoNode></code> | <code>[]</code> | The nodes to start as children |
|
|
2271
2827
|
|
|
2828
|
+
<a name="ElementService+boundingClientRect"></a>
|
|
2829
|
+
|
|
2830
|
+
### elementService.boundingClientRect
|
|
2831
|
+
What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly.
|
|
2832
|
+
|
|
2833
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2834
|
+
<a name="ElementService+clientRects"></a>
|
|
2835
|
+
|
|
2836
|
+
### elementService.clientRects
|
|
2837
|
+
What getClientRects() returns - set this directly.
|
|
2838
|
+
|
|
2839
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2840
|
+
<a name="ElementService+animations"></a>
|
|
2841
|
+
|
|
2842
|
+
### elementService.animations
|
|
2843
|
+
What getAnimations() returns - set this directly.
|
|
2844
|
+
|
|
2845
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2846
|
+
<a name="ElementService+isVisible"></a>
|
|
2847
|
+
|
|
2848
|
+
### elementService.isVisible
|
|
2849
|
+
What checkVisibility() returns - set this directly.
|
|
2850
|
+
|
|
2851
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2852
|
+
<a name="ElementService+localName"></a>
|
|
2853
|
+
|
|
2854
|
+
### elementService.localName ⇒ <code>string</code>
|
|
2855
|
+
The local part of the element's qualified name. There is no real namespace parsing here, so this is always the
|
|
2856
|
+
same as tagName.
|
|
2857
|
+
|
|
2858
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2859
|
+
<a name="ElementService+prefix"></a>
|
|
2860
|
+
|
|
2861
|
+
### elementService.prefix ⇒ <code>string</code> \| <code>null</code>
|
|
2862
|
+
The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is
|
|
2863
|
+
always null.
|
|
2864
|
+
|
|
2865
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2272
2866
|
<a name="ElementService+children"></a>
|
|
2273
2867
|
|
|
2274
2868
|
### elementService.children ⇒ <code>PseudoHTMLCollection</code>
|
|
@@ -2304,6 +2898,13 @@ The sibling after this one which is an element, or null when there is none.
|
|
|
2304
2898
|
### elementService.previousElementSibling ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2305
2899
|
The sibling before this one which is an element, or null when there is none.
|
|
2306
2900
|
|
|
2901
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2902
|
+
<a name="ElementService+shadowRoot"></a>
|
|
2903
|
+
|
|
2904
|
+
### elementService.shadowRoot ⇒ <code>PseudoShadowRoot</code> \| <code>null</code>
|
|
2905
|
+
This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is
|
|
2906
|
+
'closed' - it still exists, but is not reachable this way, like the DOM's).
|
|
2907
|
+
|
|
2307
2908
|
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2308
2909
|
<a name="ElementService+currentAttributes"></a>
|
|
2309
2910
|
|
|
@@ -2479,6 +3080,169 @@ Remove an attribute from the element.
|
|
|
2479
3080
|
| --- | --- |
|
|
2480
3081
|
| attributeName | <code>string</code> |
|
|
2481
3082
|
|
|
3083
|
+
<a name="ElementService+getAttributeNames"></a>
|
|
3084
|
+
|
|
3085
|
+
### elementService.getAttributeNames() ⇒ <code>Array.<string></code>
|
|
3086
|
+
The name of every attribute on the element, in the order they were set.
|
|
3087
|
+
|
|
3088
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3089
|
+
<a name="ElementService+hasAttributes"></a>
|
|
3090
|
+
|
|
3091
|
+
### elementService.hasAttributes() ⇒ <code>boolean</code>
|
|
3092
|
+
Whether the element has any attributes at all.
|
|
3093
|
+
|
|
3094
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3095
|
+
<a name="ElementService+toggleAttribute"></a>
|
|
3096
|
+
|
|
3097
|
+
### elementService.toggleAttribute(attributeName, [force]) ⇒ <code>boolean</code>
|
|
3098
|
+
Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says
|
|
3099
|
+
which of those to do instead. Returns whether the attribute is present after the call.
|
|
3100
|
+
|
|
3101
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3102
|
+
|
|
3103
|
+
| Param | Type |
|
|
3104
|
+
| --- | --- |
|
|
3105
|
+
| attributeName | <code>string</code> |
|
|
3106
|
+
| [force] | <code>boolean</code> |
|
|
3107
|
+
|
|
3108
|
+
<a name="ElementService+getBoundingClientRect"></a>
|
|
3109
|
+
|
|
3110
|
+
### elementService.getBoundingClientRect() ⇒ <code>DOMRect</code>
|
|
3111
|
+
The size of the element and its position, settable directly - there is no layout engine here to compute it.
|
|
3112
|
+
|
|
3113
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3114
|
+
<a name="ElementService+getClientRects"></a>
|
|
3115
|
+
|
|
3116
|
+
### elementService.getClientRects() ⇒ <code>Array.<DOMRect></code>
|
|
3117
|
+
The bounding rectangles for each line of text in the element, settable directly - there is no layout engine
|
|
3118
|
+
here to compute it.
|
|
3119
|
+
|
|
3120
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3121
|
+
<a name="ElementService+getAnimations"></a>
|
|
3122
|
+
|
|
3123
|
+
### elementService.getAnimations() ⇒ <code>Array.<\*></code>
|
|
3124
|
+
The Animation objects currently active on the element, settable directly - there is no animation engine here.
|
|
3125
|
+
|
|
3126
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3127
|
+
<a name="ElementService+checkVisibility"></a>
|
|
3128
|
+
|
|
3129
|
+
### elementService.checkVisibility() ⇒ <code>boolean</code>
|
|
3130
|
+
Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
|
|
3131
|
+
|
|
3132
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3133
|
+
<a name="ElementService+computedStyleMap"></a>
|
|
3134
|
+
|
|
3135
|
+
### elementService.computedStyleMap() ⇒ <code>Object</code>
|
|
3136
|
+
A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a
|
|
3137
|
+
real computed style - just what the element's own style object holds).
|
|
3138
|
+
|
|
3139
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3140
|
+
<a name="ElementService+hasPointerCapture"></a>
|
|
3141
|
+
|
|
3142
|
+
### elementService.hasPointerCapture(pointerId) ⇒ <code>boolean</code>
|
|
3143
|
+
Whether this element currently has capture of the given pointer.
|
|
3144
|
+
|
|
3145
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3146
|
+
|
|
3147
|
+
| Param | Type |
|
|
3148
|
+
| --- | --- |
|
|
3149
|
+
| pointerId | <code>number</code> |
|
|
3150
|
+
|
|
3151
|
+
<a name="ElementService+setPointerCapture"></a>
|
|
3152
|
+
|
|
3153
|
+
### elementService.setPointerCapture(pointerId) ⇒ <code>undefined</code>
|
|
3154
|
+
Give this element capture of the given pointer.
|
|
3155
|
+
|
|
3156
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3157
|
+
|
|
3158
|
+
| Param | Type |
|
|
3159
|
+
| --- | --- |
|
|
3160
|
+
| pointerId | <code>number</code> |
|
|
3161
|
+
|
|
3162
|
+
<a name="ElementService+releasePointerCapture"></a>
|
|
3163
|
+
|
|
3164
|
+
### elementService.releasePointerCapture(pointerId) ⇒ <code>undefined</code>
|
|
3165
|
+
Release this element's capture of the given pointer, if it had it.
|
|
3166
|
+
|
|
3167
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3168
|
+
|
|
3169
|
+
| Param | Type |
|
|
3170
|
+
| --- | --- |
|
|
3171
|
+
| pointerId | <code>number</code> |
|
|
3172
|
+
|
|
3173
|
+
<a name="ElementService+scroll"></a>
|
|
3174
|
+
|
|
3175
|
+
### elementService.scroll([x], [y]) ⇒ <code>undefined</code>
|
|
3176
|
+
Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable
|
|
3177
|
+
viewport here: this just sets scrollLeft / scrollTop.
|
|
3178
|
+
|
|
3179
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3180
|
+
|
|
3181
|
+
| Param | Type | Default |
|
|
3182
|
+
| --- | --- | --- |
|
|
3183
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3184
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3185
|
+
|
|
3186
|
+
<a name="ElementService+scrollTo"></a>
|
|
3187
|
+
|
|
3188
|
+
### elementService.scrollTo([x], [y]) ⇒ <code>undefined</code>
|
|
3189
|
+
Scroll to the given position. An alias for scroll.
|
|
3190
|
+
|
|
3191
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3192
|
+
|
|
3193
|
+
| Param | Type | Default |
|
|
3194
|
+
| --- | --- | --- |
|
|
3195
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3196
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3197
|
+
|
|
3198
|
+
<a name="ElementService+scrollBy"></a>
|
|
3199
|
+
|
|
3200
|
+
### elementService.scrollBy([x], [y]) ⇒ <code>undefined</code>
|
|
3201
|
+
Scroll by the given amount, relative to the current position.
|
|
3202
|
+
|
|
3203
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3204
|
+
|
|
3205
|
+
| Param | Type | Default |
|
|
3206
|
+
| --- | --- | --- |
|
|
3207
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3208
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3209
|
+
|
|
3210
|
+
<a name="ElementService+scrollIntoView"></a>
|
|
3211
|
+
|
|
3212
|
+
### elementService.scrollIntoView() ⇒ <code>undefined</code>
|
|
3213
|
+
Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so
|
|
3214
|
+
this does nothing (override it on an instance in a test which needs to observe the call).
|
|
3215
|
+
|
|
3216
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3217
|
+
<a name="ElementService+requestFullscreen"></a>
|
|
3218
|
+
|
|
3219
|
+
### elementService.requestFullscreen() ⇒ <code>Promise.<void></code>
|
|
3220
|
+
Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just
|
|
3221
|
+
resolves, like a browser granting the request would.
|
|
3222
|
+
|
|
3223
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3224
|
+
<a name="ElementService+requestPointerLock"></a>
|
|
3225
|
+
|
|
3226
|
+
### elementService.requestPointerLock() ⇒ <code>Promise.<void></code>
|
|
3227
|
+
Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this
|
|
3228
|
+
just resolves, like a browser granting the request would.
|
|
3229
|
+
|
|
3230
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3231
|
+
<a name="ElementService+attachShadow"></a>
|
|
3232
|
+
|
|
3233
|
+
### elementService.attachShadow(options) ⇒ <code>PseudoShadowRoot</code>
|
|
3234
|
+
Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
|
|
3235
|
+
|
|
3236
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3237
|
+
**Throws**:
|
|
3238
|
+
|
|
3239
|
+
- <code>Error</code>
|
|
3240
|
+
|
|
3241
|
+
|
|
3242
|
+
| Param | Type |
|
|
3243
|
+
| --- | --- |
|
|
3244
|
+
| options | <code>Object</code> |
|
|
3245
|
+
|
|
2482
3246
|
<a name="DocumentService"></a>
|
|
2483
3247
|
|
|
2484
3248
|
## DocumentService ⇐ [<code>NodeService</code>](#NodeService)
|
|
@@ -2508,6 +3272,7 @@ Simulate the behaviour of the Document Class when there is no DOM available.
|
|
|
2508
3272
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
2509
3273
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
2510
3274
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3275
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
2511
3276
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2512
3277
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
2513
3278
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -2729,6 +3494,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
2729
3494
|
| --- | --- |
|
|
2730
3495
|
| className | <code>string</code> |
|
|
2731
3496
|
|
|
3497
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
3498
|
+
|
|
3499
|
+
### documentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3500
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
3501
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
3502
|
+
|
|
3503
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
3504
|
+
|
|
3505
|
+
| Param | Type | Description |
|
|
3506
|
+
| --- | --- | --- |
|
|
3507
|
+
| namespace | <code>string</code> | Ignored |
|
|
3508
|
+
| tagName | <code>string</code> | |
|
|
3509
|
+
|
|
2732
3510
|
<a name="NodeService+querySelector"></a>
|
|
2733
3511
|
|
|
2734
3512
|
### documentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -2896,6 +3674,7 @@ not part of a tree, when it is inserted its children are moved into the tree ins
|
|
|
2896
3674
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
2897
3675
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
2898
3676
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3677
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
2899
3678
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2900
3679
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
2901
3680
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -3078,6 +3857,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
3078
3857
|
| --- | --- |
|
|
3079
3858
|
| className | <code>string</code> |
|
|
3080
3859
|
|
|
3860
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
3861
|
+
|
|
3862
|
+
### documentFragmentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3863
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
3864
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
3865
|
+
|
|
3866
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
3867
|
+
|
|
3868
|
+
| Param | Type | Description |
|
|
3869
|
+
| --- | --- | --- |
|
|
3870
|
+
| namespace | <code>string</code> | Ignored |
|
|
3871
|
+
| tagName | <code>string</code> | |
|
|
3872
|
+
|
|
3081
3873
|
<a name="NodeService+querySelector"></a>
|
|
3082
3874
|
|
|
3083
3875
|
### documentFragmentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -3304,6 +4096,119 @@ Stops the propagation of events further along in the Dom.
|
|
|
3304
4096
|
|
|
3305
4097
|
**Kind**: instance method of [<code>CustomEventService</code>](#CustomEventService)
|
|
3306
4098
|
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
4099
|
+
<a name="CSSStyleDeclarationService"></a>
|
|
4100
|
+
|
|
4101
|
+
## CSSStyleDeclarationService
|
|
4102
|
+
Simulate the behaviour of the CSSStyleDeclaration Class when there is no DOM available: an ordered map of CSS
|
|
4103
|
+
property/value pairs, parsed from and serialized back to a cssText string. Values are stored and returned as
|
|
4104
|
+
given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS
|
|
4105
|
+
engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by
|
|
4106
|
+
createStyleDeclaration, which wraps an instance of this class in a Proxy.
|
|
4107
|
+
|
|
4108
|
+
**Kind**: global class
|
|
4109
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
4110
|
+
|
|
4111
|
+
* [CSSStyleDeclarationService](#CSSStyleDeclarationService)
|
|
4112
|
+
* [new CSSStyleDeclarationService([cssText])](#new_CSSStyleDeclarationService_new)
|
|
4113
|
+
* [.length](#CSSStyleDeclarationService+length) ⇒ <code>number</code>
|
|
4114
|
+
* [.cssText](#CSSStyleDeclarationService+cssText) ⇒ <code>string</code>
|
|
4115
|
+
* [.cssText](#CSSStyleDeclarationService+cssText) ⇒ <code>undefined</code>
|
|
4116
|
+
* [.item(index)](#CSSStyleDeclarationService+item) ⇒ <code>string</code>
|
|
4117
|
+
* [.getPropertyValue(property)](#CSSStyleDeclarationService+getPropertyValue) ⇒ <code>string</code>
|
|
4118
|
+
* [.getPropertyPriority(property)](#CSSStyleDeclarationService+getPropertyPriority) ⇒ <code>string</code>
|
|
4119
|
+
* [.setProperty(property, value, [priority])](#CSSStyleDeclarationService+setProperty) ⇒ <code>undefined</code>
|
|
4120
|
+
* [.removeProperty(property)](#CSSStyleDeclarationService+removeProperty) ⇒ <code>string</code>
|
|
4121
|
+
|
|
4122
|
+
<a name="new_CSSStyleDeclarationService_new"></a>
|
|
4123
|
+
|
|
4124
|
+
### new CSSStyleDeclarationService([cssText])
|
|
4125
|
+
|
|
4126
|
+
| Param | Type | Default | Description |
|
|
4127
|
+
| --- | --- | --- | --- |
|
|
4128
|
+
| [cssText] | <code>string</code> | <code>"''"</code> | Initial declarations, as CSS text ("color: red; font-size: 12px;") |
|
|
4129
|
+
|
|
4130
|
+
<a name="CSSStyleDeclarationService+length"></a>
|
|
4131
|
+
|
|
4132
|
+
### cssStyleDeclarationService.length ⇒ <code>number</code>
|
|
4133
|
+
How many properties are currently set.
|
|
4134
|
+
|
|
4135
|
+
**Kind**: instance property of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4136
|
+
<a name="CSSStyleDeclarationService+cssText"></a>
|
|
4137
|
+
|
|
4138
|
+
### cssStyleDeclarationService.cssText ⇒ <code>string</code>
|
|
4139
|
+
All the declarations as one CSS text string.
|
|
4140
|
+
|
|
4141
|
+
**Kind**: instance property of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4142
|
+
<a name="CSSStyleDeclarationService+cssText"></a>
|
|
4143
|
+
|
|
4144
|
+
### cssStyleDeclarationService.cssText ⇒ <code>undefined</code>
|
|
4145
|
+
Replace every declaration by parsing a CSS text string ("color: red; font-size: 12px !important;").
|
|
4146
|
+
|
|
4147
|
+
**Kind**: instance property of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4148
|
+
|
|
4149
|
+
| Param | Type |
|
|
4150
|
+
| --- | --- |
|
|
4151
|
+
| cssText | <code>string</code> |
|
|
4152
|
+
|
|
4153
|
+
<a name="CSSStyleDeclarationService+item"></a>
|
|
4154
|
+
|
|
4155
|
+
### cssStyleDeclarationService.item(index) ⇒ <code>string</code>
|
|
4156
|
+
The name of the property at the given index, in the order it was set, or '' when there is none (matches the
|
|
4157
|
+
DOM's CSSStyleDeclaration, which is array-like).
|
|
4158
|
+
|
|
4159
|
+
**Kind**: instance method of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4160
|
+
|
|
4161
|
+
| Param | Type |
|
|
4162
|
+
| --- | --- |
|
|
4163
|
+
| index | <code>number</code> |
|
|
4164
|
+
|
|
4165
|
+
<a name="CSSStyleDeclarationService+getPropertyValue"></a>
|
|
4166
|
+
|
|
4167
|
+
### cssStyleDeclarationService.getPropertyValue(property) ⇒ <code>string</code>
|
|
4168
|
+
The value of the given property, or '' when it is not set.
|
|
4169
|
+
|
|
4170
|
+
**Kind**: instance method of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4171
|
+
|
|
4172
|
+
| Param | Type | Description |
|
|
4173
|
+
| --- | --- | --- |
|
|
4174
|
+
| property | <code>string</code> | A CSS property name (kebab-case, e.g. "background-color") |
|
|
4175
|
+
|
|
4176
|
+
<a name="CSSStyleDeclarationService+getPropertyPriority"></a>
|
|
4177
|
+
|
|
4178
|
+
### cssStyleDeclarationService.getPropertyPriority(property) ⇒ <code>string</code>
|
|
4179
|
+
"important" when the property was set with !important, otherwise ''.
|
|
4180
|
+
|
|
4181
|
+
**Kind**: instance method of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4182
|
+
|
|
4183
|
+
| Param | Type | Description |
|
|
4184
|
+
| --- | --- | --- |
|
|
4185
|
+
| property | <code>string</code> | A CSS property name (kebab-case) |
|
|
4186
|
+
|
|
4187
|
+
<a name="CSSStyleDeclarationService+setProperty"></a>
|
|
4188
|
+
|
|
4189
|
+
### cssStyleDeclarationService.setProperty(property, value, [priority]) ⇒ <code>undefined</code>
|
|
4190
|
+
Set a property's value (and optionally its priority). An empty, null or undefined value removes the property
|
|
4191
|
+
instead, like the DOM.
|
|
4192
|
+
|
|
4193
|
+
**Kind**: instance method of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4194
|
+
|
|
4195
|
+
| Param | Type | Default | Description |
|
|
4196
|
+
| --- | --- | --- | --- |
|
|
4197
|
+
| property | <code>string</code> | | A CSS property name (kebab-case) |
|
|
4198
|
+
| value | <code>string</code> | | The value, or '' to remove the property |
|
|
4199
|
+
| [priority] | <code>string</code> | <code>"''"</code> | "important" to mark it !important |
|
|
4200
|
+
|
|
4201
|
+
<a name="CSSStyleDeclarationService+removeProperty"></a>
|
|
4202
|
+
|
|
4203
|
+
### cssStyleDeclarationService.removeProperty(property) ⇒ <code>string</code>
|
|
4204
|
+
Remove a property, returning the value it had (or '' when it was not set).
|
|
4205
|
+
|
|
4206
|
+
**Kind**: instance method of [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
4207
|
+
|
|
4208
|
+
| Param | Type | Description |
|
|
4209
|
+
| --- | --- | --- |
|
|
4210
|
+
| property | <code>string</code> | A CSS property name (kebab-case) |
|
|
4211
|
+
|
|
3307
4212
|
<a name="AttrService"></a>
|
|
3308
4213
|
|
|
3309
4214
|
## AttrService ⇐ [<code>NodeService</code>](#NodeService)
|
|
@@ -3329,6 +4234,7 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
|
3329
4234
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
3330
4235
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3331
4236
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4237
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
3332
4238
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
3333
4239
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
3334
4240
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -3525,6 +4431,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
3525
4431
|
| --- | --- |
|
|
3526
4432
|
| className | <code>string</code> |
|
|
3527
4433
|
|
|
4434
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
4435
|
+
|
|
4436
|
+
### attrService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4437
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
4438
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
4439
|
+
|
|
4440
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
4441
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
4442
|
+
|
|
4443
|
+
| Param | Type | Description |
|
|
4444
|
+
| --- | --- | --- |
|
|
4445
|
+
| namespace | <code>string</code> | Ignored |
|
|
4446
|
+
| tagName | <code>string</code> | |
|
|
4447
|
+
|
|
3528
4448
|
<a name="NodeService+querySelector"></a>
|
|
3529
4449
|
|
|
3530
4450
|
### attrService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -3751,6 +4671,7 @@ createComment, createDocumentFragment, getElementById, textContent always null).
|
|
|
3751
4671
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
3752
4672
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3753
4673
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4674
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
3754
4675
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
3755
4676
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
3756
4677
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -4020,6 +4941,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
4020
4941
|
| --- | --- |
|
|
4021
4942
|
| className | <code>string</code> |
|
|
4022
4943
|
|
|
4944
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
4945
|
+
|
|
4946
|
+
### pseudoHTMLDocument.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4947
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
4948
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
4949
|
+
|
|
4950
|
+
**Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
4951
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
4952
|
+
|
|
4953
|
+
| Param | Type | Description |
|
|
4954
|
+
| --- | --- | --- |
|
|
4955
|
+
| namespace | <code>string</code> | Ignored |
|
|
4956
|
+
| tagName | <code>string</code> | |
|
|
4957
|
+
|
|
4023
4958
|
<a name="NodeService+querySelector"></a>
|
|
4024
4959
|
|
|
4025
4960
|
### pseudoHTMLDocument.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -4443,6 +5378,28 @@ Walk up from a node (not including it) to find the nearest element, in the given
|
|
|
4443
5378
|
| node | <code>\*</code> | The node to start from |
|
|
4444
5379
|
| direction | <code>'nextSibling'</code> \| <code>'previousSibling'</code> | Which sibling reference to follow |
|
|
4445
5380
|
|
|
5381
|
+
<a name="kebabToCamel"></a>
|
|
5382
|
+
|
|
5383
|
+
## kebabToCamel(name) ⇒ <code>string</code>
|
|
5384
|
+
kebab-case -> camelCase ("background-color" -> "backgroundColor").
|
|
5385
|
+
|
|
5386
|
+
**Kind**: global function
|
|
5387
|
+
|
|
5388
|
+
| Param | Type |
|
|
5389
|
+
| --- | --- |
|
|
5390
|
+
| name | <code>string</code> |
|
|
5391
|
+
|
|
5392
|
+
<a name="camelToKebab"></a>
|
|
5393
|
+
|
|
5394
|
+
## camelToKebab(name) ⇒ <code>string</code>
|
|
5395
|
+
camelCase -> kebab-case ("backgroundColor" -> "background-color").
|
|
5396
|
+
|
|
5397
|
+
**Kind**: global function
|
|
5398
|
+
|
|
5399
|
+
| Param | Type |
|
|
5400
|
+
| --- | --- |
|
|
5401
|
+
| name | <code>string</code> |
|
|
5402
|
+
|
|
4446
5403
|
<a name="createEvent"></a>
|
|
4447
5404
|
|
|
4448
5405
|
## createEvent(type, [init], [options]) ⇒ [<code>EventService</code>](#EventService)
|
|
@@ -4460,3 +5417,14 @@ real user action (isTrusted).
|
|
|
4460
5417
|
| [init] | <code>Object</code> | <code>{}</code> | The options for the event (bubbles, cancelable, composed and those of its kind of event) |
|
|
4461
5418
|
| [options] | <code>CreateEventOptions</code> | <code>{}</code> | Whether the browser is creating the event, and whether it is trusted |
|
|
4462
5419
|
|
|
5420
|
+
<a name="dataAttributes"></a>
|
|
5421
|
+
|
|
5422
|
+
## dataAttributes(element) ⇒ <code>Array.<Array.<string>></code>
|
|
5423
|
+
Every data-* attribute name currently on the element, as [attributeName, camelCaseName] pairs.
|
|
5424
|
+
|
|
5425
|
+
**Kind**: global function
|
|
5426
|
+
|
|
5427
|
+
| Param | Type |
|
|
5428
|
+
| --- | --- |
|
|
5429
|
+
| element | <code>\*</code> |
|
|
5430
|
+
|