pseudo-dom 0.1.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/LICENSE +674 -0
- package/README.md +1029 -0
- package/browser/pseudo-dom.js +5219 -0
- package/browser/pseudo-dom.min.js +1 -0
- package/dist/classes/PseudoEventListener.d.ts +96 -0
- package/dist/classes/PseudoEventListener.js +148 -0
- package/dist/classes/PseudoEventListener.min.js +1 -0
- package/dist/classes/PseudoHTMLDocument.d.ts +35 -0
- package/dist/classes/PseudoHTMLDocument.js +77 -0
- package/dist/classes/PseudoHTMLDocument.min.js +1 -0
- package/dist/classes/PseudoNodeList.d.ts +34 -0
- package/dist/classes/PseudoNodeList.js +65 -0
- package/dist/classes/PseudoNodeList.min.js +1 -0
- package/dist/classes.d.ts +20 -0
- package/dist/classes.js +31 -0
- package/dist/classes.min.js +1 -0
- package/dist/factories/generateDocument.d.ts +11 -0
- package/dist/factories/generateDocument.js +65 -0
- package/dist/factories/generateDocument.min.js +1 -0
- package/dist/factories/generateNode.d.ts +40 -0
- package/dist/factories/generateNode.js +118 -0
- package/dist/factories/generateNode.min.js +1 -0
- package/dist/factories/generateNodeList.d.ts +9 -0
- package/dist/factories/generateNodeList.js +13 -0
- package/dist/factories/generateNodeList.min.js +1 -0
- package/dist/factories.d.ts +5 -0
- package/dist/factories.js +23 -0
- package/dist/factories.min.js +1 -0
- package/dist/functions/getParentNodes.d.ts +9 -0
- package/dist/functions/getParentNodes.js +15 -0
- package/dist/functions/getParentNodes.min.js +1 -0
- package/dist/functions/getParentNodesFromAttribute.d.ts +14 -0
- package/dist/functions/getParentNodesFromAttribute.js +9 -0
- package/dist/functions/getParentNodesFromAttribute.min.js +1 -0
- package/dist/functions.d.ts +5 -0
- package/dist/functions.js +23 -0
- package/dist/functions.min.js +1 -0
- package/dist/interfaces/PseudoAnimation.d.ts +3 -0
- package/dist/interfaces/PseudoAnimation.js +5 -0
- package/dist/interfaces/PseudoAnimation.min.js +1 -0
- package/dist/interfaces/PseudoAttr.d.ts +11 -0
- package/dist/interfaces/PseudoAttr.js +5 -0
- package/dist/interfaces/PseudoAttr.min.js +1 -0
- package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -0
- package/dist/interfaces/PseudoDOMTokenList.js +5 -0
- package/dist/interfaces/PseudoDOMTokenList.min.js +1 -0
- package/dist/interfaces/PseudoDocument.d.ts +3 -0
- package/dist/interfaces/PseudoDocument.js +5 -0
- package/dist/interfaces/PseudoDocument.min.js +1 -0
- package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -0
- package/dist/interfaces/PseudoDocumentFragment.js +5 -0
- package/dist/interfaces/PseudoDocumentFragment.min.js +1 -0
- package/dist/interfaces/PseudoElement.d.ts +678 -0
- package/dist/interfaces/PseudoElement.js +5 -0
- package/dist/interfaces/PseudoElement.min.js +1 -0
- package/dist/interfaces/PseudoEvent.d.ts +79 -0
- package/dist/interfaces/PseudoEvent.js +10 -0
- package/dist/interfaces/PseudoEvent.min.js +1 -0
- package/dist/interfaces/PseudoEventTarget.d.ts +46 -0
- package/dist/interfaces/PseudoEventTarget.js +5 -0
- package/dist/interfaces/PseudoEventTarget.min.js +1 -0
- package/dist/interfaces/PseudoHTMLCollection.d.ts +2 -0
- package/dist/interfaces/PseudoHTMLCollection.js +5 -0
- package/dist/interfaces/PseudoHTMLCollection.min.js +1 -0
- package/dist/interfaces/PseudoHTMLElement.d.ts +22 -0
- package/dist/interfaces/PseudoHTMLElement.js +5 -0
- package/dist/interfaces/PseudoHTMLElement.min.js +1 -0
- package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -0
- package/dist/interfaces/PseudoHTMLSlotElement.js +5 -0
- package/dist/interfaces/PseudoHTMLSlotElement.min.js +1 -0
- package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -0
- package/dist/interfaces/PseudoNamedNodeMap.js +5 -0
- package/dist/interfaces/PseudoNamedNodeMap.min.js +1 -0
- package/dist/interfaces/PseudoNode.d.ts +179 -0
- package/dist/interfaces/PseudoNode.js +5 -0
- package/dist/interfaces/PseudoNode.min.js +1 -0
- package/dist/interfaces/PseudoShadowRoot.d.ts +3 -0
- package/dist/interfaces/PseudoShadowRoot.js +5 -0
- package/dist/interfaces/PseudoShadowRoot.min.js +1 -0
- package/dist/main.d.ts +29 -0
- package/dist/main.js +75 -0
- package/dist/main.min.js +1 -0
- package/dist/services/AnimationService.d.ts +4 -0
- package/dist/services/AnimationService.js +16 -0
- package/dist/services/AnimationService.min.js +1 -0
- package/dist/services/AttrService.d.ts +31 -0
- package/dist/services/AttrService.js +57 -0
- package/dist/services/AttrService.min.js +1 -0
- package/dist/services/DOMTokenListService.d.ts +33 -0
- package/dist/services/DOMTokenListService.js +117 -0
- package/dist/services/DOMTokenListService.min.js +1 -0
- package/dist/services/DocumentFragmentService.d.ts +4 -0
- package/dist/services/DocumentFragmentService.js +9 -0
- package/dist/services/DocumentFragmentService.min.js +1 -0
- package/dist/services/DocumentService.d.ts +4 -0
- package/dist/services/DocumentService.js +9 -0
- package/dist/services/DocumentService.min.js +1 -0
- package/dist/services/ElementService.d.ts +95 -0
- package/dist/services/ElementService.js +205 -0
- package/dist/services/ElementService.min.js +1 -0
- package/dist/services/EventService.d.ts +106 -0
- package/dist/services/EventService.js +216 -0
- package/dist/services/EventService.min.js +1 -0
- package/dist/services/EventTargetService.d.ts +52 -0
- package/dist/services/EventTargetService.js +163 -0
- package/dist/services/EventTargetService.min.js +1 -0
- package/dist/services/HTMLCollectionService.d.ts +3 -0
- package/dist/services/HTMLCollectionService.js +8 -0
- package/dist/services/HTMLCollectionService.min.js +1 -0
- package/dist/services/HTMLElementService.d.ts +37 -0
- package/dist/services/HTMLElementService.js +68 -0
- package/dist/services/HTMLElementService.min.js +1 -0
- package/dist/services/HTMLSlotElementService.d.ts +4 -0
- package/dist/services/HTMLSlotElementService.js +9 -0
- package/dist/services/HTMLSlotElementService.min.js +1 -0
- package/dist/services/NamedNodeMapService.d.ts +23 -0
- package/dist/services/NamedNodeMapService.js +77 -0
- package/dist/services/NamedNodeMapService.min.js +1 -0
- package/dist/services/NodeService.d.ts +111 -0
- package/dist/services/NodeService.js +230 -0
- package/dist/services/NodeService.min.js +1 -0
- package/dist/services/ShadowRootService.d.ts +4 -0
- package/dist/services/ShadowRootService.js +9 -0
- package/dist/services/ShadowRootService.min.js +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,1029 @@
|
|
|
1
|
+
# Pseudo DOM
|
|
2
|
+
|
|
3
|
+
Mock the DOM for server side-side DOM state and in tests.
|
|
4
|
+
|
|
5
|
+
## Status: early development (0.x)
|
|
6
|
+
|
|
7
|
+
Pseudo DOM recreates the browser DOM API (following the MDN documentation) so DOM-dependent code can run in Node, for
|
|
8
|
+
example in tests, without a real or headless browser. It is written in TypeScript and ships type definitions.
|
|
9
|
+
|
|
10
|
+
Working today: `EventService` (Event), `EventTargetService` (EventTarget listeners for the target itself), `NodeService`
|
|
11
|
+
(Node: children, siblings, `appendChild`, `removeChild`), `ElementService` / `HTMLElementService` (Element and
|
|
12
|
+
HTMLElement, including attributes, `NamedNodeMap`, `classList`), `AttrService`, `DOMTokenListService`,
|
|
13
|
+
`NamedNodeMapService`, `PseudoNodeList`, and `generateDocument` for creating a document.
|
|
14
|
+
|
|
15
|
+
Not implemented yet (these throw a "not implemented" error or are missing): event dispatch through the tree (capture,
|
|
16
|
+
target and bubble phases), `cloneNode`, `compareDocumentPosition`, `contains`, `insertBefore`, `isEqualNode`,
|
|
17
|
+
`replaceChild`, `querySelector` / `querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the
|
|
18
|
+
Element and Document APIs. The API will change before 1.0.
|
|
19
|
+
## Modules
|
|
20
|
+
|
|
21
|
+
<dl>
|
|
22
|
+
<dt><a href="#module_pseudoDom/objects">pseudoDom/objects</a> : <code>Object</code></dt>
|
|
23
|
+
<dd><p>All methods exported from this module are encapsulated within pseudoDom.</p>
|
|
24
|
+
</dd>
|
|
25
|
+
</dl>
|
|
26
|
+
|
|
27
|
+
## Classes
|
|
28
|
+
|
|
29
|
+
<dl>
|
|
30
|
+
<dt><a href="#NodeService">NodeService</a> ⇐ <code>PseudoEventTarget</code></dt>
|
|
31
|
+
<dd><p>Simulate the behaviour of the Node Class when there is no DOM available.</p>
|
|
32
|
+
</dd>
|
|
33
|
+
<dt><a href="#NamedNodeMapService">NamedNodeMapService</a></dt>
|
|
34
|
+
<dd><p>Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.</p>
|
|
35
|
+
</dd>
|
|
36
|
+
<dt><a href="#HTMLElementService">HTMLElementService</a> ⇐ <code>PseudoElement</code></dt>
|
|
37
|
+
<dd><p>Simulate the behaviour of the HTMLElement Class when there is no DOM available.</p>
|
|
38
|
+
</dd>
|
|
39
|
+
<dt><a href="#EventTargetService">EventTargetService</a></dt>
|
|
40
|
+
<dd><p>Simulate the behaviour of the EventTarget Class when there is no DOM available.</p>
|
|
41
|
+
</dd>
|
|
42
|
+
<dt><a href="#EventService">EventService</a></dt>
|
|
43
|
+
<dd><p>Simulate the behaviour of the Event Class when there is no DOM available.</p>
|
|
44
|
+
</dd>
|
|
45
|
+
<dt><a href="#ElementService">ElementService</a> ⇐ <code>PseudoNode</code></dt>
|
|
46
|
+
<dd><p>Simulate the behaviour of the Element Class when there is no DOM available.</p>
|
|
47
|
+
</dd>
|
|
48
|
+
<dt><a href="#DOMTokenListService">DOMTokenListService</a></dt>
|
|
49
|
+
<dd><p>Simulate the behaviour of the DOMTokenList Class when there is no DOM available.</p>
|
|
50
|
+
</dd>
|
|
51
|
+
<dt><a href="#AttrService">AttrService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
52
|
+
<dd><p>Simulate the behaviour of the Attr Class when there is no DOM available.</p>
|
|
53
|
+
</dd>
|
|
54
|
+
<dt><a href="#LinkedNode">LinkedNode</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
55
|
+
<dd><p>A node which is stored in a TreeLinker and answers questions about its position in the tree by asking that linker.</p>
|
|
56
|
+
</dd>
|
|
57
|
+
<dt><a href="#PseudoNodeList">PseudoNodeList</a> ⇐ <code>LinkedTreeList</code></dt>
|
|
58
|
+
<dd><p>A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
59
|
+
the linkers that hold them.</p>
|
|
60
|
+
</dd>
|
|
61
|
+
<dt><a href="#PseudoHTMLDocument">PseudoHTMLDocument</a> ⇐ <code>PseudoHTMLElement</code></dt>
|
|
62
|
+
<dd><p>Simulate the behaviour of the HTMLDocument Class when there is no DOM available.</p>
|
|
63
|
+
</dd>
|
|
64
|
+
<dt><a href="#PseudoEventListener">PseudoEventListener</a></dt>
|
|
65
|
+
<dd><p>Handle events as they are stored and implemented.</p>
|
|
66
|
+
</dd>
|
|
67
|
+
</dl>
|
|
68
|
+
|
|
69
|
+
## Constants
|
|
70
|
+
|
|
71
|
+
<dl>
|
|
72
|
+
<dt><a href="#HTMLElementService_1">HTMLElementService_1</a> : <code>PseudoHTMLElement</code></dt>
|
|
73
|
+
<dd></dd>
|
|
74
|
+
</dl>
|
|
75
|
+
|
|
76
|
+
## Functions
|
|
77
|
+
|
|
78
|
+
<dl>
|
|
79
|
+
<dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
|
|
80
|
+
<dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
|
|
81
|
+
</dd>
|
|
82
|
+
<dt><a href="#generateNode">generateNode()</a> ⇒ <code>function</code></dt>
|
|
83
|
+
<dd><p>Create a TreeLinker class whose linkers each store a node (a LinkedNode) as their data, this can be used to build a
|
|
84
|
+
tree (or list) of nodes from plain values.</p>
|
|
85
|
+
</dd>
|
|
86
|
+
<dt><a href="#generateDocument">generateDocument(root, context)</a> ⇒ <code>Window</code> | <code>PseudoEventTarget</code></dt>
|
|
87
|
+
<dd><p>Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
|
|
88
|
+
context.</p>
|
|
89
|
+
</dd>
|
|
90
|
+
</dl>
|
|
91
|
+
|
|
92
|
+
<a name="module_pseudoDom/objects"></a>
|
|
93
|
+
|
|
94
|
+
## pseudoDom/objects : <code>Object</code>
|
|
95
|
+
All methods exported from this module are encapsulated within pseudoDom.
|
|
96
|
+
|
|
97
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
98
|
+
<a name="NodeService"></a>
|
|
99
|
+
|
|
100
|
+
## NodeService ⇐ <code>PseudoEventTarget</code>
|
|
101
|
+
Simulate the behaviour of the Node Class when there is no DOM available.
|
|
102
|
+
|
|
103
|
+
**Kind**: global class
|
|
104
|
+
**Extends**: <code>PseudoEventTarget</code>
|
|
105
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
106
|
+
**Properties**
|
|
107
|
+
|
|
108
|
+
| Name | Type |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| name | <code>string</code> |
|
|
111
|
+
| appendChild | <code>function</code> |
|
|
112
|
+
| removeChild | <code>function</code> |
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
* [NodeService](#NodeService) ⇐ <code>PseudoEventTarget</code>
|
|
116
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
117
|
+
* [.cloneNode()](#NodeService+cloneNode)
|
|
118
|
+
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
119
|
+
* [.contains()](#NodeService+contains)
|
|
120
|
+
* [.insertBefore()](#NodeService+insertBefore)
|
|
121
|
+
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
122
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
123
|
+
* [.replaceChild()](#NodeService+replaceChild)
|
|
124
|
+
|
|
125
|
+
<a name="NodeService+appendChild"></a>
|
|
126
|
+
|
|
127
|
+
### nodeService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
128
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
129
|
+
|
|
130
|
+
| Param | Type |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| childNode | <code>PseudoNode</code> |
|
|
133
|
+
|
|
134
|
+
<a name="NodeService+cloneNode"></a>
|
|
135
|
+
|
|
136
|
+
### nodeService.cloneNode()
|
|
137
|
+
Not implemented yet.
|
|
138
|
+
|
|
139
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
140
|
+
**Throws**:
|
|
141
|
+
|
|
142
|
+
- <code>Error</code>
|
|
143
|
+
|
|
144
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
145
|
+
|
|
146
|
+
### nodeService.compareDocumentPosition()
|
|
147
|
+
Not implemented yet.
|
|
148
|
+
|
|
149
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
150
|
+
**Throws**:
|
|
151
|
+
|
|
152
|
+
- <code>Error</code>
|
|
153
|
+
|
|
154
|
+
<a name="NodeService+contains"></a>
|
|
155
|
+
|
|
156
|
+
### nodeService.contains()
|
|
157
|
+
Not implemented yet.
|
|
158
|
+
|
|
159
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
160
|
+
**Throws**:
|
|
161
|
+
|
|
162
|
+
- <code>Error</code>
|
|
163
|
+
|
|
164
|
+
<a name="NodeService+insertBefore"></a>
|
|
165
|
+
|
|
166
|
+
### nodeService.insertBefore()
|
|
167
|
+
Not implemented yet.
|
|
168
|
+
|
|
169
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
170
|
+
**Throws**:
|
|
171
|
+
|
|
172
|
+
- <code>Error</code>
|
|
173
|
+
|
|
174
|
+
<a name="NodeService+isEqualNode"></a>
|
|
175
|
+
|
|
176
|
+
### nodeService.isEqualNode()
|
|
177
|
+
Not implemented yet.
|
|
178
|
+
|
|
179
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
180
|
+
**Throws**:
|
|
181
|
+
|
|
182
|
+
- <code>Error</code>
|
|
183
|
+
|
|
184
|
+
<a name="NodeService+removeChild"></a>
|
|
185
|
+
|
|
186
|
+
### nodeService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
187
|
+
Remove the given child from this node.
|
|
188
|
+
|
|
189
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
190
|
+
**Throws**:
|
|
191
|
+
|
|
192
|
+
- <code>Error</code> When the node is not a child of this node
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
| Param | Type | Description |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| childElement | <code>PseudoNode</code> | The child node, or its TreeLinker from the children list |
|
|
198
|
+
|
|
199
|
+
<a name="NodeService+replaceChild"></a>
|
|
200
|
+
|
|
201
|
+
### nodeService.replaceChild()
|
|
202
|
+
Not implemented yet.
|
|
203
|
+
|
|
204
|
+
**Kind**: instance method of [<code>NodeService</code>](#NodeService)
|
|
205
|
+
**Throws**:
|
|
206
|
+
|
|
207
|
+
- <code>Error</code>
|
|
208
|
+
|
|
209
|
+
<a name="NamedNodeMapService"></a>
|
|
210
|
+
|
|
211
|
+
## NamedNodeMapService
|
|
212
|
+
Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.
|
|
213
|
+
|
|
214
|
+
**Kind**: global class
|
|
215
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
216
|
+
<a name="new_NamedNodeMapService_new"></a>
|
|
217
|
+
|
|
218
|
+
### new NamedNodeMapService([attributes])
|
|
219
|
+
|
|
220
|
+
| Param | Type | Default | Description |
|
|
221
|
+
| --- | --- | --- | --- |
|
|
222
|
+
| [attributes] | <code>Array.<PseudoAttr></code> | <code>[]</code> | The attributes to start with |
|
|
223
|
+
|
|
224
|
+
<a name="HTMLElementService"></a>
|
|
225
|
+
|
|
226
|
+
## HTMLElementService ⇐ <code>PseudoElement</code>
|
|
227
|
+
Simulate the behaviour of the HTMLElement Class when there is no DOM available.
|
|
228
|
+
|
|
229
|
+
**Kind**: global class
|
|
230
|
+
**Extends**: <code>PseudoElement</code>
|
|
231
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
232
|
+
**Properties**
|
|
233
|
+
|
|
234
|
+
| Name | Type | Description |
|
|
235
|
+
| --- | --- | --- |
|
|
236
|
+
| hidden | <code>boolean</code> | State of whether element is visible |
|
|
237
|
+
| offsetHeight | <code>number</code> | The height of the element as offset by the parent element |
|
|
238
|
+
| offsetLeft | <code>number</code> | The position of the left side of the element based on the parent element |
|
|
239
|
+
| offsetParent | <code>PseudoHTMLElement</code> | A reference to the closest positioned parent element |
|
|
240
|
+
| offsetTop | <code>number</code> | The position of the top side of the element based on the parent element |
|
|
241
|
+
| offsetWidth | <code>number</code> | The width of the element as offset by the parent element |
|
|
242
|
+
| style | <code>Object</code> | A container to define all applied inline-styles |
|
|
243
|
+
| title | <code>string</code> | The title attribute which affects the text visible on hover |
|
|
244
|
+
|
|
245
|
+
<a name="new_HTMLElementService_new"></a>
|
|
246
|
+
|
|
247
|
+
### new HTMLElementService([elementOptions])
|
|
248
|
+
Simulate the HTMLElement object when the Dom is not available
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
| Param | Type | Default |
|
|
252
|
+
| --- | --- | --- |
|
|
253
|
+
| [elementOptions] | <code>Object</code> | <code>{}</code> |
|
|
254
|
+
| [elementOptions.tagName] | <code>string</code> | <code>"''"</code> |
|
|
255
|
+
| [elementOptions.parent] | <code>PseudoNode</code> \| <code>Object</code> | <code>{}</code> |
|
|
256
|
+
| [elementOptions.children] | <code>Array</code> | <code>[]</code> |
|
|
257
|
+
|
|
258
|
+
<a name="EventTargetService"></a>
|
|
259
|
+
|
|
260
|
+
## EventTargetService
|
|
261
|
+
Simulate the behaviour of the EventTarget Class when there is no DOM available.
|
|
262
|
+
|
|
263
|
+
**Kind**: global class
|
|
264
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
265
|
+
**Properties**
|
|
266
|
+
|
|
267
|
+
| Name | Type |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| listeners | <code>Object.<string, Array.<PseudoEventListener>></code> |
|
|
270
|
+
| addEventListener | <code>function</code> |
|
|
271
|
+
| removeEventListener | <code>function</code> |
|
|
272
|
+
| dispatchEvent | <code>function</code> |
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
* [EventTargetService](#EventTargetService)
|
|
276
|
+
* [.listenersFor(type)](#EventTargetService+listenersFor) ⇒ <code>LinkedList</code>
|
|
277
|
+
* [.runEvents(event)](#EventTargetService+runEvents) ⇒ <code>\*</code>
|
|
278
|
+
* [.setDefaultEvent(type, callback)](#EventTargetService+setDefaultEvent)
|
|
279
|
+
|
|
280
|
+
<a name="EventTargetService+listenersFor"></a>
|
|
281
|
+
|
|
282
|
+
### eventTargetService.listenersFor(type) ⇒ <code>LinkedList</code>
|
|
283
|
+
The listeners registered for a type of event, creating the (empty) list of them when there are none yet.
|
|
284
|
+
|
|
285
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
286
|
+
|
|
287
|
+
| Param | Type |
|
|
288
|
+
| --- | --- |
|
|
289
|
+
| type | <code>string</code> |
|
|
290
|
+
|
|
291
|
+
<a name="EventTargetService+runEvents"></a>
|
|
292
|
+
|
|
293
|
+
### eventTargetService.runEvents(event) ⇒ <code>\*</code>
|
|
294
|
+
Run each of the listeners registered on this target for the type of the event.
|
|
295
|
+
Listeners which do not apply to the event's phase are skipped, running stops once immediate propagation is stopped,
|
|
296
|
+
and listeners added or removed while running do not change which ones run for this event.
|
|
297
|
+
|
|
298
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
299
|
+
**Returns**: <code>\*</code> - true when there was nothing registered, otherwise the last value returned from a handler (null when none ran)
|
|
300
|
+
|
|
301
|
+
| Param | Type |
|
|
302
|
+
| --- | --- |
|
|
303
|
+
| event | [<code>EventService</code>](#EventService) |
|
|
304
|
+
|
|
305
|
+
<a name="EventTargetService+setDefaultEvent"></a>
|
|
306
|
+
|
|
307
|
+
### eventTargetService.setDefaultEvent(type, callback)
|
|
308
|
+
Register the function to run when nothing else has prevented the default for this type of event.
|
|
309
|
+
|
|
310
|
+
**Kind**: instance method of [<code>EventTargetService</code>](#EventTargetService)
|
|
311
|
+
|
|
312
|
+
| Param | Type |
|
|
313
|
+
| --- | --- |
|
|
314
|
+
| type | <code>string</code> |
|
|
315
|
+
| callback | <code>function</code> |
|
|
316
|
+
|
|
317
|
+
<a name="EventService"></a>
|
|
318
|
+
|
|
319
|
+
## EventService
|
|
320
|
+
Simulate the behaviour of the Event Class when there is no DOM available.
|
|
321
|
+
|
|
322
|
+
**Kind**: global class
|
|
323
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
324
|
+
**Properties**
|
|
325
|
+
|
|
326
|
+
| Name | Type | Description |
|
|
327
|
+
| --- | --- | --- |
|
|
328
|
+
| NONE | <code>number</code> | |
|
|
329
|
+
| CAPTURING_PHASE | <code>number</code> | |
|
|
330
|
+
| AT_TARGET | <code>number</code> | |
|
|
331
|
+
| BUBBLING_PHASE | <code>number</code> | |
|
|
332
|
+
| bubbles | <code>boolean</code> | A Boolean indicating whether the event bubbles up through the Dom or not. |
|
|
333
|
+
| cancelable | <code>boolean</code> | A Boolean indicating whether the event is cancelable. |
|
|
334
|
+
| composed | <code>boolean</code> | A Boolean value indicating whether the event can bubble across the boundary between the shadow Dom and the regular Dom. |
|
|
335
|
+
| currentTarget | <code>function</code> \| <code>PseudoEventTarget</code> | A reference to the currently registered target for the event. This is the object to which the event is currently slated to be sent; it's possible this has been changed along the way through re-targeting. |
|
|
336
|
+
| defaultPrevented | <code>boolean</code> | Indicates whether event.preventDefault() has been called on the event. |
|
|
337
|
+
| immediatePropagationStopped | <code>boolean</code> | Flag that no further propagation should occur, including on current target. |
|
|
338
|
+
| propagationStopped | <code>boolean</code> | Flag that no further propagation should occur. |
|
|
339
|
+
| eventPhase | <code>int</code> | Indicates which phase of the event flow is being processed. Uses EventService constants. |
|
|
340
|
+
| target | <code>EventTarget</code> \| <code>PseudoEventTarget</code> | A reference to the target to which the event was originally dispatched. |
|
|
341
|
+
| timeStamp | <code>int</code> | The time at which the event was created (in milliseconds). By specification, this value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this to be a DomHighResTimeStamp instead. |
|
|
342
|
+
| type | <code>string</code> | The name of the event (case-insensitive). |
|
|
343
|
+
| isTrusted | <code>boolean</code> | Indicates whether the event was initiated by the browser (after a user click for instance) or by a script (using an event creation method, like event.initEvent) |
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
* [EventService](#EventService)
|
|
347
|
+
* [new EventService(typeArg, [eventOptions])](#new_EventService_new)
|
|
348
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
349
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
350
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
351
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
352
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
353
|
+
|
|
354
|
+
<a name="new_EventService_new"></a>
|
|
355
|
+
|
|
356
|
+
### new EventService(typeArg, [eventOptions])
|
|
357
|
+
|
|
358
|
+
| Param | Type | Default |
|
|
359
|
+
| --- | --- | --- |
|
|
360
|
+
| typeArg | <code>string</code> | |
|
|
361
|
+
| [eventOptions] | <code>Object</code> | <code>{}</code> |
|
|
362
|
+
| [eventOptions.bubbles] | <code>boolean</code> | <code>true</code> |
|
|
363
|
+
| [eventOptions.cancelable] | <code>boolean</code> | <code>true</code> |
|
|
364
|
+
| [eventOptions.composed] | <code>boolean</code> | <code>true</code> |
|
|
365
|
+
|
|
366
|
+
<a name="EventService+inner"></a>
|
|
367
|
+
|
|
368
|
+
### eventService.inner ⇒ <code>EventInner</code>
|
|
369
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
370
|
+
|
|
371
|
+
**Kind**: instance property of [<code>EventService</code>](#EventService)
|
|
372
|
+
<a name="EventService+composedPath"></a>
|
|
373
|
+
|
|
374
|
+
### eventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
375
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
376
|
+
|
|
377
|
+
**Kind**: instance method of [<code>EventService</code>](#EventService)
|
|
378
|
+
<a name="EventService+preventDefault"></a>
|
|
379
|
+
|
|
380
|
+
### eventService.preventDefault() ⇒ <code>null</code>
|
|
381
|
+
Cancels the event (if it is cancelable).
|
|
382
|
+
|
|
383
|
+
**Kind**: instance method of [<code>EventService</code>](#EventService)
|
|
384
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
385
|
+
|
|
386
|
+
### eventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
387
|
+
For this particular event, no other listener will be called.
|
|
388
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
389
|
+
capture phase, for instance)
|
|
390
|
+
|
|
391
|
+
**Kind**: instance method of [<code>EventService</code>](#EventService)
|
|
392
|
+
<a name="EventService+stopPropagation"></a>
|
|
393
|
+
|
|
394
|
+
### eventService.stopPropagation() ⇒ <code>null</code>
|
|
395
|
+
Stops the propagation of events further along in the Dom.
|
|
396
|
+
|
|
397
|
+
**Kind**: instance method of [<code>EventService</code>](#EventService)
|
|
398
|
+
<a name="ElementService"></a>
|
|
399
|
+
|
|
400
|
+
## ElementService ⇐ <code>PseudoNode</code>
|
|
401
|
+
Simulate the behaviour of the Element Class when there is no DOM available.
|
|
402
|
+
|
|
403
|
+
**Kind**: global class
|
|
404
|
+
**Extends**: <code>PseudoNode</code>
|
|
405
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
406
|
+
**Properties**
|
|
407
|
+
|
|
408
|
+
| Name | Type |
|
|
409
|
+
| --- | --- |
|
|
410
|
+
| tagName | <code>string</code> |
|
|
411
|
+
| className | <code>string</code> |
|
|
412
|
+
| id | <code>string</code> |
|
|
413
|
+
| innerHtml | <code>string</code> |
|
|
414
|
+
| attributes | <code>Array</code> |
|
|
415
|
+
| hasAttribute | <code>function</code> |
|
|
416
|
+
| setAttribute | <code>function</code> |
|
|
417
|
+
| getAttribute | <code>function</code> |
|
|
418
|
+
| removeAttribute | <code>function</code> |
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
* [ElementService](#ElementService) ⇐ <code>PseudoNode</code>
|
|
422
|
+
* [new ElementService([settings])](#new_ElementService_new)
|
|
423
|
+
* [.applyDefaultEvent()](#ElementService+applyDefaultEvent) ⇒ <code>function</code>
|
|
424
|
+
* [.appendChild(childElement)](#ElementService+appendChild) ⇒ <code>PseudoNode</code>
|
|
425
|
+
* [.hasAttribute(attributeName)](#ElementService+hasAttribute) ⇒ <code>boolean</code>
|
|
426
|
+
* [.setAttribute(attributeName, attributeValue)](#ElementService+setAttribute) ⇒ <code>undefined</code>
|
|
427
|
+
* [.getAttribute(attributeName)](#ElementService+getAttribute) ⇒ <code>string</code> \| <code>null</code>
|
|
428
|
+
* [.removeAttribute(attributeName)](#ElementService+removeAttribute) ⇒ <code>undefined</code>
|
|
429
|
+
|
|
430
|
+
<a name="new_ElementService_new"></a>
|
|
431
|
+
|
|
432
|
+
### new ElementService([settings])
|
|
433
|
+
|
|
434
|
+
| Param | Type | Default | Description |
|
|
435
|
+
| --- | --- | --- | --- |
|
|
436
|
+
| [settings] | <code>Object</code> | <code>{}</code> | |
|
|
437
|
+
| [settings.tagName] | <code>string</code> | <code>"''"</code> | The name of the tag this element represents |
|
|
438
|
+
| [settings.attributes] | <code>Array.<{name: string, value: \*}></code> | <code>[]</code> | The attributes (also assigned as properties) to start with |
|
|
439
|
+
| [settings.parent] | <code>PseudoNode</code> \| <code>null</code> | <code></code> | The parent node |
|
|
440
|
+
| [settings.children] | <code>Array</code> | <code>[]</code> | The values or nodes to start as children |
|
|
441
|
+
|
|
442
|
+
<a name="ElementService+applyDefaultEvent"></a>
|
|
443
|
+
|
|
444
|
+
### elementService.applyDefaultEvent() ⇒ <code>function</code>
|
|
445
|
+
Some elements have default behaviour, this registers it when the element is added.
|
|
446
|
+
|
|
447
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
448
|
+
<a name="ElementService+appendChild"></a>
|
|
449
|
+
|
|
450
|
+
### elementService.appendChild(childElement) ⇒ <code>PseudoNode</code>
|
|
451
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
452
|
+
|
|
453
|
+
| Param | Type |
|
|
454
|
+
| --- | --- |
|
|
455
|
+
| childElement | <code>PseudoNode</code> \| [<code>ElementService</code>](#ElementService) |
|
|
456
|
+
|
|
457
|
+
<a name="ElementService+hasAttribute"></a>
|
|
458
|
+
|
|
459
|
+
### elementService.hasAttribute(attributeName) ⇒ <code>boolean</code>
|
|
460
|
+
Check whether the element has an attribute by that name.
|
|
461
|
+
|
|
462
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
463
|
+
|
|
464
|
+
| Param | Type |
|
|
465
|
+
| --- | --- |
|
|
466
|
+
| attributeName | <code>string</code> |
|
|
467
|
+
|
|
468
|
+
<a name="ElementService+setAttribute"></a>
|
|
469
|
+
|
|
470
|
+
### elementService.setAttribute(attributeName, attributeValue) ⇒ <code>undefined</code>
|
|
471
|
+
Set the value of an attribute, adding the attribute if it did not exist.
|
|
472
|
+
|
|
473
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
474
|
+
|
|
475
|
+
| Param | Type |
|
|
476
|
+
| --- | --- |
|
|
477
|
+
| attributeName | <code>string</code> |
|
|
478
|
+
| attributeValue | <code>string</code> |
|
|
479
|
+
|
|
480
|
+
<a name="ElementService+getAttribute"></a>
|
|
481
|
+
|
|
482
|
+
### elementService.getAttribute(attributeName) ⇒ <code>string</code> \| <code>null</code>
|
|
483
|
+
Retrieve the value of an attribute.
|
|
484
|
+
|
|
485
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
486
|
+
**Returns**: <code>string</code> \| <code>null</code> - The value, or null when there is no such attribute
|
|
487
|
+
|
|
488
|
+
| Param | Type |
|
|
489
|
+
| --- | --- |
|
|
490
|
+
| attributeName | <code>string</code> |
|
|
491
|
+
|
|
492
|
+
<a name="ElementService+removeAttribute"></a>
|
|
493
|
+
|
|
494
|
+
### elementService.removeAttribute(attributeName) ⇒ <code>undefined</code>
|
|
495
|
+
Remove an attribute from the element.
|
|
496
|
+
|
|
497
|
+
**Kind**: instance method of [<code>ElementService</code>](#ElementService)
|
|
498
|
+
|
|
499
|
+
| Param | Type |
|
|
500
|
+
| --- | --- |
|
|
501
|
+
| attributeName | <code>string</code> |
|
|
502
|
+
|
|
503
|
+
<a name="DOMTokenListService"></a>
|
|
504
|
+
|
|
505
|
+
## DOMTokenListService
|
|
506
|
+
Simulate the behaviour of the DOMTokenList Class when there is no DOM available.
|
|
507
|
+
|
|
508
|
+
**Kind**: global class
|
|
509
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
510
|
+
<a name="new_DOMTokenListService_new"></a>
|
|
511
|
+
|
|
512
|
+
### new DOMTokenListService([value], [onChange])
|
|
513
|
+
|
|
514
|
+
| Param | Type | Default | Description |
|
|
515
|
+
| --- | --- | --- | --- |
|
|
516
|
+
| [value] | <code>string</code> | <code>"''"</code> | The space separated tokens to start with |
|
|
517
|
+
| [onChange] | <code>function</code> | | Called with the new value whenever the tokens change |
|
|
518
|
+
|
|
519
|
+
<a name="AttrService"></a>
|
|
520
|
+
|
|
521
|
+
## AttrService ⇐ [<code>NodeService</code>](#NodeService)
|
|
522
|
+
Simulate the behaviour of the Attr Class when there is no DOM available.
|
|
523
|
+
|
|
524
|
+
**Kind**: global class
|
|
525
|
+
**Extends**: [<code>NodeService</code>](#NodeService)
|
|
526
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
527
|
+
|
|
528
|
+
* [AttrService](#AttrService) ⇐ [<code>NodeService</code>](#NodeService)
|
|
529
|
+
* [new AttrService(name, [value], [ownerElement], [namespaceURI], [prefix])](#new_AttrService_new)
|
|
530
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
531
|
+
* [.cloneNode()](#NodeService+cloneNode)
|
|
532
|
+
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
533
|
+
* [.contains()](#NodeService+contains)
|
|
534
|
+
* [.insertBefore()](#NodeService+insertBefore)
|
|
535
|
+
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
536
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
537
|
+
* [.replaceChild()](#NodeService+replaceChild)
|
|
538
|
+
|
|
539
|
+
<a name="new_AttrService_new"></a>
|
|
540
|
+
|
|
541
|
+
### new AttrService(name, [value], [ownerElement], [namespaceURI], [prefix])
|
|
542
|
+
|
|
543
|
+
| Param | Type | Default | Description |
|
|
544
|
+
| --- | --- | --- | --- |
|
|
545
|
+
| name | <code>string</code> | | The name of the attribute |
|
|
546
|
+
| [value] | <code>string</code> | <code>"''"</code> | The value of the attribute |
|
|
547
|
+
| [ownerElement] | <code>PseudoElement</code> \| <code>null</code> | <code></code> | The element which has this attribute |
|
|
548
|
+
| [namespaceURI] | <code>string</code> | <code>"''"</code> | The namespace of the attribute |
|
|
549
|
+
| [prefix] | <code>string</code> \| <code>null</code> | <code>null</code> | The namespace prefix of the attribute |
|
|
550
|
+
|
|
551
|
+
<a name="NodeService+appendChild"></a>
|
|
552
|
+
|
|
553
|
+
### attrService.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
554
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
555
|
+
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
556
|
+
|
|
557
|
+
| Param | Type |
|
|
558
|
+
| --- | --- |
|
|
559
|
+
| childNode | <code>PseudoNode</code> |
|
|
560
|
+
|
|
561
|
+
<a name="NodeService+cloneNode"></a>
|
|
562
|
+
|
|
563
|
+
### attrService.cloneNode()
|
|
564
|
+
Not implemented yet.
|
|
565
|
+
|
|
566
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
567
|
+
**Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
|
|
568
|
+
**Throws**:
|
|
569
|
+
|
|
570
|
+
- <code>Error</code>
|
|
571
|
+
|
|
572
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
573
|
+
|
|
574
|
+
### attrService.compareDocumentPosition()
|
|
575
|
+
Not implemented yet.
|
|
576
|
+
|
|
577
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
578
|
+
**Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
|
|
579
|
+
**Throws**:
|
|
580
|
+
|
|
581
|
+
- <code>Error</code>
|
|
582
|
+
|
|
583
|
+
<a name="NodeService+contains"></a>
|
|
584
|
+
|
|
585
|
+
### attrService.contains()
|
|
586
|
+
Not implemented yet.
|
|
587
|
+
|
|
588
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
589
|
+
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
590
|
+
**Throws**:
|
|
591
|
+
|
|
592
|
+
- <code>Error</code>
|
|
593
|
+
|
|
594
|
+
<a name="NodeService+insertBefore"></a>
|
|
595
|
+
|
|
596
|
+
### attrService.insertBefore()
|
|
597
|
+
Not implemented yet.
|
|
598
|
+
|
|
599
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
600
|
+
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
601
|
+
**Throws**:
|
|
602
|
+
|
|
603
|
+
- <code>Error</code>
|
|
604
|
+
|
|
605
|
+
<a name="NodeService+isEqualNode"></a>
|
|
606
|
+
|
|
607
|
+
### attrService.isEqualNode()
|
|
608
|
+
Not implemented yet.
|
|
609
|
+
|
|
610
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
611
|
+
**Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
|
|
612
|
+
**Throws**:
|
|
613
|
+
|
|
614
|
+
- <code>Error</code>
|
|
615
|
+
|
|
616
|
+
<a name="NodeService+removeChild"></a>
|
|
617
|
+
|
|
618
|
+
### attrService.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
619
|
+
Remove the given child from this node.
|
|
620
|
+
|
|
621
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
622
|
+
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
623
|
+
**Throws**:
|
|
624
|
+
|
|
625
|
+
- <code>Error</code> When the node is not a child of this node
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
| Param | Type | Description |
|
|
629
|
+
| --- | --- | --- |
|
|
630
|
+
| childElement | <code>PseudoNode</code> | The child node, or its TreeLinker from the children list |
|
|
631
|
+
|
|
632
|
+
<a name="NodeService+replaceChild"></a>
|
|
633
|
+
|
|
634
|
+
### attrService.replaceChild()
|
|
635
|
+
Not implemented yet.
|
|
636
|
+
|
|
637
|
+
**Kind**: instance method of [<code>AttrService</code>](#AttrService)
|
|
638
|
+
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
639
|
+
**Throws**:
|
|
640
|
+
|
|
641
|
+
- <code>Error</code>
|
|
642
|
+
|
|
643
|
+
<a name="LinkedNode"></a>
|
|
644
|
+
|
|
645
|
+
## LinkedNode ⇐ [<code>NodeService</code>](#NodeService)
|
|
646
|
+
A node which is stored in a TreeLinker and answers questions about its position in the tree by asking that linker.
|
|
647
|
+
|
|
648
|
+
**Kind**: global class
|
|
649
|
+
**Extends**: [<code>NodeService</code>](#NodeService)
|
|
650
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
651
|
+
|
|
652
|
+
* [LinkedNode](#LinkedNode) ⇐ [<code>NodeService</code>](#NodeService)
|
|
653
|
+
* [new LinkedNode(linker, value)](#new_LinkedNode_new)
|
|
654
|
+
* [.appendChild(childNode)](#NodeService+appendChild) ⇒ <code>PseudoNode</code>
|
|
655
|
+
* [.cloneNode()](#NodeService+cloneNode)
|
|
656
|
+
* [.compareDocumentPosition()](#NodeService+compareDocumentPosition)
|
|
657
|
+
* [.contains()](#NodeService+contains)
|
|
658
|
+
* [.insertBefore()](#NodeService+insertBefore)
|
|
659
|
+
* [.isEqualNode()](#NodeService+isEqualNode)
|
|
660
|
+
* [.removeChild(childElement)](#NodeService+removeChild) ⇒ <code>PseudoNode</code>
|
|
661
|
+
* [.replaceChild()](#NodeService+replaceChild)
|
|
662
|
+
|
|
663
|
+
<a name="new_LinkedNode_new"></a>
|
|
664
|
+
|
|
665
|
+
### new LinkedNode(linker, value)
|
|
666
|
+
|
|
667
|
+
| Param | Type | Description |
|
|
668
|
+
| --- | --- | --- |
|
|
669
|
+
| linker | <code>TreeLinker</code> | The linker holding this node |
|
|
670
|
+
| value | <code>string</code> \| <code>null</code> | The value of the node |
|
|
671
|
+
|
|
672
|
+
<a name="NodeService+appendChild"></a>
|
|
673
|
+
|
|
674
|
+
### linkedNode.appendChild(childNode) ⇒ <code>PseudoNode</code>
|
|
675
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
676
|
+
**Overrides**: [<code>appendChild</code>](#NodeService+appendChild)
|
|
677
|
+
|
|
678
|
+
| Param | Type |
|
|
679
|
+
| --- | --- |
|
|
680
|
+
| childNode | <code>PseudoNode</code> |
|
|
681
|
+
|
|
682
|
+
<a name="NodeService+cloneNode"></a>
|
|
683
|
+
|
|
684
|
+
### linkedNode.cloneNode()
|
|
685
|
+
Not implemented yet.
|
|
686
|
+
|
|
687
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
688
|
+
**Overrides**: [<code>cloneNode</code>](#NodeService+cloneNode)
|
|
689
|
+
**Throws**:
|
|
690
|
+
|
|
691
|
+
- <code>Error</code>
|
|
692
|
+
|
|
693
|
+
<a name="NodeService+compareDocumentPosition"></a>
|
|
694
|
+
|
|
695
|
+
### linkedNode.compareDocumentPosition()
|
|
696
|
+
Not implemented yet.
|
|
697
|
+
|
|
698
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
699
|
+
**Overrides**: [<code>compareDocumentPosition</code>](#NodeService+compareDocumentPosition)
|
|
700
|
+
**Throws**:
|
|
701
|
+
|
|
702
|
+
- <code>Error</code>
|
|
703
|
+
|
|
704
|
+
<a name="NodeService+contains"></a>
|
|
705
|
+
|
|
706
|
+
### linkedNode.contains()
|
|
707
|
+
Not implemented yet.
|
|
708
|
+
|
|
709
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
710
|
+
**Overrides**: [<code>contains</code>](#NodeService+contains)
|
|
711
|
+
**Throws**:
|
|
712
|
+
|
|
713
|
+
- <code>Error</code>
|
|
714
|
+
|
|
715
|
+
<a name="NodeService+insertBefore"></a>
|
|
716
|
+
|
|
717
|
+
### linkedNode.insertBefore()
|
|
718
|
+
Not implemented yet.
|
|
719
|
+
|
|
720
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
721
|
+
**Overrides**: [<code>insertBefore</code>](#NodeService+insertBefore)
|
|
722
|
+
**Throws**:
|
|
723
|
+
|
|
724
|
+
- <code>Error</code>
|
|
725
|
+
|
|
726
|
+
<a name="NodeService+isEqualNode"></a>
|
|
727
|
+
|
|
728
|
+
### linkedNode.isEqualNode()
|
|
729
|
+
Not implemented yet.
|
|
730
|
+
|
|
731
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
732
|
+
**Overrides**: [<code>isEqualNode</code>](#NodeService+isEqualNode)
|
|
733
|
+
**Throws**:
|
|
734
|
+
|
|
735
|
+
- <code>Error</code>
|
|
736
|
+
|
|
737
|
+
<a name="NodeService+removeChild"></a>
|
|
738
|
+
|
|
739
|
+
### linkedNode.removeChild(childElement) ⇒ <code>PseudoNode</code>
|
|
740
|
+
Remove the given child from this node.
|
|
741
|
+
|
|
742
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
743
|
+
**Overrides**: [<code>removeChild</code>](#NodeService+removeChild)
|
|
744
|
+
**Throws**:
|
|
745
|
+
|
|
746
|
+
- <code>Error</code> When the node is not a child of this node
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
| Param | Type | Description |
|
|
750
|
+
| --- | --- | --- |
|
|
751
|
+
| childElement | <code>PseudoNode</code> | The child node, or its TreeLinker from the children list |
|
|
752
|
+
|
|
753
|
+
<a name="NodeService+replaceChild"></a>
|
|
754
|
+
|
|
755
|
+
### linkedNode.replaceChild()
|
|
756
|
+
Not implemented yet.
|
|
757
|
+
|
|
758
|
+
**Kind**: instance method of [<code>LinkedNode</code>](#LinkedNode)
|
|
759
|
+
**Overrides**: [<code>replaceChild</code>](#NodeService+replaceChild)
|
|
760
|
+
**Throws**:
|
|
761
|
+
|
|
762
|
+
- <code>Error</code>
|
|
763
|
+
|
|
764
|
+
<a name="PseudoNodeList"></a>
|
|
765
|
+
|
|
766
|
+
## PseudoNodeList ⇐ <code>LinkedTreeList</code>
|
|
767
|
+
A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
|
|
768
|
+
the linkers that hold them.
|
|
769
|
+
|
|
770
|
+
**Kind**: global class
|
|
771
|
+
**Extends**: <code>LinkedTreeList</code>
|
|
772
|
+
|
|
773
|
+
* [PseudoNodeList](#PseudoNodeList) ⇐ <code>LinkedTreeList</code>
|
|
774
|
+
* [.entries()](#PseudoNodeList+entries) ⇒ <code>Iterator</code>
|
|
775
|
+
* [.keys()](#PseudoNodeList+keys) ⇒ <code>Iterator</code>
|
|
776
|
+
* [.values()](#PseudoNodeList+values) ⇒ <code>Iterator</code>
|
|
777
|
+
|
|
778
|
+
<a name="PseudoNodeList+entries"></a>
|
|
779
|
+
|
|
780
|
+
### pseudoNodeList.entries() ⇒ <code>Iterator</code>
|
|
781
|
+
Iterate over [index, node] pairs.
|
|
782
|
+
|
|
783
|
+
**Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
784
|
+
<a name="PseudoNodeList+keys"></a>
|
|
785
|
+
|
|
786
|
+
### pseudoNodeList.keys() ⇒ <code>Iterator</code>
|
|
787
|
+
Iterate over the indexes.
|
|
788
|
+
|
|
789
|
+
**Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
790
|
+
<a name="PseudoNodeList+values"></a>
|
|
791
|
+
|
|
792
|
+
### pseudoNodeList.values() ⇒ <code>Iterator</code>
|
|
793
|
+
Iterate over the nodes.
|
|
794
|
+
|
|
795
|
+
**Kind**: instance method of [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
796
|
+
<a name="PseudoHTMLDocument"></a>
|
|
797
|
+
|
|
798
|
+
## PseudoHTMLDocument ⇐ <code>PseudoHTMLElement</code>
|
|
799
|
+
Simulate the behaviour of the HTMLDocument Class when there is no DOM available.
|
|
800
|
+
|
|
801
|
+
**Kind**: global class
|
|
802
|
+
**Extends**: <code>PseudoHTMLElement</code>
|
|
803
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
804
|
+
**Properties**
|
|
805
|
+
|
|
806
|
+
| Name | Type | Description |
|
|
807
|
+
| --- | --- | --- |
|
|
808
|
+
| head | <code>PseudoHTMLElement</code> | A reference to the Head child element |
|
|
809
|
+
| body | <code>PseudoHTMLElement</code> | A reference to the Body child element |
|
|
810
|
+
| createElement | <code>function</code> | Generate a new PseudoHTMLElement with parent of document |
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
* [PseudoHTMLDocument](#PseudoHTMLDocument) ⇐ <code>PseudoHTMLElement</code>
|
|
814
|
+
* [new PseudoHTMLDocument()](#new_PseudoHTMLDocument_new)
|
|
815
|
+
* [.head](#PseudoHTMLDocument+head) : <code>PseudoHTMLElement</code>
|
|
816
|
+
* [.body](#PseudoHTMLDocument+body) : <code>PseudoHTMLElement</code>
|
|
817
|
+
* [.createElement(tagName)](#PseudoHTMLDocument+createElement) ⇒ <code>PseudoHTMLElement</code>
|
|
818
|
+
|
|
819
|
+
<a name="new_PseudoHTMLDocument_new"></a>
|
|
820
|
+
|
|
821
|
+
### new PseudoHTMLDocument()
|
|
822
|
+
The root HTML element is acts as the parent to all HTML elements in the document.
|
|
823
|
+
|
|
824
|
+
<a name="PseudoHTMLDocument+head"></a>
|
|
825
|
+
|
|
826
|
+
### pseudoHTMLDocument.head : <code>PseudoHTMLElement</code>
|
|
827
|
+
Create document head element
|
|
828
|
+
|
|
829
|
+
**Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
830
|
+
<a name="PseudoHTMLDocument+body"></a>
|
|
831
|
+
|
|
832
|
+
### pseudoHTMLDocument.body : <code>PseudoHTMLElement</code>
|
|
833
|
+
Create document body element
|
|
834
|
+
|
|
835
|
+
**Kind**: instance property of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
836
|
+
<a name="PseudoHTMLDocument+createElement"></a>
|
|
837
|
+
|
|
838
|
+
### pseudoHTMLDocument.createElement(tagName) ⇒ <code>PseudoHTMLElement</code>
|
|
839
|
+
Create and return a PseudoHTMLElement
|
|
840
|
+
|
|
841
|
+
**Kind**: instance method of [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
842
|
+
|
|
843
|
+
| Param | Type | Default | Description |
|
|
844
|
+
| --- | --- | --- | --- |
|
|
845
|
+
| tagName | <code>string</code> | <code>"div"</code> | Tag Name is a string representing the type of Dom element this represents |
|
|
846
|
+
|
|
847
|
+
<a name="PseudoEventListener"></a>
|
|
848
|
+
|
|
849
|
+
## PseudoEventListener
|
|
850
|
+
Handle events as they are stored and implemented.
|
|
851
|
+
|
|
852
|
+
**Kind**: global class
|
|
853
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
854
|
+
**Properties**
|
|
855
|
+
|
|
856
|
+
| Name | Type |
|
|
857
|
+
| --- | --- |
|
|
858
|
+
| eventType | <code>string</code> |
|
|
859
|
+
| eventOptions | <code>Object</code> |
|
|
860
|
+
| isDefault | <code>boolean</code> |
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
* [PseudoEventListener](#PseudoEventListener)
|
|
864
|
+
* [.callback](#PseudoEventListener+callback)
|
|
865
|
+
* [.handleEvent(event)](#PseudoEventListener+handleEvent) ⇒ <code>\*</code>
|
|
866
|
+
* [.doCapturePhase(event)](#PseudoEventListener+doCapturePhase) ⇒ <code>boolean</code>
|
|
867
|
+
* [.doTargetPhase(event)](#PseudoEventListener+doTargetPhase) ⇒ <code>boolean</code>
|
|
868
|
+
* [.doBubblePhase(event)](#PseudoEventListener+doBubblePhase) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
869
|
+
* [.skipPhase(event)](#PseudoEventListener+skipPhase) ⇒ <code>boolean</code>
|
|
870
|
+
* [.skipDefault(event)](#PseudoEventListener+skipDefault) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
871
|
+
* [.stopPropagation(event)](#PseudoEventListener+stopPropagation) ⇒ <code>boolean</code>
|
|
872
|
+
* [.nonPassiveHalt(event)](#PseudoEventListener+nonPassiveHalt) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
873
|
+
* [.rejectEvent(event)](#PseudoEventListener+rejectEvent) ⇒ <code>\*</code> \| <code>boolean</code>
|
|
874
|
+
|
|
875
|
+
<a name="PseudoEventListener+callback"></a>
|
|
876
|
+
|
|
877
|
+
### pseudoEventListener.callback
|
|
878
|
+
The function (or object with handleEvent) which was originally given when registering, used to find this listener again for removal.
|
|
879
|
+
|
|
880
|
+
**Kind**: instance property of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
881
|
+
<a name="PseudoEventListener+handleEvent"></a>
|
|
882
|
+
|
|
883
|
+
### pseudoEventListener.handleEvent(event) ⇒ <code>\*</code>
|
|
884
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
885
|
+
|
|
886
|
+
| Param | Type |
|
|
887
|
+
| --- | --- |
|
|
888
|
+
| event | <code>PseudoEvent</code> |
|
|
889
|
+
|
|
890
|
+
<a name="PseudoEventListener+doCapturePhase"></a>
|
|
891
|
+
|
|
892
|
+
### pseudoEventListener.doCapturePhase(event) ⇒ <code>boolean</code>
|
|
893
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
894
|
+
|
|
895
|
+
| Param | Type |
|
|
896
|
+
| --- | --- |
|
|
897
|
+
| event | <code>PseudoEvent</code> |
|
|
898
|
+
|
|
899
|
+
<a name="PseudoEventListener+doTargetPhase"></a>
|
|
900
|
+
|
|
901
|
+
### pseudoEventListener.doTargetPhase(event) ⇒ <code>boolean</code>
|
|
902
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
903
|
+
|
|
904
|
+
| Param | Type |
|
|
905
|
+
| --- | --- |
|
|
906
|
+
| event | <code>PseudoEvent</code> |
|
|
907
|
+
|
|
908
|
+
<a name="PseudoEventListener+doBubblePhase"></a>
|
|
909
|
+
|
|
910
|
+
### pseudoEventListener.doBubblePhase(event) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
911
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
912
|
+
|
|
913
|
+
| Param | Type |
|
|
914
|
+
| --- | --- |
|
|
915
|
+
| event | <code>PseudoEvent</code> |
|
|
916
|
+
|
|
917
|
+
<a name="PseudoEventListener+skipPhase"></a>
|
|
918
|
+
|
|
919
|
+
### pseudoEventListener.skipPhase(event) ⇒ <code>boolean</code>
|
|
920
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
921
|
+
|
|
922
|
+
| Param | Type |
|
|
923
|
+
| --- | --- |
|
|
924
|
+
| event | <code>PseudoEvent</code> |
|
|
925
|
+
|
|
926
|
+
<a name="PseudoEventListener+skipDefault"></a>
|
|
927
|
+
|
|
928
|
+
### pseudoEventListener.skipDefault(event) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
929
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
930
|
+
|
|
931
|
+
| Param | Type |
|
|
932
|
+
| --- | --- |
|
|
933
|
+
| event | <code>PseudoEvent</code> |
|
|
934
|
+
|
|
935
|
+
<a name="PseudoEventListener+stopPropagation"></a>
|
|
936
|
+
|
|
937
|
+
### pseudoEventListener.stopPropagation(event) ⇒ <code>boolean</code>
|
|
938
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
939
|
+
|
|
940
|
+
| Param | Type |
|
|
941
|
+
| --- | --- |
|
|
942
|
+
| event | <code>PseudoEvent</code> |
|
|
943
|
+
|
|
944
|
+
<a name="PseudoEventListener+nonPassiveHalt"></a>
|
|
945
|
+
|
|
946
|
+
### pseudoEventListener.nonPassiveHalt(event) ⇒ <code>boolean</code> \| <code>\*</code>
|
|
947
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
948
|
+
|
|
949
|
+
| Param | Type |
|
|
950
|
+
| --- | --- |
|
|
951
|
+
| event | <code>PseudoEvent</code> |
|
|
952
|
+
|
|
953
|
+
<a name="PseudoEventListener+rejectEvent"></a>
|
|
954
|
+
|
|
955
|
+
### pseudoEventListener.rejectEvent(event) ⇒ <code>\*</code> \| <code>boolean</code>
|
|
956
|
+
**Kind**: instance method of [<code>PseudoEventListener</code>](#PseudoEventListener)
|
|
957
|
+
|
|
958
|
+
| Param | Type |
|
|
959
|
+
| --- | --- |
|
|
960
|
+
| event | <code>PseudoEvent</code> |
|
|
961
|
+
|
|
962
|
+
<a name="HTMLElementService_1"></a>
|
|
963
|
+
|
|
964
|
+
## HTMLElementService\_1 : <code>PseudoHTMLElement</code>
|
|
965
|
+
**Kind**: global constant
|
|
966
|
+
<a name="generateNodeList"></a>
|
|
967
|
+
|
|
968
|
+
## generateNodeList([innerList]) ⇒ [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
969
|
+
Create a PseudoNodeList, optionally starting from an existing chain of linkers.
|
|
970
|
+
|
|
971
|
+
**Kind**: global function
|
|
972
|
+
|
|
973
|
+
| Param | Type | Default |
|
|
974
|
+
| --- | --- | --- |
|
|
975
|
+
| [innerList] | <code>TreeLinker</code> \| <code>null</code> | <code></code> |
|
|
976
|
+
|
|
977
|
+
<a name="generateNode"></a>
|
|
978
|
+
|
|
979
|
+
## generateNode() ⇒ <code>function</code>
|
|
980
|
+
Create a TreeLinker class whose linkers each store a node (a LinkedNode) as their data, this can be used to build a
|
|
981
|
+
tree (or list) of nodes from plain values.
|
|
982
|
+
|
|
983
|
+
**Kind**: global function
|
|
984
|
+
**Returns**: <code>function</code> - The NodeFactory class (a TreeLinker) to use as the linker class
|
|
985
|
+
<a name="generateDocument"></a>
|
|
986
|
+
|
|
987
|
+
## generateDocument(root, context) ⇒ <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
988
|
+
Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
|
|
989
|
+
context.
|
|
990
|
+
|
|
991
|
+
**Kind**: global function
|
|
992
|
+
|
|
993
|
+
| Param | Type |
|
|
994
|
+
| --- | --- |
|
|
995
|
+
| root | <code>Object</code> |
|
|
996
|
+
| context | <code>Object</code> |
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
* [generateDocument(root, context)](#generateDocument) ⇒ <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
1000
|
+
* [~newWindow](#generateDocument..newWindow) : <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
1001
|
+
* [~Node](#generateDocument..Node) : <code>Node</code> \| <code>PseudoNode</code>
|
|
1002
|
+
* [~Element](#generateDocument..Element) : <code>Element</code> \| <code>PseudoElement</code>
|
|
1003
|
+
* [~HTMLElement](#generateDocument..HTMLElement) : <code>HTMLElement</code> \| <code>PseudoHTMLElement</code>
|
|
1004
|
+
* [~document](#generateDocument..document) : <code>Document</code> \| [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
1005
|
+
|
|
1006
|
+
<a name="generateDocument..newWindow"></a>
|
|
1007
|
+
|
|
1008
|
+
### generateDocument~newWindow : <code>Window</code> \| <code>PseudoEventTarget</code>
|
|
1009
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
1010
|
+
<a name="generateDocument..Node"></a>
|
|
1011
|
+
|
|
1012
|
+
### generateDocument~Node : <code>Node</code> \| <code>PseudoNode</code>
|
|
1013
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
1014
|
+
<a name="generateDocument..Element"></a>
|
|
1015
|
+
|
|
1016
|
+
### generateDocument~Element : <code>Element</code> \| <code>PseudoElement</code>
|
|
1017
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
1018
|
+
<a name="generateDocument..HTMLElement"></a>
|
|
1019
|
+
|
|
1020
|
+
### generateDocument~HTMLElement : <code>HTMLElement</code> \| <code>PseudoHTMLElement</code>
|
|
1021
|
+
Create an instance of HTMLElement if not available
|
|
1022
|
+
|
|
1023
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
1024
|
+
<a name="generateDocument..document"></a>
|
|
1025
|
+
|
|
1026
|
+
### generateDocument~document : <code>Document</code> \| [<code>PseudoHTMLDocument</code>](#PseudoHTMLDocument)
|
|
1027
|
+
Define document when not available
|
|
1028
|
+
|
|
1029
|
+
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|