pseudo-dom 0.11.0 → 0.14.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 +221 -105
- package/browser/pseudo-dom.js +889 -501
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/factories/generateDocument.js +27 -10
- package/dist/factories/generateDocument.min.js +1 -1
- package/dist/factories/installGlobal.d.ts +15 -0
- package/dist/factories/installGlobal.js +44 -0
- package/dist/factories/installGlobal.min.js +1 -0
- package/dist/factories/logElement.d.ts +9 -0
- package/dist/factories/logElement.js +23 -0
- package/dist/factories/logElement.min.js +1 -0
- package/dist/factories/parseHTML.d.ts +13 -13
- package/dist/factories/parseHTML.js +84 -84
- package/dist/factories/serializeHTML.d.ts +25 -15
- package/dist/factories/serializeHTML.js +53 -7
- package/dist/factories/serializeHTML.min.js +1 -1
- package/dist/interfaces/PseudoElement.d.ts +765 -765
- package/dist/main.d.ts +7 -1
- package/dist/main.js +15 -1
- package/dist/main.min.js +1 -1
- package/dist/services/ElementService.d.ts +371 -371
- package/dist/services/ElementService.js +732 -732
- package/dist/services/HTMLElementService.d.ts +119 -119
- package/dist/services/HTMLElementService.js +269 -269
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,99 +1,175 @@
|
|
|
1
1
|
# Pseudo DOM
|
|
2
2
|
|
|
3
|
-
Mock the DOM for server
|
|
3
|
+
Mock the DOM for server-side DOM state and in tests.
|
|
4
4
|
|
|
5
5
|
## Status: early development (0.x)
|
|
6
6
|
|
|
7
|
-
Pseudo DOM recreates the browser DOM API (following the MDN documentation) so DOM-dependent code can run in Node
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`generateDocument`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
7
|
+
Pseudo DOM recreates the browser DOM API (following the MDN documentation) so DOM-dependent code can run in Node -
|
|
8
|
+
in tests, without a real or headless browser. It's written in TypeScript and ships type definitions. The API will
|
|
9
|
+
change before 1.0.
|
|
10
|
+
|
|
11
|
+
## At a glance
|
|
12
|
+
|
|
13
|
+
- **Tree & events** - a real node tree with full event dispatch (capture → target → bubble) and standard event
|
|
14
|
+
defaults for clicks, focus and more
|
|
15
|
+
- **Elements** - attributes, `classList`, a real live `style` and `dataset`, `children`, and DOM-style mutation
|
|
16
|
+
(`append`, `before`, `remove`, `replaceWith`, ...)
|
|
17
|
+
- **HTML parsing** - `innerHTML` / `outerHTML` / `insertAdjacentHTML` parse and serialize real HTML
|
|
18
|
+
- **Queries** - `querySelector` / `querySelectorAll` with real CSS selectors, `getElementById`, `matches`, `closest`
|
|
19
|
+
- **Document** - `createElement`, `createTextNode`, and `generateDocument()` to get a `window`-like object with
|
|
20
|
+
`document` already on it
|
|
21
|
+
- **Cloning & comparison** - `cloneNode`, `isEqualNode`, `compareDocumentPosition`, `contains`
|
|
22
|
+
- **Running headlessly** - `installGlobal()` makes code written against real DOM globals (`document.createElement`,
|
|
23
|
+
...) run unmodified in Node; `logElement()` prints a readable, indented view of an element to the console
|
|
24
|
+
|
|
25
|
+
Everything below goes into more detail, section by section.
|
|
26
|
+
|
|
27
|
+
## Tree, nodes & events
|
|
28
|
+
|
|
29
|
+
A real tree: `parentNode`, `previousSibling` / `nextSibling`, `firstChild` / `lastChild`, `appendChild`,
|
|
30
|
+
`insertBefore`, `removeChild`, `replaceChild`, `contains`, `getRootNode`. Nodes move when they're added somewhere
|
|
31
|
+
else, document fragments insert their children instead of themselves, and a node can't be put inside itself.
|
|
32
|
+
|
|
33
|
+
`EventService` / `EventTargetService` dispatch an event through the tree the way the DOM does:
|
|
34
|
+
|
|
35
|
+
- Capture down from the root, hit the target, then bubble back up
|
|
36
|
+
- `stopPropagation`, `stopImmediatePropagation`, `once`, `passive`, `preventDefault`, and the target's default action
|
|
37
|
+
(clicking a submit button sends a `submit` event to its form)
|
|
38
|
+
- `createEvent(type, init, { browser, trusted })` makes the kind of event that suits the type (a click is a
|
|
39
|
+
`MouseEvent`, a keydown a `KeyboardEvent`, ...). Like a real constructor, it gives nothing (no bubbling, no
|
|
40
|
+
cancelling, not trusted) unless asked - but `browser: true` applies `eventDefaults`, the table of how a browser
|
|
41
|
+
creates each standard type (click bubbles and can be cancelled; focus doesn't bubble but focusin does; input
|
|
42
|
+
bubbles but can't be cancelled; ...), and `trusted: true` makes `isTrusted` true, as for a real user action
|
|
43
|
+
- The event kinds: `PseudoUIEvent`, `PseudoMouseEvent`, `PseudoPointerEvent`, `PseudoKeyboardEvent`,
|
|
44
|
+
`PseudoFocusEvent`, `PseudoInputEvent`, `PseudoCustomEvent`
|
|
45
|
+
- Elements have `click()` (an untrusted click, like a script's) and `focus()` / `blur()` (blur/focusout/focus/focusin
|
|
46
|
+
and the related targets, with a focused element tracked per tree)
|
|
47
|
+
- `simulate.click(element)` / `simulate.keyPress(element, key)` send what a real user action sends - pointerdown,
|
|
48
|
+
mousedown, the focus moving, pointerup, mouseup, click; keydown, keyup - all trusted
|
|
49
|
+
|
|
50
|
+
## Elements
|
|
51
|
+
|
|
52
|
+
`ElementService` / `HTMLElementService` cover `Element` and `HTMLElement`: attributes, `NamedNodeMap`, `classList`.
|
|
53
|
+
`AttrService`, `DOMTokenListService` and `NamedNodeMapService` back them.
|
|
54
|
+
|
|
55
|
+
**Attribute helpers** work like the DOM's: `getAttributeNames`, `hasAttributes`, `toggleAttribute(name, [force])`.
|
|
56
|
+
`localName` matches `tagName` and `prefix` is always `null` (there's no real namespace parsing);
|
|
57
|
+
`getElementsByTagNameNS` behaves exactly like `getElementsByTagName`, ignoring the namespace.
|
|
58
|
+
|
|
59
|
+
**`style`** is a real, live `CSSStyleDeclaration`:
|
|
60
|
+
|
|
61
|
+
- Named property access (`el.style.backgroundColor = 'red'`) alongside `getPropertyValue` / `setProperty` /
|
|
62
|
+
`removeProperty` / `getPropertyPriority` / `cssText`
|
|
63
|
+
- An unset property reads as `''`, like the DOM's
|
|
64
|
+
|
|
65
|
+
**`dataset`** is a live `DOMStringMap`: reading/writing/deleting a camelCase name (`el.dataset.fooBar`)
|
|
66
|
+
reads/writes/removes the matching `data-foo-bar` attribute directly, so it can never fall out of sync with the
|
|
67
|
+
attributes themselves.
|
|
68
|
+
|
|
69
|
+
*(`style` and `dataset` are both on `HTMLElementService`, matching the DOM - they're not on the base `Element`.)*
|
|
70
|
+
|
|
71
|
+
**Traversal & mutation** work like the DOM's:
|
|
72
|
+
|
|
73
|
+
- `children` is a live `HTMLCollection` of just the element children; `childElementCount`, `firstElementChild` /
|
|
74
|
+
`lastElementChild` and `nextElementSibling` / `previousElementSibling` skip text and comment nodes
|
|
75
|
+
- `append` / `prepend` / `before` / `after` / `remove` / `replaceWith` / `replaceChildren` accept nodes or strings (a
|
|
76
|
+
string becomes a text node), and move a node already in a tree rather than duplicating it
|
|
77
|
+
- `insertAdjacentElement` / `insertAdjacentText` / `insertAdjacentHTML` insert at beforebegin / afterbegin /
|
|
78
|
+
beforeend / afterend
|
|
79
|
+
|
|
80
|
+
**`attachShadow({mode})`** attaches a real (`DocumentFragmentService`-based) `ShadowRoot`, with `host` and `mode`
|
|
81
|
+
set. `element.shadowRoot` reaches it when the mode is `'open'`, like the DOM's (a `'closed'` one still exists, just
|
|
82
|
+
not reachable this way); attaching a second one throws.
|
|
83
|
+
|
|
84
|
+
### HTML parsing
|
|
85
|
+
|
|
86
|
+
`innerHTML` / `outerHTML` / `insertAdjacentHTML` parse and serialize real HTML, via
|
|
87
|
+
[htmlparser2](https://www.npmjs.com/package/htmlparser2) (a SAX-style tokenizer - pseudo-dom builds its own nodes
|
|
88
|
+
from its events, the same way it builds matches from `css-select`).
|
|
89
|
+
|
|
90
|
+
- Entities decode, and void elements (`br`, `img`, ...) auto-close
|
|
91
|
+
- `class` / `style` attributes populate `className` / `classList` and `style` for real, not just a generic attribute
|
|
92
|
+
- The setters (`innerHTML =`, `outerHTML =`) and `insertAdjacentHTML` are on `HTMLElementService` (building new
|
|
93
|
+
elements needs a concrete element class); `ElementService` only has the getters, since serializing doesn't
|
|
94
|
+
|
|
95
|
+
### Layout (mocked, not computed)
|
|
96
|
+
|
|
97
|
+
There's no layout engine, so anything that would need one is **settable directly** rather than really computed - set
|
|
98
|
+
the value a test needs, and the getter/method returns it:
|
|
99
|
+
|
|
100
|
+
- `clientWidth` / `clientHeight` / `clientTop` / `clientLeft` / `scrollWidth` / `scrollHeight` (plain numbers,
|
|
101
|
+
alongside the existing `offsetWidth` etc.)
|
|
102
|
+
- `boundingClientRect` backs `getBoundingClientRect()`, `clientRects` backs `getClientRects()`, `animations` backs
|
|
103
|
+
`getAnimations()`, `isVisible` backs `checkVisibility()`
|
|
104
|
+
|
|
105
|
+
A few things in this group are genuinely real, not mocked:
|
|
106
|
+
|
|
107
|
+
- `scrollLeft` / `scrollTop` are plain settable numbers, and `scroll` / `scrollTo` / `scrollBy` (a number pair or an
|
|
108
|
+
options object) update them for real; `scrollIntoView` is a callable no-op (there's no viewport to scroll within)
|
|
109
|
+
- `hasPointerCapture` / `setPointerCapture` / `releasePointerCapture` genuinely track capture per pointer id
|
|
110
|
+
- `requestFullscreen` / `requestPointerLock` resolve, like a browser granting the request would
|
|
111
|
+
- `computedStyleMap()` is a thin read-only view of the element's own inline style (there's no CSS cascade)
|
|
112
|
+
|
|
113
|
+
## Queries
|
|
114
|
+
|
|
115
|
+
`getElementsByTagName` / `getElementsByClassName` (live, on any node) and `querySelector` / `querySelectorAll` (real
|
|
116
|
+
CSS selectors, via [css-select](https://www.npmjs.com/package/css-select) matched against pseudo-dom's own tree
|
|
117
|
+
through a custom adapter) are on `NodeService`, so `Document`, `DocumentFragment` and `Element` all have them.
|
|
118
|
+
`querySelectorAll` returns a plain array - a snapshot taken when it's called, like the DOM's.
|
|
119
|
+
|
|
120
|
+
`matches` / `closest` are on `ElementService`. `getElementById` is on both `DocumentService` and
|
|
121
|
+
`DocumentFragmentService` (the DOM's `NonElementParentNode` mixin, so a `ShadowRoot` gets it too).
|
|
122
|
+
|
|
123
|
+
## Document
|
|
124
|
+
|
|
125
|
+
`DocumentService` matches the real `Document` - it's not an `Element`, so it has no `tagName` / `classList` /
|
|
126
|
+
`matches` / etc:
|
|
127
|
+
|
|
128
|
+
- `createElement`, `createTextNode`, `createComment`, `createDocumentFragment`
|
|
129
|
+
- `getElementById`
|
|
130
|
+
- `textContent` is always `null`
|
|
131
|
+
|
|
132
|
+
`DocumentFragmentService` is the plain `DocumentFragment`. `PseudoHTMLDocument` - what `generateDocument()` actually
|
|
133
|
+
creates - only adds the `html` / `head` / `body` structure on top of `DocumentService`. `PseudoNodeList` backs
|
|
134
|
+
`childNodes`.
|
|
135
|
+
|
|
136
|
+
## Running headlessly
|
|
137
|
+
|
|
138
|
+
Code written against a real DOM's globals (`document.createElement`, `new Node()`, ...) can run unmodified in Node,
|
|
139
|
+
without an `if (typeof document === 'undefined')` check at every call site:
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
if (typeof document === 'undefined') {
|
|
143
|
+
require('pseudo-dom').installGlobal(globalThis)
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`installGlobal(target = globalThis)` fills in `document` / `Node` / `Element` / `HTMLElement` / `HTMLDocument` /
|
|
148
|
+
`window` (a self-reference, like a real browser's) on `target`, using
|
|
149
|
+
[browser-or-node](https://www.npmjs.com/package/browser-or-node) to check whether a real DOM (a real browser, or a
|
|
150
|
+
jsdom-based test environment) is already there first - it's always safe to call, everywhere: it does nothing when
|
|
151
|
+
one is. `Node` / `Element` / `HTMLElement` / `HTMLDocument` are the classes themselves (not instances), so
|
|
152
|
+
`x instanceof Element` works, matching the real DOM's.
|
|
153
|
+
|
|
154
|
+
There's no real rendering to look at, so `logElement(node, [label])` prints a readable, indented view of a node's
|
|
155
|
+
markup to the console (`prettyPrint(node, [indent])`, from the same module, returns the string instead of printing
|
|
156
|
+
it) - useful for watching pseudo-dom-driven code run, or checking a final result, from a terminal.
|
|
157
|
+
|
|
158
|
+
## Cloning, comparison & connection
|
|
159
|
+
|
|
160
|
+
- `cloneNode(deep)` copies an element with its attributes (objects such as `style` are copied too, not shared) and,
|
|
161
|
+
when deep, everything below it - without the parent or the event listeners
|
|
162
|
+
- `isEqualNode` compares two nodes by what they hold (tag, attributes in any order, text and children in order)
|
|
163
|
+
- `compareDocumentPosition` says where another node is (`NodeService.DOCUMENT_POSITION_*`)
|
|
164
|
+
- `isConnected` is true when the tree has a document at the top; `ownerDocument` says which one made the node
|
|
165
|
+
- `normalize` joins neighbouring text nodes
|
|
166
|
+
- There are text and comment nodes (`PseudoText`, `PseudoComment`); `textContent` works like the DOM's (the text of
|
|
167
|
+
everything below, and setting it replaces the children with a text node)
|
|
168
|
+
|
|
169
|
+
## Not implemented yet
|
|
170
|
+
|
|
171
|
+
- The `aria*` reflected properties
|
|
172
|
+
- The `Attr`-node / namespaced attribute methods (`getAttributeNode`, `getAttributeNS`, ...)
|
|
97
173
|
## Modules
|
|
98
174
|
|
|
99
175
|
<dl>
|
|
@@ -243,10 +319,14 @@ order in which an event travels down through them). A node which has no parent h
|
|
|
243
319
|
<dd><p>Remember the element which has the focus in a tree.</p>
|
|
244
320
|
</dd>
|
|
245
321
|
<dt><a href="#escapeText">escapeText(text)</a> ⇒ <code>string</code></dt>
|
|
246
|
-
<dd><p>Escape text so it is safe inside HTML text content
|
|
322
|
+
<dd><p>Escape text so it is safe inside HTML text content. Coerces to a string first - unlike a real DOM, pseudo-dom's
|
|
323
|
+
setAttribute does not itself coerce (see the same note on escapeAttributeValue), and nodeValue is not guaranteed
|
|
324
|
+
to be a string either.</p>
|
|
247
325
|
</dd>
|
|
248
326
|
<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
|
|
327
|
+
<dd><p>Escape a value so it is safe inside a double-quoted HTML attribute. Coerces to a string first: a real DOM's
|
|
328
|
+
setAttribute always stores a string, however pseudo-dom's does not coerce what it is given, so a value set via
|
|
329
|
+
setAttribute(name, 5) is stored (and read back by getAttribute) as the number 5, not the string '5'.</p>
|
|
250
330
|
</dd>
|
|
251
331
|
<dt><a href="#serializeAttributes">serializeAttributes(element)</a> ⇒ <code>string</code></dt>
|
|
252
332
|
<dd><p>Every attribute of the element, serialized (class instead of className, boolean attributes bare, the never-real
|
|
@@ -255,6 +335,10 @@ mock properties left out, style added from the live CSSStyleDeclaration when it
|
|
|
255
335
|
<dt><a href="#serializeNode">serializeNode(node)</a> ⇒ <code>string</code></dt>
|
|
256
336
|
<dd><p>One node, serialized (its own markup only - see serializeChildren for its descendants too).</p>
|
|
257
337
|
</dd>
|
|
338
|
+
<dt><a href="#prettyPrintNode">prettyPrintNode(node, depth, indent)</a> ⇒ <code>string</code></dt>
|
|
339
|
+
<dd><p>One node, indented for readability (see prettyPrint) - unlike serializeNode, every non-empty node is its own
|
|
340
|
+
line, so the structure of a whole tree is easy to read at a glance.</p>
|
|
341
|
+
</dd>
|
|
258
342
|
<dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
|
|
259
343
|
<dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
|
|
260
344
|
</dd>
|
|
@@ -5405,24 +5489,28 @@ Remember the element which has the focus in a tree.
|
|
|
5405
5489
|
<a name="escapeText"></a>
|
|
5406
5490
|
|
|
5407
5491
|
## escapeText(text) ⇒ <code>string</code>
|
|
5408
|
-
Escape text so it is safe inside HTML text content.
|
|
5492
|
+
Escape text so it is safe inside HTML text content. Coerces to a string first - unlike a real DOM, pseudo-dom's
|
|
5493
|
+
setAttribute does not itself coerce (see the same note on escapeAttributeValue), and nodeValue is not guaranteed
|
|
5494
|
+
to be a string either.
|
|
5409
5495
|
|
|
5410
5496
|
**Kind**: global function
|
|
5411
5497
|
|
|
5412
5498
|
| Param | Type |
|
|
5413
5499
|
| --- | --- |
|
|
5414
|
-
| text | <code
|
|
5500
|
+
| text | <code>\*</code> |
|
|
5415
5501
|
|
|
5416
5502
|
<a name="escapeAttributeValue"></a>
|
|
5417
5503
|
|
|
5418
5504
|
## escapeAttributeValue(value) ⇒ <code>string</code>
|
|
5419
|
-
Escape a value so it is safe inside a double-quoted HTML attribute.
|
|
5505
|
+
Escape a value so it is safe inside a double-quoted HTML attribute. Coerces to a string first: a real DOM's
|
|
5506
|
+
setAttribute always stores a string, however pseudo-dom's does not coerce what it is given, so a value set via
|
|
5507
|
+
setAttribute(name, 5) is stored (and read back by getAttribute) as the number 5, not the string '5'.
|
|
5420
5508
|
|
|
5421
5509
|
**Kind**: global function
|
|
5422
5510
|
|
|
5423
5511
|
| Param | Type |
|
|
5424
5512
|
| --- | --- |
|
|
5425
|
-
| value | <code
|
|
5513
|
+
| value | <code>\*</code> |
|
|
5426
5514
|
|
|
5427
5515
|
<a name="serializeAttributes"></a>
|
|
5428
5516
|
|
|
@@ -5447,6 +5535,20 @@ One node, serialized (its own markup only - see serializeChildren for its descen
|
|
|
5447
5535
|
| --- | --- |
|
|
5448
5536
|
| node | <code>\*</code> |
|
|
5449
5537
|
|
|
5538
|
+
<a name="prettyPrintNode"></a>
|
|
5539
|
+
|
|
5540
|
+
## prettyPrintNode(node, depth, indent) ⇒ <code>string</code>
|
|
5541
|
+
One node, indented for readability (see prettyPrint) - unlike serializeNode, every non-empty node is its own
|
|
5542
|
+
line, so the structure of a whole tree is easy to read at a glance.
|
|
5543
|
+
|
|
5544
|
+
**Kind**: global function
|
|
5545
|
+
|
|
5546
|
+
| Param | Type |
|
|
5547
|
+
| --- | --- |
|
|
5548
|
+
| node | <code>\*</code> |
|
|
5549
|
+
| depth | <code>number</code> |
|
|
5550
|
+
| indent | <code>string</code> |
|
|
5551
|
+
|
|
5450
5552
|
<a name="generateNodeList"></a>
|
|
5451
5553
|
|
|
5452
5554
|
## generateNodeList([innerList]) ⇒ [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
@@ -5474,9 +5576,10 @@ context.
|
|
|
5474
5576
|
|
|
5475
5577
|
* [generateDocument(root, context)](#generateDocument) ⇒ <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
5476
5578
|
* [~newWindow](#generateDocument..newWindow) : <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
5477
|
-
* [~Node](#generateDocument..Node) : <code>
|
|
5478
|
-
* [~Element](#generateDocument..Element) : <code>
|
|
5479
|
-
* [~HTMLElement](#generateDocument..HTMLElement) : <code>
|
|
5579
|
+
* [~Node](#generateDocument..Node) : <code>function</code>
|
|
5580
|
+
* [~Element](#generateDocument..Element) : <code>function</code>
|
|
5581
|
+
* [~HTMLElement](#generateDocument..HTMLElement) : <code>function</code>
|
|
5582
|
+
* [~HTMLDocument](#generateDocument..HTMLDocument) : <code>function</code>
|
|
5480
5583
|
* [~document](#generateDocument..document) : <code>Document</code> \| [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
5481
5584
|
|
|
5482
5585
|
<a name="generateDocument..newWindow"></a>
|
|
@@ -5485,22 +5588,35 @@ context.
|
|
|
5485
5588
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5486
5589
|
<a name="generateDocument..Node"></a>
|
|
5487
5590
|
|
|
5488
|
-
### generateDocument~Node : <code>
|
|
5591
|
+
### generateDocument~Node : <code>function</code>
|
|
5592
|
+
The Node class itself (matching the DOM's window.Node), not an instance - the right-hand side of `instanceof`
|
|
5593
|
+
must be a constructor, so `x instanceof Node` needs this, not `new PseudoNode()`.
|
|
5594
|
+
|
|
5489
5595
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5490
5596
|
<a name="generateDocument..Element"></a>
|
|
5491
5597
|
|
|
5492
|
-
### generateDocument~Element : <code>
|
|
5598
|
+
### generateDocument~Element : <code>function</code>
|
|
5599
|
+
The Element class itself, for the same reason as Node.
|
|
5600
|
+
|
|
5493
5601
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5494
5602
|
<a name="generateDocument..HTMLElement"></a>
|
|
5495
5603
|
|
|
5496
|
-
### generateDocument~HTMLElement : <code>
|
|
5497
|
-
|
|
5604
|
+
### generateDocument~HTMLElement : <code>function</code>
|
|
5605
|
+
The HTMLElement class itself, for the same reason as Node.
|
|
5606
|
+
|
|
5607
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5608
|
+
<a name="generateDocument..HTMLDocument"></a>
|
|
5609
|
+
|
|
5610
|
+
### generateDocument~HTMLDocument : <code>function</code>
|
|
5611
|
+
The HTMLDocument class itself, for the same reason as Node (so `document instanceof HTMLDocument`, a common
|
|
5612
|
+
real-DOM-detection check, works).
|
|
5498
5613
|
|
|
5499
5614
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5500
5615
|
<a name="generateDocument..document"></a>
|
|
5501
5616
|
|
|
5502
5617
|
### generateDocument~document : <code>Document</code> \| [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
5503
|
-
Define document when not available
|
|
5618
|
+
Define document when not available - a real instance, unlike the classes above (window.document IS an object,
|
|
5619
|
+
not a constructor).
|
|
5504
5620
|
|
|
5505
5621
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
5506
5622
|
<a name="nearestElementSibling"></a>
|