pseudo-dom 0.9.0 → 0.11.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 +918 -18
- package/browser/pseudo-dom.js +3296 -604
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/factories/createDataset.d.ts +10 -10
- package/dist/factories/createDataset.js +78 -78
- package/dist/factories/createStyleDeclaration.d.ts +30 -30
- package/dist/factories/createStyleDeclaration.js +64 -64
- package/dist/factories/parseHTML.d.ts +13 -0
- package/dist/factories/parseHTML.js +84 -0
- package/dist/factories/parseHTML.min.js +1 -0
- package/dist/factories/serializeHTML.d.ts +15 -0
- package/dist/factories/serializeHTML.js +114 -0
- package/dist/factories/serializeHTML.min.js +1 -0
- package/dist/interfaces/PseudoCSSStyleDeclaration.d.ts +14 -14
- package/dist/interfaces/PseudoCSSStyleDeclaration.js +5 -5
- package/dist/interfaces/PseudoElement.d.ts +765 -702
- package/dist/interfaces/PseudoHTMLElement.d.ts +33 -33
- package/dist/interfaces/PseudoShadowRoot.d.ts +9 -0
- package/dist/services/CSSStyleDeclarationService.d.ts +73 -73
- package/dist/services/CSSStyleDeclarationService.js +156 -156
- package/dist/services/ElementService.d.ts +371 -191
- package/dist/services/ElementService.js +732 -426
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/HTMLElementService.d.ts +32 -0
- package/dist/services/HTMLElementService.js +67 -0
- package/dist/services/HTMLElementService.min.js +1 -1
- package/dist/services/NodeService.d.ts +8 -0
- package/dist/services/NodeService.js +11 -0
- package/dist/services/NodeService.min.js +1 -1
- package/dist/services/ShadowRootService.d.ts +12 -0
- package/dist/services/ShadowRootService.js +16 -1
- package/dist/services/ShadowRootService.min.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -49,8 +49,15 @@ Elements can be walked and changed like the DOM: \`children\` is a live \`HTMLCo
|
|
|
49
49
|
children, \`childElementCount\`, \`firstElementChild\` / \`lastElementChild\` and \`nextElementSibling\` /
|
|
50
50
|
\`previousElementSibling\` skip text and comment nodes. \`append\` / \`prepend\` / \`before\` / \`after\` / \`remove\` /
|
|
51
51
|
\`replaceWith\` / \`replaceChildren\` accept nodes or strings (a string becomes a text node) and move a node already in
|
|
52
|
-
a tree rather than duplicating it; \`insertAdjacentElement\` / \`insertAdjacentText\` insert at
|
|
53
|
-
/ beforeend / afterend
|
|
52
|
+
a tree rather than duplicating it; \`insertAdjacentElement\` / \`insertAdjacentText\` / \`insertAdjacentHTML\` insert at
|
|
53
|
+
beforebegin / afterbegin / beforeend / afterend.
|
|
54
|
+
|
|
55
|
+
\`innerHTML\` / \`outerHTML\` parse and serialize real HTML, via [htmlparser2](https://www.npmjs.com/package/htmlparser2)
|
|
56
|
+
(a SAX-style tokenizer; pseudo-dom builds its own nodes from its events, the same way it builds a tree from
|
|
57
|
+
\`css-select\`'s selector matches) - entities decode, void elements (\`br\`, \`img\`, ...) auto-close, and \`class\` /
|
|
58
|
+
\`style\` attributes populate \`className\`/\`classList\` and \`style\` for real, not just a generic attribute. The
|
|
59
|
+
setters (\`innerHTML =\`, \`outerHTML =\`) and \`insertAdjacentHTML\` are on \`HTMLElementService\` (they need to build
|
|
60
|
+
real \`HTMLElement\`s); \`ElementService\` only has the getters (serializing is fine without them).
|
|
54
61
|
|
|
55
62
|
Selector queries work like the DOM's: \`getElementsByTagName\` / \`getElementsByClassName\` (live, on any node) and
|
|
56
63
|
\`querySelector\` / \`querySelectorAll\` (real CSS selectors, via [css-select](https://www.npmjs.com/package/css-select)
|
|
@@ -65,8 +72,28 @@ the real DOM.
|
|
|
65
72
|
\`getElementById\`, and \`textContent\` always \`null\`. \`PseudoHTMLDocument\` (what \`generateDocument\` actually
|
|
66
73
|
creates) only adds the \`html\` / \`head\` / \`body\` structure on top.
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
\`
|
|
75
|
+
Attribute helpers work like the DOM's: \`getAttributeNames\`, \`hasAttributes\`, \`toggleAttribute(name, [force])\`;
|
|
76
|
+
\`localName\` matches \`tagName\` and \`prefix\` is always null (there is no real namespace parsing);
|
|
77
|
+
\`getElementsByTagNameNS\` behaves exactly like \`getElementsByTagName\`, ignoring the namespace.
|
|
78
|
+
|
|
79
|
+
\`attachShadow({mode})\` attaches a real (\`DocumentFragmentService\`-based) \`ShadowRoot\`, with \`host\` and \`mode\`
|
|
80
|
+
set; \`element.shadowRoot\` reaches it when the mode is 'open', like the DOM's (a 'closed' one still exists, just not
|
|
81
|
+
this way); attaching a second one throws.
|
|
82
|
+
|
|
83
|
+
There is no layout engine, so anything that would need one is settable directly rather than really computed - set the
|
|
84
|
+
value a test needs and the getter/method returns it: \`clientWidth\` / \`clientHeight\` / \`clientTop\` /
|
|
85
|
+
\`clientLeft\` / \`scrollWidth\` / \`scrollHeight\` (numbers, alongside the existing \`offsetWidth\` etc.),
|
|
86
|
+
\`boundingClientRect\` (what \`getBoundingClientRect()\` returns), \`clientRects\` (\`getClientRects()\`),
|
|
87
|
+
\`animations\` (\`getAnimations()\`) and \`isVisible\` (\`checkVisibility()\`). \`scrollLeft\` / \`scrollTop\` are real,
|
|
88
|
+
plain settable numbers, and \`scroll\` / \`scrollTo\` / \`scrollBy\` (a number pair or an options object) update them
|
|
89
|
+
for real; \`scrollIntoView\` is a real callable no-op (there is no viewport to scroll within).
|
|
90
|
+
\`hasPointerCapture\` / \`setPointerCapture\` / \`releasePointerCapture\` genuinely track capture per pointer id.
|
|
91
|
+
\`requestFullscreen\` / \`requestPointerLock\` resolve, like a browser granting the request would.
|
|
92
|
+
\`computedStyleMap()\` is a thin read-only view of the element's own inline style (there is no CSS cascade).
|
|
93
|
+
|
|
94
|
+
Not implemented yet (these throw a "not implemented" error or are missing): the \`aria*\` reflected properties, and
|
|
95
|
+
the \`Attr\`-node / namespaced attribute methods (\`getAttributeNode\`, \`getAttributeNS\`, ...). The API will change
|
|
96
|
+
before 1.0.
|
|
70
97
|
## Modules
|
|
71
98
|
|
|
72
99
|
<dl>
|
|
@@ -85,6 +112,10 @@ Not implemented yet (these throw a "not implemented" error or are missing): \`ge
|
|
|
85
112
|
<dd><p>Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
86
113
|
interface (the mouse, the keyboard, focus and input).</p>
|
|
87
114
|
</dd>
|
|
115
|
+
<dt><a href="#ShadowRootService">ShadowRootService</a> ⇐ <code><a href="#DocumentFragmentService">DocumentFragmentService</a></code></dt>
|
|
116
|
+
<dd><p>Simulate the behaviour of the ShadowRoot Class when there is no DOM available: a DocumentFragment attached to an
|
|
117
|
+
element via attachShadow, which sets host and mode.</p>
|
|
118
|
+
</dd>
|
|
88
119
|
<dt><a href="#PointerEventService">PointerEventService</a> ⇐ <code><a href="#MouseEventService">MouseEventService</a></code></dt>
|
|
89
120
|
<dd><p>Simulate the behaviour of the PointerEvent Class when there is no DOM available.</p>
|
|
90
121
|
</dd>
|
|
@@ -211,6 +242,19 @@ order in which an event travels down through them). A node which has no parent h
|
|
|
211
242
|
<dt><a href="#setActiveElement">setActiveElement(root, element)</a></dt>
|
|
212
243
|
<dd><p>Remember the element which has the focus in a tree.</p>
|
|
213
244
|
</dd>
|
|
245
|
+
<dt><a href="#escapeText">escapeText(text)</a> ⇒ <code>string</code></dt>
|
|
246
|
+
<dd><p>Escape text so it is safe inside HTML text content.</p>
|
|
247
|
+
</dd>
|
|
248
|
+
<dt><a href="#escapeAttributeValue">escapeAttributeValue(value)</a> ⇒ <code>string</code></dt>
|
|
249
|
+
<dd><p>Escape a value so it is safe inside a double-quoted HTML attribute.</p>
|
|
250
|
+
</dd>
|
|
251
|
+
<dt><a href="#serializeAttributes">serializeAttributes(element)</a> ⇒ <code>string</code></dt>
|
|
252
|
+
<dd><p>Every attribute of the element, serialized (class instead of className, boolean attributes bare, the never-real
|
|
253
|
+
mock properties left out, style added from the live CSSStyleDeclaration when it is not empty).</p>
|
|
254
|
+
</dd>
|
|
255
|
+
<dt><a href="#serializeNode">serializeNode(node)</a> ⇒ <code>string</code></dt>
|
|
256
|
+
<dd><p>One node, serialized (its own markup only - see serializeChildren for its descendants too).</p>
|
|
257
|
+
</dd>
|
|
214
258
|
<dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
|
|
215
259
|
<dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
|
|
216
260
|
</dd>
|
|
@@ -351,24 +395,428 @@ Return an array of targets that will have the event executed open them. The orde
|
|
|
351
395
|
### uiEventService.preventDefault() ⇒ <code>null</code>
|
|
352
396
|
Cancels the event (if it is cancelable).
|
|
353
397
|
|
|
354
|
-
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
355
|
-
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
356
|
-
<a name="EventService+stopImmediatePropagation"></a>
|
|
398
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
399
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
400
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
401
|
+
|
|
402
|
+
### uiEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
403
|
+
For this particular event, no other listener will be called.
|
|
404
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
405
|
+
capture phase, for instance)
|
|
406
|
+
|
|
407
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
408
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
409
|
+
<a name="EventService+stopPropagation"></a>
|
|
410
|
+
|
|
411
|
+
### uiEventService.stopPropagation() ⇒ <code>null</code>
|
|
412
|
+
Stops the propagation of events further along in the Dom.
|
|
413
|
+
|
|
414
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
415
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
416
|
+
<a name="ShadowRootService"></a>
|
|
417
|
+
|
|
418
|
+
## ShadowRootService ⇐ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
419
|
+
Simulate the behaviour of the ShadowRoot Class when there is no DOM available: a DocumentFragment attached to an
|
|
420
|
+
element via attachShadow, which sets host and mode.
|
|
421
|
+
|
|
422
|
+
**Kind**: global class
|
|
423
|
+
**Extends**: [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
424
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
425
|
+
|
|
426
|
+
* [ShadowRootService](#ShadowRootService) ⇐ [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
427
|
+
* [.host](#ShadowRootService+host)
|
|
428
|
+
* [.mode](#ShadowRootService+mode)
|
|
429
|
+
* [.acceptsChildren](#NodeService+acceptsChildren) ⇒ <code>boolean</code>
|
|
430
|
+
* [.getElementById(id)](#DocumentFragmentService+getElementById) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
431
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
432
|
+
* [.cloneShallow()](#NodeService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
|
|
433
|
+
* [.equalsShallow(other)](#NodeService+equalsShallow) ⇒ <code>boolean</code>
|
|
434
|
+
* [.append(...nodes)](#NodeService+append)
|
|
435
|
+
* [.prepend(...nodes)](#NodeService+prepend)
|
|
436
|
+
* [.replaceChildren(...nodes)](#NodeService+replaceChildren)
|
|
437
|
+
* [.before(...nodes)](#NodeService+before)
|
|
438
|
+
* [.after(...nodes)](#NodeService+after)
|
|
439
|
+
* [.replaceWith(...nodes)](#NodeService+replaceWith)
|
|
440
|
+
* [.remove()](#NodeService+remove)
|
|
441
|
+
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
442
|
+
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
443
|
+
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
444
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
445
|
+
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
446
|
+
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
447
|
+
* [.childInserted(child)](#NodeService+childInserted)
|
|
448
|
+
* [.cloneNode([deep])](#NodeService+cloneNode) ⇒ <code>PseudoNode</code>
|
|
449
|
+
* [.compareDocumentPosition(otherNode)](#NodeService+compareDocumentPosition) ⇒ <code>number</code>
|
|
450
|
+
* [.contains(otherNode)](#NodeService+contains) ⇒ <code>boolean</code>
|
|
451
|
+
* [.insertBefore(newNode, [referenceNode])](#NodeService+insertBefore) ⇒ <code>PseudoNode</code>
|
|
452
|
+
* [.isEqualNode(otherNode)](#NodeService+isEqualNode) ⇒ <code>boolean</code>
|
|
453
|
+
* [.normalize()](#NodeService+normalize)
|
|
454
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
455
|
+
* [.replaceChild(newChild, oldChild)](#NodeService+replaceChild) ⇒ <code>PseudoNode</code>
|
|
456
|
+
|
|
457
|
+
<a name="ShadowRootService+host"></a>
|
|
458
|
+
|
|
459
|
+
### shadowRootService.host
|
|
460
|
+
The element this shadow root is attached to. Set by attachShadow.
|
|
461
|
+
|
|
462
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
463
|
+
<a name="ShadowRootService+mode"></a>
|
|
464
|
+
|
|
465
|
+
### shadowRootService.mode
|
|
466
|
+
'open' (reachable via element.shadowRoot) or 'closed' (not). Set by attachShadow.
|
|
467
|
+
|
|
468
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
469
|
+
<a name="NodeService+acceptsChildren"></a>
|
|
470
|
+
|
|
471
|
+
### shadowRootService.acceptsChildren ⇒ <code>boolean</code>
|
|
472
|
+
Whether this kind of node can have children (text, comments and attributes cannot).
|
|
473
|
+
|
|
474
|
+
**Kind**: instance property of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
475
|
+
**Overrides**: [<code>acceptsChildren</code>](#NodeService+acceptsChildren)
|
|
476
|
+
<a name="DocumentFragmentService+getElementById"></a>
|
|
477
|
+
|
|
478
|
+
### shadowRootService.getElementById(id) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
479
|
+
The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
|
|
480
|
+
NonElementParentNode mixin, which Document and DocumentFragment both implement).
|
|
481
|
+
|
|
482
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
483
|
+
**Overrides**: [<code>getElementById</code>](#DocumentFragmentService+getElementById)
|
|
484
|
+
|
|
485
|
+
| Param | Type |
|
|
486
|
+
| --- | --- |
|
|
487
|
+
| id | <code>string</code> |
|
|
488
|
+
|
|
489
|
+
<a name="NodeService+appendChild"></a>
|
|
490
|
+
|
|
491
|
+
### shadowRootService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
492
|
+
Add a node as the last child of this node (a node which is already in a tree is moved).
|
|
493
|
+
|
|
494
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
495
|
+
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
496
|
+
**Returns**: <code>PseudoNode</code> - The added node
|
|
497
|
+
|
|
498
|
+
| Param | Type | Description |
|
|
499
|
+
| --- | --- | --- |
|
|
500
|
+
| childNode | <code>PseudoNode</code> | The node to add |
|
|
501
|
+
|
|
502
|
+
<a name="NodeService+cloneShallow"></a>
|
|
503
|
+
|
|
504
|
+
### shadowRootService.cloneShallow() ⇒ [<code>NodeService</code>](#NodeService)
|
|
505
|
+
Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
|
|
506
|
+
Kinds of node which are made with arguments override this to give them.
|
|
507
|
+
|
|
508
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
509
|
+
**Overrides**: [<code>cloneShallow</code>](#NodeService+cloneShallow)
|
|
510
|
+
<a name="NodeService+equalsShallow"></a>
|
|
511
|
+
|
|
512
|
+
### shadowRootService.equalsShallow(other) ⇒ <code>boolean</code>
|
|
513
|
+
Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
|
|
514
|
+
afterwards. Kinds of node with more to compare (an element has attributes) override this.
|
|
515
|
+
|
|
516
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
517
|
+
**Overrides**: [<code>equalsShallow</code>](#NodeService+equalsShallow)
|
|
518
|
+
|
|
519
|
+
| Param | Type | Description |
|
|
520
|
+
| --- | --- | --- |
|
|
521
|
+
| other | [<code>NodeService</code>](#NodeService) | The node to compare with |
|
|
522
|
+
|
|
523
|
+
<a name="NodeService+append"></a>
|
|
524
|
+
|
|
525
|
+
### shadowRootService.append(...nodes)
|
|
526
|
+
Add nodes (strings become text nodes) as the last children of this node, in the order given.
|
|
527
|
+
|
|
528
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
529
|
+
**Overrides**: [<code>append</code>](#NodeService+append)
|
|
530
|
+
**Throws**:
|
|
531
|
+
|
|
532
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
| Param | Type | Description |
|
|
536
|
+
| --- | --- | --- |
|
|
537
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
538
|
+
|
|
539
|
+
<a name="NodeService+prepend"></a>
|
|
540
|
+
|
|
541
|
+
### shadowRootService.prepend(...nodes)
|
|
542
|
+
Add nodes (strings become text nodes) as the first children of this node, in the order given.
|
|
543
|
+
|
|
544
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
545
|
+
**Overrides**: [<code>prepend</code>](#NodeService+prepend)
|
|
546
|
+
**Throws**:
|
|
547
|
+
|
|
548
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
| Param | Type | Description |
|
|
552
|
+
| --- | --- | --- |
|
|
553
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
554
|
+
|
|
555
|
+
<a name="NodeService+replaceChildren"></a>
|
|
556
|
+
|
|
557
|
+
### shadowRootService.replaceChildren(...nodes)
|
|
558
|
+
Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
|
|
559
|
+
|
|
560
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
561
|
+
**Overrides**: [<code>replaceChildren</code>](#NodeService+replaceChildren)
|
|
562
|
+
**Throws**:
|
|
563
|
+
|
|
564
|
+
- <code>Error</code> When this kind of node cannot have children
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
| Param | Type | Description |
|
|
568
|
+
| --- | --- | --- |
|
|
569
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
570
|
+
|
|
571
|
+
<a name="NodeService+before"></a>
|
|
572
|
+
|
|
573
|
+
### shadowRootService.before(...nodes)
|
|
574
|
+
Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
|
|
575
|
+
no parent.
|
|
576
|
+
|
|
577
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
578
|
+
**Overrides**: [<code>before</code>](#NodeService+before)
|
|
579
|
+
|
|
580
|
+
| Param | Type | Description |
|
|
581
|
+
| --- | --- | --- |
|
|
582
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
583
|
+
|
|
584
|
+
<a name="NodeService+after"></a>
|
|
585
|
+
|
|
586
|
+
### shadowRootService.after(...nodes)
|
|
587
|
+
Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
|
|
588
|
+
parent.
|
|
589
|
+
|
|
590
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
591
|
+
**Overrides**: [<code>after</code>](#NodeService+after)
|
|
592
|
+
|
|
593
|
+
| Param | Type | Description |
|
|
594
|
+
| --- | --- | --- |
|
|
595
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to add |
|
|
596
|
+
|
|
597
|
+
<a name="NodeService+replaceWith"></a>
|
|
598
|
+
|
|
599
|
+
### shadowRootService.replaceWith(...nodes)
|
|
600
|
+
Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
|
|
601
|
+
when this node has no parent.
|
|
602
|
+
|
|
603
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
604
|
+
**Overrides**: [<code>replaceWith</code>](#NodeService+replaceWith)
|
|
605
|
+
|
|
606
|
+
| Param | Type | Description |
|
|
607
|
+
| --- | --- | --- |
|
|
608
|
+
| ...nodes | <code>PseudoNode</code> \| <code>string</code> | The nodes (or text) to put in this node's place |
|
|
609
|
+
|
|
610
|
+
<a name="NodeService+remove"></a>
|
|
611
|
+
|
|
612
|
+
### shadowRootService.remove()
|
|
613
|
+
Remove this node from its parent. Does nothing when it has no parent.
|
|
614
|
+
|
|
615
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
616
|
+
**Overrides**: [<code>remove</code>](#NodeService+remove)
|
|
617
|
+
<a name="NodeService+toChildNode"></a>
|
|
618
|
+
|
|
619
|
+
### shadowRootService.toChildNode(value) ⇒ <code>PseudoNode</code>
|
|
620
|
+
Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
|
|
621
|
+
becomes a text node belonging to this node's document, anything else is returned as it is.
|
|
622
|
+
|
|
623
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
624
|
+
**Overrides**: [<code>toChildNode</code>](#NodeService+toChildNode)
|
|
625
|
+
|
|
626
|
+
| Param | Type | Description |
|
|
627
|
+
| --- | --- | --- |
|
|
628
|
+
| value | <code>PseudoNode</code> \| <code>string</code> | The value to add |
|
|
629
|
+
|
|
630
|
+
<a name="NodeService+getElementsByTagName"></a>
|
|
631
|
+
|
|
632
|
+
### shadowRootService.getElementsByTagName(tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
633
|
+
Every element below this node with the given tag name (or every element when tagName is *), live.
|
|
634
|
+
|
|
635
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
636
|
+
**Overrides**: [<code>getElementsByTagName</code>](#NodeService+getElementsByTagName)
|
|
637
|
+
|
|
638
|
+
| Param | Type |
|
|
639
|
+
| --- | --- |
|
|
640
|
+
| tagName | <code>string</code> |
|
|
641
|
+
|
|
642
|
+
<a name="NodeService+getElementsByClassName"></a>
|
|
643
|
+
|
|
644
|
+
### shadowRootService.getElementsByClassName(className) ⇒ <code>PseudoHTMLCollection</code>
|
|
645
|
+
Every element below this node which has all of the given (space separated) classes, live.
|
|
646
|
+
|
|
647
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
648
|
+
**Overrides**: [<code>getElementsByClassName</code>](#NodeService+getElementsByClassName)
|
|
649
|
+
|
|
650
|
+
| Param | Type |
|
|
651
|
+
| --- | --- |
|
|
652
|
+
| className | <code>string</code> |
|
|
653
|
+
|
|
654
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
655
|
+
|
|
656
|
+
### shadowRootService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
657
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
658
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
659
|
+
|
|
660
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
661
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
662
|
+
|
|
663
|
+
| Param | Type | Description |
|
|
664
|
+
| --- | --- | --- |
|
|
665
|
+
| namespace | <code>string</code> | Ignored |
|
|
666
|
+
| tagName | <code>string</code> | |
|
|
667
|
+
|
|
668
|
+
<a name="NodeService+querySelector"></a>
|
|
669
|
+
|
|
670
|
+
### shadowRootService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
671
|
+
The first element below this node which matches the CSS selector, in tree order, or null when there is none.
|
|
672
|
+
|
|
673
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
674
|
+
**Overrides**: [<code>querySelector</code>](#NodeService+querySelector)
|
|
675
|
+
|
|
676
|
+
| Param | Type | Description |
|
|
677
|
+
| --- | --- | --- |
|
|
678
|
+
| selectors | <code>string</code> | A CSS selector |
|
|
679
|
+
|
|
680
|
+
<a name="NodeService+querySelectorAll"></a>
|
|
681
|
+
|
|
682
|
+
### shadowRootService.querySelectorAll(selectors) ⇒ <code>Array.<PseudoElement></code>
|
|
683
|
+
Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
|
|
684
|
+
collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
|
|
685
|
+
|
|
686
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
687
|
+
**Overrides**: [<code>querySelectorAll</code>](#NodeService+querySelectorAll)
|
|
688
|
+
|
|
689
|
+
| Param | Type | Description |
|
|
690
|
+
| --- | --- | --- |
|
|
691
|
+
| selectors | <code>string</code> | A CSS selector |
|
|
692
|
+
|
|
693
|
+
<a name="NodeService+childInserted"></a>
|
|
694
|
+
|
|
695
|
+
### shadowRootService.childInserted(child)
|
|
696
|
+
Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
|
|
697
|
+
(for example elements applying default events) can do so.
|
|
698
|
+
|
|
699
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
700
|
+
**Overrides**: [<code>childInserted</code>](#NodeService+childInserted)
|
|
701
|
+
|
|
702
|
+
| Param | Type | Description |
|
|
703
|
+
| --- | --- | --- |
|
|
704
|
+
| child | [<code>NodeService</code>](#NodeService) | The node which was inserted |
|
|
705
|
+
|
|
706
|
+
<a name="NodeService+cloneNode"></a>
|
|
707
|
+
|
|
708
|
+
### shadowRootService.cloneNode([deep]) ⇒ <code>PseudoNode</code>
|
|
709
|
+
Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
|
|
710
|
+
too, all the way down.
|
|
711
|
+
|
|
712
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
713
|
+
**Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
|
|
714
|
+
|
|
715
|
+
| Param | Type | Default | Description |
|
|
716
|
+
| --- | --- | --- | --- |
|
|
717
|
+
| [deep] | <code>boolean</code> | <code>false</code> | Copy the children as well |
|
|
718
|
+
|
|
719
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
720
|
+
|
|
721
|
+
### shadowRootService.compareDocumentPosition(otherNode) ⇒ <code>number</code>
|
|
722
|
+
Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node
|
|
723
|
+
itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
|
|
724
|
+
CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
|
|
725
|
+
otherwise PRECEDING or FOLLOWING by their order in the tree.
|
|
726
|
+
|
|
727
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
728
|
+
**Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
|
|
729
|
+
|
|
730
|
+
| Param | Type | Description |
|
|
731
|
+
| --- | --- | --- |
|
|
732
|
+
| otherNode | <code>PseudoNode</code> | The node to locate |
|
|
733
|
+
|
|
734
|
+
<a name="NodeService+contains"></a>
|
|
735
|
+
|
|
736
|
+
### shadowRootService.contains(otherNode) ⇒ <code>boolean</code>
|
|
737
|
+
Check whether a node is this node or one of its descendants.
|
|
738
|
+
|
|
739
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
740
|
+
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
741
|
+
|
|
742
|
+
| Param | Type | Description |
|
|
743
|
+
| --- | --- | --- |
|
|
744
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to look for |
|
|
745
|
+
|
|
746
|
+
<a name="NodeService+insertBefore"></a>
|
|
747
|
+
|
|
748
|
+
### shadowRootService.insertBefore(newNode, [referenceNode]) ⇒ <code>PseudoNode</code>
|
|
749
|
+
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
|
|
750
|
+
already in a tree is moved, and the children of a document fragment are moved in order.
|
|
751
|
+
|
|
752
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
753
|
+
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
754
|
+
**Returns**: <code>PseudoNode</code> - The inserted node
|
|
755
|
+
**Throws**:
|
|
756
|
+
|
|
757
|
+
- <code>Error</code> When the reference node is not a child of this node, or the new node is this node or contains it
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
| Param | Type | Default | Description |
|
|
761
|
+
| --- | --- | --- | --- |
|
|
762
|
+
| newNode | <code>PseudoNode</code> | | The node to insert |
|
|
763
|
+
| [referenceNode] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The child of this node to insert before, or null to insert at the end |
|
|
764
|
+
|
|
765
|
+
<a name="NodeService+isEqualNode"></a>
|
|
766
|
+
|
|
767
|
+
### shadowRootService.isEqualNode(otherNode) ⇒ <code>boolean</code>
|
|
768
|
+
Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
|
|
769
|
+
needs the same attributes), and children which are equal in the same order.
|
|
770
|
+
|
|
771
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
772
|
+
**Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
|
|
773
|
+
|
|
774
|
+
| Param | Type | Description |
|
|
775
|
+
| --- | --- | --- |
|
|
776
|
+
| otherNode | <code>PseudoNode</code> \| <code>null</code> | The node to compare with |
|
|
777
|
+
|
|
778
|
+
<a name="NodeService+normalize"></a>
|
|
779
|
+
|
|
780
|
+
### shadowRootService.normalize()
|
|
781
|
+
Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
|
|
782
|
+
|
|
783
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
784
|
+
**Overrides**: [<code>normalize</code>](#NodeService+normalize)
|
|
785
|
+
<a name="NodeService+removeChild"></a>
|
|
786
|
+
|
|
787
|
+
### shadowRootService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
788
|
+
Remove a child from this node, it no longer has a parent or siblings afterwards.
|
|
789
|
+
|
|
790
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
791
|
+
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
792
|
+
**Returns**: <code>PseudoNode</code> - The removed node
|
|
793
|
+
**Throws**:
|
|
794
|
+
|
|
795
|
+
- <code>Error</code> When the node is not a child of this node
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
| Param | Type | Description |
|
|
799
|
+
| --- | --- | --- |
|
|
800
|
+
| childElement | <code>PseudoNode</code> | The child node to remove |
|
|
801
|
+
|
|
802
|
+
<a name="NodeService+replaceChild"></a>
|
|
803
|
+
|
|
804
|
+
### shadowRootService.replaceChild(newChild, oldChild) ⇒ <code>PseudoNode</code>
|
|
805
|
+
Replace a child of this node with another node (which is moved if it is already in a tree).
|
|
357
806
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
807
|
+
**Kind**: instance method of [<code>ShadowRootService</code>](#ShadowRootService)
|
|
808
|
+
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
809
|
+
**Returns**: <code>PseudoNode</code> - The replaced node
|
|
810
|
+
**Throws**:
|
|
362
811
|
|
|
363
|
-
|
|
364
|
-
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
365
|
-
<a name="EventService+stopPropagation"></a>
|
|
812
|
+
- <code>Error</code> When the old node is not a child of this node
|
|
366
813
|
|
|
367
|
-
### uiEventService.stopPropagation() ⇒ <code>null</code>
|
|
368
|
-
Stops the propagation of events further along in the Dom.
|
|
369
814
|
|
|
370
|
-
|
|
371
|
-
|
|
815
|
+
| Param | Type | Description |
|
|
816
|
+
| --- | --- | --- |
|
|
817
|
+
| newChild | <code>PseudoNode</code> | The node which takes the place |
|
|
818
|
+
| oldChild | <code>PseudoNode</code> | The child of this node to replace |
|
|
819
|
+
|
|
372
820
|
<a name="PointerEventService"></a>
|
|
373
821
|
|
|
374
822
|
## PointerEventService ⇐ [<code>MouseEventService</code>](#MouseEventService)
|
|
@@ -488,6 +936,7 @@ Simulate the behaviour of the Node Class when there is no DOM available.
|
|
|
488
936
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
489
937
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
490
938
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
939
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
491
940
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
492
941
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
493
942
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -658,6 +1107,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
658
1107
|
| --- | --- |
|
|
659
1108
|
| className | <code>string</code> |
|
|
660
1109
|
|
|
1110
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1111
|
+
|
|
1112
|
+
### nodeService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1113
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1114
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1115
|
+
|
|
1116
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
1117
|
+
|
|
1118
|
+
| Param | Type | Description |
|
|
1119
|
+
| --- | --- | --- |
|
|
1120
|
+
| namespace | <code>string</code> | Ignored |
|
|
1121
|
+
| tagName | <code>string</code> | |
|
|
1122
|
+
|
|
661
1123
|
<a name="NodeService+querySelector"></a>
|
|
662
1124
|
|
|
663
1125
|
### nodeService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -833,6 +1295,7 @@ Simulate the behaviour of the Text Class when there is no DOM available: the tex
|
|
|
833
1295
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
834
1296
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
835
1297
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1298
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
836
1299
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
837
1300
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
838
1301
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -1042,6 +1505,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
1042
1505
|
| --- | --- |
|
|
1043
1506
|
| className | <code>string</code> |
|
|
1044
1507
|
|
|
1508
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1509
|
+
|
|
1510
|
+
### textService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1511
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1512
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1513
|
+
|
|
1514
|
+
**Kind**: instance method of [<code>TextService</code>](#TextService)
|
|
1515
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
1516
|
+
|
|
1517
|
+
| Param | Type | Description |
|
|
1518
|
+
| --- | --- | --- |
|
|
1519
|
+
| namespace | <code>string</code> | Ignored |
|
|
1520
|
+
| tagName | <code>string</code> | |
|
|
1521
|
+
|
|
1045
1522
|
<a name="NodeService+querySelector"></a>
|
|
1046
1523
|
|
|
1047
1524
|
### textService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -1226,6 +1703,7 @@ Simulate the behaviour of the Comment Class when there is no DOM available: a no
|
|
|
1226
1703
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
1227
1704
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1228
1705
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1706
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
1229
1707
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
1230
1708
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
1231
1709
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -1418,6 +1896,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
1418
1896
|
| --- | --- |
|
|
1419
1897
|
| className | <code>string</code> |
|
|
1420
1898
|
|
|
1899
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
1900
|
+
|
|
1901
|
+
### commentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
1902
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
1903
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
1904
|
+
|
|
1905
|
+
**Kind**: instance method of [<code>CommentService</code>](#CommentService)
|
|
1906
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
1907
|
+
|
|
1908
|
+
| Param | Type | Description |
|
|
1909
|
+
| --- | --- | --- |
|
|
1910
|
+
| namespace | <code>string</code> | Ignored |
|
|
1911
|
+
| tagName | <code>string</code> | |
|
|
1912
|
+
|
|
1421
1913
|
<a name="NodeService+querySelector"></a>
|
|
1422
1914
|
|
|
1423
1915
|
### commentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -1855,9 +2347,13 @@ Simulate the behaviour of the HTMLElement Class when there is no DOM available.
|
|
|
1855
2347
|
* [new HTMLElementService([elementOptions])](#new_HTMLElementService_new)
|
|
1856
2348
|
* [.style](#HTMLElementService+style) ⇒ [<code>CSSStyleDeclarationService</code>](#CSSStyleDeclarationService)
|
|
1857
2349
|
* [.dataset](#HTMLElementService+dataset) ⇒ <code>Object.<string, string></code>
|
|
2350
|
+
* [.innerHTML](#HTMLElementService+innerHTML) ⇒ <code>undefined</code>
|
|
2351
|
+
* [.outerHTML](#HTMLElementService+outerHTML) ⇒ <code>undefined</code>
|
|
1858
2352
|
* [.canFocus](#HTMLElementService+canFocus) ⇒ <code>boolean</code>
|
|
1859
2353
|
* [.cloneShallow()](#HTMLElementService+cloneShallow) ⇒ [<code>NodeService</code>](#NodeService)
|
|
1860
2354
|
* [.equalsShallow(other)](#HTMLElementService+equalsShallow) ⇒ <code>boolean</code>
|
|
2355
|
+
* [.parse(html)](#HTMLElementService+parse) ⇒ <code>Array.<\*></code>
|
|
2356
|
+
* [.insertAdjacentHTML(position, html)](#HTMLElementService+insertAdjacentHTML) ⇒ <code>undefined</code>
|
|
1861
2357
|
* [.click()](#HTMLElementService+click)
|
|
1862
2358
|
* [.focus()](#HTMLElementService+focus)
|
|
1863
2359
|
* [.blur()](#HTMLElementService+blur)
|
|
@@ -1889,6 +2385,30 @@ The element's data-* attributes, live, under their camelCase names (data-foo-bar
|
|
|
1889
2385
|
directly by getAttribute / setAttribute, so it is never out of sync with the attributes themselves.
|
|
1890
2386
|
|
|
1891
2387
|
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2388
|
+
<a name="HTMLElementService+innerHTML"></a>
|
|
2389
|
+
|
|
2390
|
+
### htmlElementService.innerHTML ⇒ <code>undefined</code>
|
|
2391
|
+
Replace this element's children by parsing html. innerHTML's setter is here rather than on ElementService (which
|
|
2392
|
+
only has the getter) because building the new elements needs a concrete element class - see parse().
|
|
2393
|
+
|
|
2394
|
+
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2395
|
+
|
|
2396
|
+
| Param | Type |
|
|
2397
|
+
| --- | --- |
|
|
2398
|
+
| html | <code>string</code> |
|
|
2399
|
+
|
|
2400
|
+
<a name="HTMLElementService+outerHTML"></a>
|
|
2401
|
+
|
|
2402
|
+
### htmlElementService.outerHTML ⇒ <code>undefined</code>
|
|
2403
|
+
Replace this element itself, in its parent, by parsing html. Does nothing when it has no parent, like
|
|
2404
|
+
replaceWith. outerHTML's setter is here rather than on ElementService for the same reason as innerHTML's.
|
|
2405
|
+
|
|
2406
|
+
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2407
|
+
|
|
2408
|
+
| Param | Type |
|
|
2409
|
+
| --- | --- |
|
|
2410
|
+
| html | <code>string</code> |
|
|
2411
|
+
|
|
1892
2412
|
<a name="HTMLElementService+canFocus"></a>
|
|
1893
2413
|
|
|
1894
2414
|
### htmlElementService.canFocus ⇒ <code>boolean</code>
|
|
@@ -1912,6 +2432,35 @@ Style is not attribute-backed like most properties, so isEqualNode needs to comp
|
|
|
1912
2432
|
| --- | --- | --- |
|
|
1913
2433
|
| other | [<code>NodeService</code>](#NodeService) | The node to compare with |
|
|
1914
2434
|
|
|
2435
|
+
<a name="HTMLElementService+parse"></a>
|
|
2436
|
+
|
|
2437
|
+
### htmlElementService.parse(html) ⇒ <code>Array.<\*></code>
|
|
2438
|
+
Parses html with this class building each new element (matches HTML: parsed elements behave like plain
|
|
2439
|
+
HTMLElements, not whatever specialized class happens to be setting innerHTML / outerHTML).
|
|
2440
|
+
|
|
2441
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2442
|
+
|
|
2443
|
+
| Param | Type |
|
|
2444
|
+
| --- | --- |
|
|
2445
|
+
| html | <code>string</code> |
|
|
2446
|
+
|
|
2447
|
+
<a name="HTMLElementService+insertAdjacentHTML"></a>
|
|
2448
|
+
|
|
2449
|
+
### htmlElementService.insertAdjacentHTML(position, html) ⇒ <code>undefined</code>
|
|
2450
|
+
Parse html and insert the resulting nodes at the given position, like insertAdjacentElement /
|
|
2451
|
+
insertAdjacentText.
|
|
2452
|
+
|
|
2453
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
2454
|
+
**Throws**:
|
|
2455
|
+
|
|
2456
|
+
- <code>Error</code> When the position is not one of the four above
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
| Param | Type | Description |
|
|
2460
|
+
| --- | --- | --- |
|
|
2461
|
+
| position | <code>string</code> | beforebegin, afterbegin, beforeend or afterend |
|
|
2462
|
+
| html | <code>string</code> | The markup to parse |
|
|
2463
|
+
|
|
1915
2464
|
<a name="HTMLElementService+click"></a>
|
|
1916
2465
|
|
|
1917
2466
|
### htmlElementService.click()
|
|
@@ -2295,12 +2844,21 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2295
2844
|
|
|
2296
2845
|
* [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
|
|
2297
2846
|
* [new ElementService([settings])](#new_ElementService_new)
|
|
2847
|
+
* [.boundingClientRect](#ElementService+boundingClientRect)
|
|
2848
|
+
* [.clientRects](#ElementService+clientRects)
|
|
2849
|
+
* [.animations](#ElementService+animations)
|
|
2850
|
+
* [.isVisible](#ElementService+isVisible)
|
|
2851
|
+
* [.localName](#ElementService+localName) ⇒ <code>string</code>
|
|
2852
|
+
* [.prefix](#ElementService+prefix) ⇒ <code>string</code> \| <code>null</code>
|
|
2853
|
+
* [.innerHTML](#ElementService+innerHTML) ⇒ <code>string</code>
|
|
2854
|
+
* [.outerHTML](#ElementService+outerHTML) ⇒ <code>string</code>
|
|
2298
2855
|
* [.children](#ElementService+children) ⇒ <code>PseudoHTMLCollection</code>
|
|
2299
2856
|
* [.childElementCount](#ElementService+childElementCount) ⇒ <code>number</code>
|
|
2300
2857
|
* [.firstElementChild](#ElementService+firstElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2301
2858
|
* [.lastElementChild](#ElementService+lastElementChild) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2302
2859
|
* [.nextElementSibling](#ElementService+nextElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2303
2860
|
* [.previousElementSibling](#ElementService+previousElementSibling) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2861
|
+
* [.shadowRoot](#ElementService+shadowRoot) ⇒ <code>PseudoShadowRoot</code> \| <code>null</code>
|
|
2304
2862
|
* [.currentAttributes()](#ElementService+currentAttributes) ⇒ <code>Array.<{name: string, value: \*}></code>
|
|
2305
2863
|
* [.cloneShallow()](#ElementService+cloneShallow) ⇒ [<code>ElementService</code>](#ElementService)
|
|
2306
2864
|
* [.equalsShallow(other)](#ElementService+equalsShallow) ⇒ <code>boolean</code>
|
|
@@ -2315,6 +2873,24 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2315
2873
|
* [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
|
|
2316
2874
|
* [.getAttribute(attributeName)](#ElementService+getAttribute) ⇒ <code>string</code> \| <code>null</code>
|
|
2317
2875
|
* [.removeAttribute(attributeName)](#ElementService+removeAttribute) ⇒ <code>undefined</code>
|
|
2876
|
+
* [.getAttributeNames()](#ElementService+getAttributeNames) ⇒ <code>Array.<string></code>
|
|
2877
|
+
* [.hasAttributes()](#ElementService+hasAttributes) ⇒ <code>boolean</code>
|
|
2878
|
+
* [.toggleAttribute(attributeName, [force])](#ElementService+toggleAttribute) ⇒ <code>boolean</code>
|
|
2879
|
+
* [.getBoundingClientRect()](#ElementService+getBoundingClientRect) ⇒ <code>DOMRect</code>
|
|
2880
|
+
* [.getClientRects()](#ElementService+getClientRects) ⇒ <code>Array.<DOMRect></code>
|
|
2881
|
+
* [.getAnimations()](#ElementService+getAnimations) ⇒ <code>Array.<\*></code>
|
|
2882
|
+
* [.checkVisibility()](#ElementService+checkVisibility) ⇒ <code>boolean</code>
|
|
2883
|
+
* [.computedStyleMap()](#ElementService+computedStyleMap) ⇒ <code>Object</code>
|
|
2884
|
+
* [.hasPointerCapture(pointerId)](#ElementService+hasPointerCapture) ⇒ <code>boolean</code>
|
|
2885
|
+
* [.setPointerCapture(pointerId)](#ElementService+setPointerCapture) ⇒ <code>undefined</code>
|
|
2886
|
+
* [.releasePointerCapture(pointerId)](#ElementService+releasePointerCapture) ⇒ <code>undefined</code>
|
|
2887
|
+
* [.scroll([x], [y])](#ElementService+scroll) ⇒ <code>undefined</code>
|
|
2888
|
+
* [.scrollTo([x], [y])](#ElementService+scrollTo) ⇒ <code>undefined</code>
|
|
2889
|
+
* [.scrollBy([x], [y])](#ElementService+scrollBy) ⇒ <code>undefined</code>
|
|
2890
|
+
* [.scrollIntoView()](#ElementService+scrollIntoView) ⇒ <code>undefined</code>
|
|
2891
|
+
* [.requestFullscreen()](#ElementService+requestFullscreen) ⇒ <code>Promise.<void></code>
|
|
2892
|
+
* [.requestPointerLock()](#ElementService+requestPointerLock) ⇒ <code>Promise.<void></code>
|
|
2893
|
+
* [.attachShadow(options)](#ElementService+attachShadow) ⇒ <code>PseudoShadowRoot</code>
|
|
2318
2894
|
|
|
2319
2895
|
<a name="new_ElementService_new"></a>
|
|
2320
2896
|
|
|
@@ -2328,6 +2904,57 @@ Simulate the behaviour of the Element Class when there is no DOM available.
|
|
|
2328
2904
|
| [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The node to add this element to as its last child |
|
|
2329
2905
|
| [settings.children] | <code>Array.<PseudoNode></code> | <code>[]</code> | The nodes to start as children |
|
|
2330
2906
|
|
|
2907
|
+
<a name="ElementService+boundingClientRect"></a>
|
|
2908
|
+
|
|
2909
|
+
### elementService.boundingClientRect
|
|
2910
|
+
What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly.
|
|
2911
|
+
|
|
2912
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2913
|
+
<a name="ElementService+clientRects"></a>
|
|
2914
|
+
|
|
2915
|
+
### elementService.clientRects
|
|
2916
|
+
What getClientRects() returns - set this directly.
|
|
2917
|
+
|
|
2918
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2919
|
+
<a name="ElementService+animations"></a>
|
|
2920
|
+
|
|
2921
|
+
### elementService.animations
|
|
2922
|
+
What getAnimations() returns - set this directly.
|
|
2923
|
+
|
|
2924
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2925
|
+
<a name="ElementService+isVisible"></a>
|
|
2926
|
+
|
|
2927
|
+
### elementService.isVisible
|
|
2928
|
+
What checkVisibility() returns - set this directly.
|
|
2929
|
+
|
|
2930
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2931
|
+
<a name="ElementService+localName"></a>
|
|
2932
|
+
|
|
2933
|
+
### elementService.localName ⇒ <code>string</code>
|
|
2934
|
+
The local part of the element's qualified name. There is no real namespace parsing here, so this is always the
|
|
2935
|
+
same as tagName.
|
|
2936
|
+
|
|
2937
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2938
|
+
<a name="ElementService+prefix"></a>
|
|
2939
|
+
|
|
2940
|
+
### elementService.prefix ⇒ <code>string</code> \| <code>null</code>
|
|
2941
|
+
The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is
|
|
2942
|
+
always null.
|
|
2943
|
+
|
|
2944
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2945
|
+
<a name="ElementService+innerHTML"></a>
|
|
2946
|
+
|
|
2947
|
+
### elementService.innerHTML ⇒ <code>string</code>
|
|
2948
|
+
The HTML markup of this element's children. Only the getter is here (the setter, which needs to build new
|
|
2949
|
+
elements from parsed HTML, is on HTMLElementService - see its class comment).
|
|
2950
|
+
|
|
2951
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2952
|
+
<a name="ElementService+outerHTML"></a>
|
|
2953
|
+
|
|
2954
|
+
### elementService.outerHTML ⇒ <code>string</code>
|
|
2955
|
+
The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).
|
|
2956
|
+
|
|
2957
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2331
2958
|
<a name="ElementService+children"></a>
|
|
2332
2959
|
|
|
2333
2960
|
### elementService.children ⇒ <code>PseudoHTMLCollection</code>
|
|
@@ -2363,6 +2990,13 @@ The sibling after this one which is an element, or null when there is none.
|
|
|
2363
2990
|
### elementService.previousElementSibling ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2364
2991
|
The sibling before this one which is an element, or null when there is none.
|
|
2365
2992
|
|
|
2993
|
+
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2994
|
+
<a name="ElementService+shadowRoot"></a>
|
|
2995
|
+
|
|
2996
|
+
### elementService.shadowRoot ⇒ <code>PseudoShadowRoot</code> \| <code>null</code>
|
|
2997
|
+
This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is
|
|
2998
|
+
'closed' - it still exists, but is not reachable this way, like the DOM's).
|
|
2999
|
+
|
|
2366
3000
|
**Kind**: instance property of [<code>ElementService</code>](#ElementService)
|
|
2367
3001
|
<a name="ElementService+currentAttributes"></a>
|
|
2368
3002
|
|
|
@@ -2538,6 +3172,169 @@ Remove an attribute from the element.
|
|
|
2538
3172
|
| --- | --- |
|
|
2539
3173
|
| attributeName | <code>string</code> |
|
|
2540
3174
|
|
|
3175
|
+
<a name="ElementService+getAttributeNames"></a>
|
|
3176
|
+
|
|
3177
|
+
### elementService.getAttributeNames() ⇒ <code>Array.<string></code>
|
|
3178
|
+
The name of every attribute on the element, in the order they were set.
|
|
3179
|
+
|
|
3180
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3181
|
+
<a name="ElementService+hasAttributes"></a>
|
|
3182
|
+
|
|
3183
|
+
### elementService.hasAttributes() ⇒ <code>boolean</code>
|
|
3184
|
+
Whether the element has any attributes at all.
|
|
3185
|
+
|
|
3186
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3187
|
+
<a name="ElementService+toggleAttribute"></a>
|
|
3188
|
+
|
|
3189
|
+
### elementService.toggleAttribute(attributeName, [force]) ⇒ <code>boolean</code>
|
|
3190
|
+
Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says
|
|
3191
|
+
which of those to do instead. Returns whether the attribute is present after the call.
|
|
3192
|
+
|
|
3193
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3194
|
+
|
|
3195
|
+
| Param | Type |
|
|
3196
|
+
| --- | --- |
|
|
3197
|
+
| attributeName | <code>string</code> |
|
|
3198
|
+
| [force] | <code>boolean</code> |
|
|
3199
|
+
|
|
3200
|
+
<a name="ElementService+getBoundingClientRect"></a>
|
|
3201
|
+
|
|
3202
|
+
### elementService.getBoundingClientRect() ⇒ <code>DOMRect</code>
|
|
3203
|
+
The size of the element and its position, settable directly - there is no layout engine here to compute it.
|
|
3204
|
+
|
|
3205
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3206
|
+
<a name="ElementService+getClientRects"></a>
|
|
3207
|
+
|
|
3208
|
+
### elementService.getClientRects() ⇒ <code>Array.<DOMRect></code>
|
|
3209
|
+
The bounding rectangles for each line of text in the element, settable directly - there is no layout engine
|
|
3210
|
+
here to compute it.
|
|
3211
|
+
|
|
3212
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3213
|
+
<a name="ElementService+getAnimations"></a>
|
|
3214
|
+
|
|
3215
|
+
### elementService.getAnimations() ⇒ <code>Array.<\*></code>
|
|
3216
|
+
The Animation objects currently active on the element, settable directly - there is no animation engine here.
|
|
3217
|
+
|
|
3218
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3219
|
+
<a name="ElementService+checkVisibility"></a>
|
|
3220
|
+
|
|
3221
|
+
### elementService.checkVisibility() ⇒ <code>boolean</code>
|
|
3222
|
+
Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
|
|
3223
|
+
|
|
3224
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3225
|
+
<a name="ElementService+computedStyleMap"></a>
|
|
3226
|
+
|
|
3227
|
+
### elementService.computedStyleMap() ⇒ <code>Object</code>
|
|
3228
|
+
A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a
|
|
3229
|
+
real computed style - just what the element's own style object holds).
|
|
3230
|
+
|
|
3231
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3232
|
+
<a name="ElementService+hasPointerCapture"></a>
|
|
3233
|
+
|
|
3234
|
+
### elementService.hasPointerCapture(pointerId) ⇒ <code>boolean</code>
|
|
3235
|
+
Whether this element currently has capture of the given pointer.
|
|
3236
|
+
|
|
3237
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3238
|
+
|
|
3239
|
+
| Param | Type |
|
|
3240
|
+
| --- | --- |
|
|
3241
|
+
| pointerId | <code>number</code> |
|
|
3242
|
+
|
|
3243
|
+
<a name="ElementService+setPointerCapture"></a>
|
|
3244
|
+
|
|
3245
|
+
### elementService.setPointerCapture(pointerId) ⇒ <code>undefined</code>
|
|
3246
|
+
Give this element capture of the given pointer.
|
|
3247
|
+
|
|
3248
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3249
|
+
|
|
3250
|
+
| Param | Type |
|
|
3251
|
+
| --- | --- |
|
|
3252
|
+
| pointerId | <code>number</code> |
|
|
3253
|
+
|
|
3254
|
+
<a name="ElementService+releasePointerCapture"></a>
|
|
3255
|
+
|
|
3256
|
+
### elementService.releasePointerCapture(pointerId) ⇒ <code>undefined</code>
|
|
3257
|
+
Release this element's capture of the given pointer, if it had it.
|
|
3258
|
+
|
|
3259
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3260
|
+
|
|
3261
|
+
| Param | Type |
|
|
3262
|
+
| --- | --- |
|
|
3263
|
+
| pointerId | <code>number</code> |
|
|
3264
|
+
|
|
3265
|
+
<a name="ElementService+scroll"></a>
|
|
3266
|
+
|
|
3267
|
+
### elementService.scroll([x], [y]) ⇒ <code>undefined</code>
|
|
3268
|
+
Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable
|
|
3269
|
+
viewport here: this just sets scrollLeft / scrollTop.
|
|
3270
|
+
|
|
3271
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3272
|
+
|
|
3273
|
+
| Param | Type | Default |
|
|
3274
|
+
| --- | --- | --- |
|
|
3275
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3276
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3277
|
+
|
|
3278
|
+
<a name="ElementService+scrollTo"></a>
|
|
3279
|
+
|
|
3280
|
+
### elementService.scrollTo([x], [y]) ⇒ <code>undefined</code>
|
|
3281
|
+
Scroll to the given position. An alias for scroll.
|
|
3282
|
+
|
|
3283
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3284
|
+
|
|
3285
|
+
| Param | Type | Default |
|
|
3286
|
+
| --- | --- | --- |
|
|
3287
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3288
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3289
|
+
|
|
3290
|
+
<a name="ElementService+scrollBy"></a>
|
|
3291
|
+
|
|
3292
|
+
### elementService.scrollBy([x], [y]) ⇒ <code>undefined</code>
|
|
3293
|
+
Scroll by the given amount, relative to the current position.
|
|
3294
|
+
|
|
3295
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3296
|
+
|
|
3297
|
+
| Param | Type | Default |
|
|
3298
|
+
| --- | --- | --- |
|
|
3299
|
+
| [x] | <code>number</code> \| <code>Object</code> | <code>0</code> |
|
|
3300
|
+
| [y] | <code>number</code> | <code>0</code> |
|
|
3301
|
+
|
|
3302
|
+
<a name="ElementService+scrollIntoView"></a>
|
|
3303
|
+
|
|
3304
|
+
### elementService.scrollIntoView() ⇒ <code>undefined</code>
|
|
3305
|
+
Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so
|
|
3306
|
+
this does nothing (override it on an instance in a test which needs to observe the call).
|
|
3307
|
+
|
|
3308
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3309
|
+
<a name="ElementService+requestFullscreen"></a>
|
|
3310
|
+
|
|
3311
|
+
### elementService.requestFullscreen() ⇒ <code>Promise.<void></code>
|
|
3312
|
+
Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just
|
|
3313
|
+
resolves, like a browser granting the request would.
|
|
3314
|
+
|
|
3315
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3316
|
+
<a name="ElementService+requestPointerLock"></a>
|
|
3317
|
+
|
|
3318
|
+
### elementService.requestPointerLock() ⇒ <code>Promise.<void></code>
|
|
3319
|
+
Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this
|
|
3320
|
+
just resolves, like a browser granting the request would.
|
|
3321
|
+
|
|
3322
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3323
|
+
<a name="ElementService+attachShadow"></a>
|
|
3324
|
+
|
|
3325
|
+
### elementService.attachShadow(options) ⇒ <code>PseudoShadowRoot</code>
|
|
3326
|
+
Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
|
|
3327
|
+
|
|
3328
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
3329
|
+
**Throws**:
|
|
3330
|
+
|
|
3331
|
+
- <code>Error</code>
|
|
3332
|
+
|
|
3333
|
+
|
|
3334
|
+
| Param | Type |
|
|
3335
|
+
| --- | --- |
|
|
3336
|
+
| options | <code>Object</code> |
|
|
3337
|
+
|
|
2541
3338
|
<a name="DocumentService"></a>
|
|
2542
3339
|
|
|
2543
3340
|
## DocumentService ⇐ [<code>NodeService</code>](#NodeService)
|
|
@@ -2567,6 +3364,7 @@ Simulate the behaviour of the Document Class when there is no DOM available.
|
|
|
2567
3364
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
2568
3365
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
2569
3366
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3367
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
2570
3368
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2571
3369
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
2572
3370
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -2788,6 +3586,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
2788
3586
|
| --- | --- |
|
|
2789
3587
|
| className | <code>string</code> |
|
|
2790
3588
|
|
|
3589
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
3590
|
+
|
|
3591
|
+
### documentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3592
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
3593
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
3594
|
+
|
|
3595
|
+
**Kind**: instance method of [<code>DocumentService</code>](#DocumentService)
|
|
3596
|
+
|
|
3597
|
+
| Param | Type | Description |
|
|
3598
|
+
| --- | --- | --- |
|
|
3599
|
+
| namespace | <code>string</code> | Ignored |
|
|
3600
|
+
| tagName | <code>string</code> | |
|
|
3601
|
+
|
|
2791
3602
|
<a name="NodeService+querySelector"></a>
|
|
2792
3603
|
|
|
2793
3604
|
### documentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -2955,6 +3766,7 @@ not part of a tree, when it is inserted its children are moved into the tree ins
|
|
|
2955
3766
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
2956
3767
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
2957
3768
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3769
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
2958
3770
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
2959
3771
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
2960
3772
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -3137,6 +3949,19 @@ Every element below this node which has all of the given (space separated) class
|
|
|
3137
3949
|
| --- | --- |
|
|
3138
3950
|
| className | <code>string</code> |
|
|
3139
3951
|
|
|
3952
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
3953
|
+
|
|
3954
|
+
### documentFragmentService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3955
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
3956
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
3957
|
+
|
|
3958
|
+
**Kind**: instance method of [<code>DocumentFragmentService</code>](#DocumentFragmentService)
|
|
3959
|
+
|
|
3960
|
+
| Param | Type | Description |
|
|
3961
|
+
| --- | --- | --- |
|
|
3962
|
+
| namespace | <code>string</code> | Ignored |
|
|
3963
|
+
| tagName | <code>string</code> | |
|
|
3964
|
+
|
|
3140
3965
|
<a name="NodeService+querySelector"></a>
|
|
3141
3966
|
|
|
3142
3967
|
### documentFragmentService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -3501,6 +4326,7 @@ Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
|
3501
4326
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
3502
4327
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3503
4328
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4329
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
3504
4330
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
3505
4331
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
3506
4332
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -3697,6 +4523,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
3697
4523
|
| --- | --- |
|
|
3698
4524
|
| className | <code>string</code> |
|
|
3699
4525
|
|
|
4526
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
4527
|
+
|
|
4528
|
+
### attrService.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4529
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
4530
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
4531
|
+
|
|
4532
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
4533
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
4534
|
+
|
|
4535
|
+
| Param | Type | Description |
|
|
4536
|
+
| --- | --- | --- |
|
|
4537
|
+
| namespace | <code>string</code> | Ignored |
|
|
4538
|
+
| tagName | <code>string</code> | |
|
|
4539
|
+
|
|
3700
4540
|
<a name="NodeService+querySelector"></a>
|
|
3701
4541
|
|
|
3702
4542
|
### attrService.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -3923,6 +4763,7 @@ createComment, createDocumentFragment, getElementById, textContent always null).
|
|
|
3923
4763
|
* [.toChildNode(value)](#NodeService+toChildNode) ⇒ <code>PseudoNode</code>
|
|
3924
4764
|
* [.getElementsByTagName(tagName)](#NodeService+getElementsByTagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
3925
4765
|
* [.getElementsByClassName(className)](#NodeService+getElementsByClassName) ⇒ <code>PseudoHTMLCollection</code>
|
|
4766
|
+
* [.getElementsByTagNameNS(namespace, tagName)](#NodeService+getElementsByTagNameNS) ⇒ <code>PseudoHTMLCollection</code>
|
|
3926
4767
|
* [.querySelector(selectors)](#NodeService+querySelector) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
3927
4768
|
* [.querySelectorAll(selectors)](#NodeService+querySelectorAll) ⇒ <code>Array.<PseudoElement></code>
|
|
3928
4769
|
* [.childInserted(child)](#NodeService+childInserted)
|
|
@@ -4192,6 +5033,20 @@ Every element below this node which has all of the given (space separated) class
|
|
|
4192
5033
|
| --- | --- |
|
|
4193
5034
|
| className | <code>string</code> |
|
|
4194
5035
|
|
|
5036
|
+
<a name="NodeService+getElementsByTagNameNS"></a>
|
|
5037
|
+
|
|
5038
|
+
### pseudoHTMLDocument.getElementsByTagNameNS(namespace, tagName) ⇒ <code>PseudoHTMLCollection</code>
|
|
5039
|
+
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
|
|
5040
|
+
ignores the namespace and behaves exactly like getElementsByTagName.
|
|
5041
|
+
|
|
5042
|
+
**Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
5043
|
+
**Overrides**: [<code>getElementsByTagNameNS</code>](#NodeService+getElementsByTagNameNS)
|
|
5044
|
+
|
|
5045
|
+
| Param | Type | Description |
|
|
5046
|
+
| --- | --- | --- |
|
|
5047
|
+
| namespace | <code>string</code> | Ignored |
|
|
5048
|
+
| tagName | <code>string</code> | |
|
|
5049
|
+
|
|
4195
5050
|
<a name="NodeService+querySelector"></a>
|
|
4196
5051
|
|
|
4197
5052
|
### pseudoHTMLDocument.querySelector(selectors) ⇒ <code>PseudoElement</code> \| <code>null</code>
|
|
@@ -4547,6 +5402,51 @@ Remember the element which has the focus in a tree.
|
|
|
4547
5402
|
| root | <code>Object</code> | The root node of the tree |
|
|
4548
5403
|
| element | <code>Object</code> \| <code>null</code> | The element which now has the focus, or null when nothing has it |
|
|
4549
5404
|
|
|
5405
|
+
<a name="escapeText"></a>
|
|
5406
|
+
|
|
5407
|
+
## escapeText(text) ⇒ <code>string</code>
|
|
5408
|
+
Escape text so it is safe inside HTML text content.
|
|
5409
|
+
|
|
5410
|
+
**Kind**: global function
|
|
5411
|
+
|
|
5412
|
+
| Param | Type |
|
|
5413
|
+
| --- | --- |
|
|
5414
|
+
| text | <code>string</code> |
|
|
5415
|
+
|
|
5416
|
+
<a name="escapeAttributeValue"></a>
|
|
5417
|
+
|
|
5418
|
+
## escapeAttributeValue(value) ⇒ <code>string</code>
|
|
5419
|
+
Escape a value so it is safe inside a double-quoted HTML attribute.
|
|
5420
|
+
|
|
5421
|
+
**Kind**: global function
|
|
5422
|
+
|
|
5423
|
+
| Param | Type |
|
|
5424
|
+
| --- | --- |
|
|
5425
|
+
| value | <code>string</code> |
|
|
5426
|
+
|
|
5427
|
+
<a name="serializeAttributes"></a>
|
|
5428
|
+
|
|
5429
|
+
## serializeAttributes(element) ⇒ <code>string</code>
|
|
5430
|
+
Every attribute of the element, serialized (class instead of className, boolean attributes bare, the never-real
|
|
5431
|
+
mock properties left out, style added from the live CSSStyleDeclaration when it is not empty).
|
|
5432
|
+
|
|
5433
|
+
**Kind**: global function
|
|
5434
|
+
|
|
5435
|
+
| Param | Type |
|
|
5436
|
+
| --- | --- |
|
|
5437
|
+
| element | <code>\*</code> |
|
|
5438
|
+
|
|
5439
|
+
<a name="serializeNode"></a>
|
|
5440
|
+
|
|
5441
|
+
## serializeNode(node) ⇒ <code>string</code>
|
|
5442
|
+
One node, serialized (its own markup only - see serializeChildren for its descendants too).
|
|
5443
|
+
|
|
5444
|
+
**Kind**: global function
|
|
5445
|
+
|
|
5446
|
+
| Param | Type |
|
|
5447
|
+
| --- | --- |
|
|
5448
|
+
| node | <code>\*</code> |
|
|
5449
|
+
|
|
4550
5450
|
<a name="generateNodeList"></a>
|
|
4551
5451
|
|
|
4552
5452
|
## generateNodeList([innerList]) ⇒ [<code>PseudoNodeList</code>](#PseudoNodeList)
|