pseudo-dom 0.3.0 → 0.4.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 +774 -0
- package/browser/pseudo-dom.js +1266 -260
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/factories/createEvent.d.ts +28 -0
- package/dist/factories/createEvent.js +56 -0
- package/dist/factories/createEvent.min.js +1 -0
- package/dist/factories/eventDefaults.d.ts +31 -0
- package/dist/factories/eventDefaults.js +105 -0
- package/dist/factories/eventDefaults.min.js +1 -0
- package/dist/factories.d.ts +6 -0
- package/dist/factories.js +5 -1
- package/dist/factories.min.js +1 -1
- package/dist/functions/activeElement.d.ts +14 -0
- package/dist/functions/activeElement.js +33 -0
- package/dist/functions/activeElement.min.js +1 -0
- package/dist/functions/modifierState.d.ts +29 -0
- package/dist/functions/modifierState.js +41 -0
- package/dist/functions/modifierState.min.js +1 -0
- package/dist/main.d.ts +32 -1
- package/dist/main.js +66 -1
- package/dist/main.min.js +1 -1
- package/dist/services/CustomEventService.d.ts +37 -0
- package/dist/services/CustomEventService.js +35 -0
- package/dist/services/CustomEventService.min.js +1 -0
- package/dist/services/ElementService.js +13 -13
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/EventService.d.ts +2 -0
- package/dist/services/EventService.js +7 -1
- package/dist/services/EventService.min.js +1 -1
- package/dist/services/FocusEventService.d.ts +32 -0
- package/dist/services/FocusEventService.js +35 -0
- package/dist/services/FocusEventService.min.js +1 -0
- package/dist/services/HTMLElementService.d.ts +20 -0
- package/dist/services/HTMLElementService.js +95 -0
- package/dist/services/HTMLElementService.min.js +1 -1
- package/dist/services/InputEventService.d.ts +41 -0
- package/dist/services/InputEventService.js +47 -0
- package/dist/services/InputEventService.min.js +1 -0
- package/dist/services/KeyboardEventService.d.ts +70 -0
- package/dist/services/KeyboardEventService.js +86 -0
- package/dist/services/KeyboardEventService.min.js +1 -0
- package/dist/services/MouseEventService.d.ts +80 -0
- package/dist/services/MouseEventService.js +108 -0
- package/dist/services/MouseEventService.min.js +1 -0
- package/dist/services/PointerEventService.d.ts +51 -0
- package/dist/services/PointerEventService.js +67 -0
- package/dist/services/PointerEventService.min.js +1 -0
- package/dist/services/UIEventService.d.ts +43 -0
- package/dist/services/UIEventService.js +42 -0
- package/dist/services/UIEventService.min.js +1 -0
- package/dist/simulate.d.ts +32 -0
- package/dist/simulate.js +115 -0
- package/dist/simulate.min.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,12 +18,26 @@ else, document fragments insert their children, and a node cannot be put inside
|
|
|
18
18
|
`DOMTokenListService`, `NamedNodeMapService`, `DocumentService` / `DocumentFragmentService`, `PseudoNodeList`, and
|
|
19
19
|
`generateDocument` for creating a document.
|
|
20
20
|
|
|
21
|
+
Standard events: `createEvent(type, init, { browser, trusted })` makes the kind of event which suits the type (a click is a
|
|
22
|
+
`MouseEvent`, a keydown a `KeyboardEvent`, ...). Like the constructor in a browser it gives nothing (no bubbling, no
|
|
23
|
+
cancelling, not trusted) unless asked, but with `browser: true` it uses `eventDefaults`, the table of how the browser
|
|
24
|
+
creates each standard type (click bubbles and can be cancelled, focus does not bubble but focusin does, input bubbles
|
|
25
|
+
but cannot be cancelled, ...), and `trusted: true` makes `isTrusted` true, as for a real user action. The kinds of event
|
|
26
|
+
are `PseudoUIEvent`, `PseudoMouseEvent`, `PseudoPointerEvent`, `PseudoKeyboardEvent`, `PseudoFocusEvent`,
|
|
27
|
+
`PseudoInputEvent` and `PseudoCustomEvent`. Elements have `click()` (an untrusted click, like a script's),
|
|
28
|
+
`focus()` and `blur()` (with blur / focusout / focus / focusin and the related targets, and a focused element for each
|
|
29
|
+
tree), and `simulate.click(element)` / `simulate.keyPress(element, key)` send what a user's action sends (pointerdown,
|
|
30
|
+
mousedown, the focus moving, pointerup, mouseup, click; keydown, keyup), all trusted.
|
|
31
|
+
|
|
21
32
|
Not implemented yet (these throw a "not implemented" error or are missing): `cloneNode`, `compareDocumentPosition`, `isEqualNode`, `querySelector` /
|
|
22
33
|
`querySelectorAll`, `innerHTML` / `outerHTML` parsing, and most of the rest of the Element and Document APIs. The API
|
|
23
34
|
will change before 1.0.
|
|
24
35
|
## Modules
|
|
25
36
|
|
|
26
37
|
<dl>
|
|
38
|
+
<dt><a href="#module_pseudoDom/simulate">pseudoDom/simulate</a></dt>
|
|
39
|
+
<dd><p>Simulate what a user does, with the events the browser sends for it.</p>
|
|
40
|
+
</dd>
|
|
27
41
|
<dt><a href="#module_pseudoDom/objects">pseudoDom/objects</a> : <code>Object</code></dt>
|
|
28
42
|
<dd><p>All methods exported from this module are encapsulated within pseudoDom.</p>
|
|
29
43
|
</dd>
|
|
@@ -32,15 +46,34 @@ will change before 1.0.
|
|
|
32
46
|
## Classes
|
|
33
47
|
|
|
34
48
|
<dl>
|
|
49
|
+
<dt><a href="#UIEventService">UIEventService</a> ⇐ <code><a href="#EventService">EventService</a></code></dt>
|
|
50
|
+
<dd><p>Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
51
|
+
interface (the mouse, the keyboard, focus and input).</p>
|
|
52
|
+
</dd>
|
|
53
|
+
<dt><a href="#PointerEventService">PointerEventService</a> ⇐ <code><a href="#MouseEventService">MouseEventService</a></code></dt>
|
|
54
|
+
<dd><p>Simulate the behaviour of the PointerEvent Class when there is no DOM available.</p>
|
|
55
|
+
</dd>
|
|
35
56
|
<dt><a href="#NodeService">NodeService</a> ⇐ <code>PseudoEventTarget</code></dt>
|
|
36
57
|
<dd><p>Simulate the behaviour of the Node Class when there is no DOM available.</p>
|
|
37
58
|
</dd>
|
|
38
59
|
<dt><a href="#NamedNodeMapService">NamedNodeMapService</a></dt>
|
|
39
60
|
<dd><p>Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.</p>
|
|
40
61
|
</dd>
|
|
62
|
+
<dt><a href="#MouseEventService">MouseEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
|
|
63
|
+
<dd><p>Simulate the behaviour of the MouseEvent Class when there is no DOM available.</p>
|
|
64
|
+
</dd>
|
|
65
|
+
<dt><a href="#KeyboardEventService">KeyboardEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
|
|
66
|
+
<dd><p>Simulate the behaviour of the KeyboardEvent Class when there is no DOM available.</p>
|
|
67
|
+
</dd>
|
|
68
|
+
<dt><a href="#InputEventService">InputEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
|
|
69
|
+
<dd><p>Simulate the behaviour of the InputEvent Class when there is no DOM available.</p>
|
|
70
|
+
</dd>
|
|
41
71
|
<dt><a href="#HTMLElementService">HTMLElementService</a> ⇐ <code>PseudoElement</code></dt>
|
|
42
72
|
<dd><p>Simulate the behaviour of the HTMLElement Class when there is no DOM available.</p>
|
|
43
73
|
</dd>
|
|
74
|
+
<dt><a href="#FocusEventService">FocusEventService</a> ⇐ <code><a href="#UIEventService">UIEventService</a></code></dt>
|
|
75
|
+
<dd><p>Simulate the behaviour of the FocusEvent Class when there is no DOM available.</p>
|
|
76
|
+
</dd>
|
|
44
77
|
<dt><a href="#EventTargetService">EventTargetService</a></dt>
|
|
45
78
|
<dd><p>Simulate the behaviour of the EventTarget Class when there is no DOM available.
|
|
46
79
|
Dispatching an event sends it through the tree the way the DOM does: down from the root to the target (capture
|
|
@@ -63,6 +96,9 @@ not part of a tree, when it is inserted its children are moved into the tree ins
|
|
|
63
96
|
<dt><a href="#DOMTokenListService">DOMTokenListService</a></dt>
|
|
64
97
|
<dd><p>Simulate the behaviour of the DOMTokenList Class when there is no DOM available.</p>
|
|
65
98
|
</dd>
|
|
99
|
+
<dt><a href="#CustomEventService">CustomEventService</a> ⇐ <code><a href="#EventService">EventService</a></code></dt>
|
|
100
|
+
<dd><p>Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.</p>
|
|
101
|
+
</dd>
|
|
66
102
|
<dt><a href="#AttrService">AttrService</a> ⇐ <code><a href="#NodeService">NodeService</a></code></dt>
|
|
67
103
|
<dd><p>Simulate the behaviour of the Attr Class when there is no DOM available.</p>
|
|
68
104
|
</dd>
|
|
@@ -82,9 +118,23 @@ the linkers that hold them.</p>
|
|
|
82
118
|
</dd>
|
|
83
119
|
</dl>
|
|
84
120
|
|
|
121
|
+
## Members
|
|
122
|
+
|
|
123
|
+
<dl>
|
|
124
|
+
<dt><a href="#eventDefaults">eventDefaults</a> : <code>Object.<string, EventDefinition></code></dt>
|
|
125
|
+
<dd><p>The events which the browser itself creates (for a user action, or for something like element.click()) have these
|
|
126
|
+
options. A script which creates an event with the constructor gets none of them (everything is false) unless it asks
|
|
127
|
+
for them, which is why createEvent only uses this table when it is told the browser is creating the event.
|
|
128
|
+
The values follow the UI Events, HTML, Pointer Events, Clipboard, Drag and Drop, Touch and CSS specifications.</p>
|
|
129
|
+
</dd>
|
|
130
|
+
</dl>
|
|
131
|
+
|
|
85
132
|
## Constants
|
|
86
133
|
|
|
87
134
|
<dl>
|
|
135
|
+
<dt><a href="#focused">focused</a></dt>
|
|
136
|
+
<dd><p>The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.</p>
|
|
137
|
+
</dd>
|
|
88
138
|
<dt><a href="#HTMLElementService_1">HTMLElementService_1</a> : <code>PseudoHTMLElement</code></dt>
|
|
89
139
|
<dd></dd>
|
|
90
140
|
</dl>
|
|
@@ -92,6 +142,12 @@ the linkers that hold them.</p>
|
|
|
92
142
|
## Functions
|
|
93
143
|
|
|
94
144
|
<dl>
|
|
145
|
+
<dt><a href="#modifierKeys">modifierKeys([init])</a> ⇒ <code>ModifierKeys</code></dt>
|
|
146
|
+
<dd><p>Pick the modifier keys out of the init object of an event.</p>
|
|
147
|
+
</dd>
|
|
148
|
+
<dt><a href="#modifierState">modifierState(keys, key)</a> ⇒ <code>boolean</code></dt>
|
|
149
|
+
<dd><p>Answer getModifierState for a set of held modifier keys.</p>
|
|
150
|
+
</dd>
|
|
95
151
|
<dt><a href="#getParentNodesFromAttribute">getParentNodesFromAttribute(attr, value, node)</a> ⇒ <code>Array.<PseudoNode></code></dt>
|
|
96
152
|
<dd><p>A selector function for retrieving existing parent PseudoNode from the given child item.
|
|
97
153
|
This function will check all the parents starting from node, and scan the attributes
|
|
@@ -101,6 +157,12 @@ property for matches. The return array contains all matching parent ancestors, s
|
|
|
101
157
|
<dd><p>Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
|
|
102
158
|
order in which an event travels down through them). A node which has no parent has no ancestors.</p>
|
|
103
159
|
</dd>
|
|
160
|
+
<dt><a href="#getActiveElement">getActiveElement(root)</a> ⇒ <code>Object</code> | <code>null</code></dt>
|
|
161
|
+
<dd><p>Find the element which has the focus in a tree.</p>
|
|
162
|
+
</dd>
|
|
163
|
+
<dt><a href="#setActiveElement">setActiveElement(root, element)</a></dt>
|
|
164
|
+
<dd><p>Remember the element which has the focus in a tree.</p>
|
|
165
|
+
</dd>
|
|
104
166
|
<dt><a href="#generateNodeList">generateNodeList([innerList])</a> ⇒ <code><a href="#PseudoNodeList">PseudoNodeList</a></code></dt>
|
|
105
167
|
<dd><p>Create a PseudoNodeList, optionally starting from an existing chain of linkers.</p>
|
|
106
168
|
</dd>
|
|
@@ -112,14 +174,232 @@ tree (or list) of nodes from plain values.</p>
|
|
|
112
174
|
<dd><p>Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
|
|
113
175
|
context.</p>
|
|
114
176
|
</dd>
|
|
177
|
+
<dt><a href="#createEvent">createEvent(type, [init], [options])</a> ⇒ <code><a href="#EventService">EventService</a></code></dt>
|
|
178
|
+
<dd><p>Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
|
|
179
|
+
By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
|
|
180
|
+
the init says so, and the event is not trusted. With browser: true the event is created the way the browser creates
|
|
181
|
+
it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
|
|
182
|
+
real user action (isTrusted).</p>
|
|
183
|
+
</dd>
|
|
115
184
|
</dl>
|
|
116
185
|
|
|
186
|
+
<a name="module_pseudoDom/simulate"></a>
|
|
187
|
+
|
|
188
|
+
## pseudoDom/simulate
|
|
189
|
+
Simulate what a user does, with the events the browser sends for it.
|
|
190
|
+
|
|
191
|
+
**Version**: 1.0.0
|
|
192
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
193
|
+
|
|
194
|
+
* [pseudoDom/simulate](#module_pseudoDom/simulate)
|
|
195
|
+
* [~focusableFrom(element)](#module_pseudoDom/simulate..focusableFrom) ⇒ <code>\*</code> \| <code>null</code>
|
|
196
|
+
* [~click(element, [init])](#module_pseudoDom/simulate..click) ⇒ <code>boolean</code>
|
|
197
|
+
* [~keyPress(element, key, [init])](#module_pseudoDom/simulate..keyPress) ⇒ <code>boolean</code>
|
|
198
|
+
|
|
199
|
+
<a name="module_pseudoDom/simulate..focusableFrom"></a>
|
|
200
|
+
|
|
201
|
+
### pseudoDom/simulate~focusableFrom(element) ⇒ <code>\*</code> \| <code>null</code>
|
|
202
|
+
The nearest element (starting with the element itself) which can have the focus.
|
|
203
|
+
|
|
204
|
+
**Kind**: inner method of [<code>pseudoDom/simulate</code>](#module_pseudoDom/simulate)
|
|
205
|
+
|
|
206
|
+
| Param | Type | Description |
|
|
207
|
+
| --- | --- | --- |
|
|
208
|
+
| element | <code>\*</code> | Where to start |
|
|
209
|
+
|
|
210
|
+
<a name="module_pseudoDom/simulate..click"></a>
|
|
211
|
+
|
|
212
|
+
### pseudoDom/simulate~click(element, [init]) ⇒ <code>boolean</code>
|
|
213
|
+
Click an element the way a user does: pointerdown and mousedown, then the focus moves to the nearest element which
|
|
214
|
+
can have it (or is taken away from the one which had it) unless mousedown was cancelled, then pointerup, mouseup
|
|
215
|
+
and finally click. Every event is trusted and has the options the browser gives it. A disabled element gets nothing.
|
|
216
|
+
|
|
217
|
+
**Kind**: inner method of [<code>pseudoDom/simulate</code>](#module_pseudoDom/simulate)
|
|
218
|
+
**Returns**: <code>boolean</code> - False when the click was cancelled (or the element is disabled), so its default action did not happen
|
|
219
|
+
|
|
220
|
+
| Param | Type | Default | Description |
|
|
221
|
+
| --- | --- | --- | --- |
|
|
222
|
+
| element | <code>\*</code> | | The element to click |
|
|
223
|
+
| [init] | <code>Object</code> | <code>{}</code> | Options for the events (for example clientX, clientY, shiftKey) |
|
|
224
|
+
|
|
225
|
+
<a name="module_pseudoDom/simulate..keyPress"></a>
|
|
226
|
+
|
|
227
|
+
### pseudoDom/simulate~keyPress(element, key, [init]) ⇒ <code>boolean</code>
|
|
228
|
+
Press and release a key on an element (the element which has the focus, or one given): keydown and then keyup.
|
|
229
|
+
|
|
230
|
+
**Kind**: inner method of [<code>pseudoDom/simulate</code>](#module_pseudoDom/simulate)
|
|
231
|
+
**Returns**: <code>boolean</code> - False when keydown was cancelled, so its default action did not happen
|
|
232
|
+
|
|
233
|
+
| Param | Type | Default | Description |
|
|
234
|
+
| --- | --- | --- | --- |
|
|
235
|
+
| element | <code>\*</code> | | The element which gets the key |
|
|
236
|
+
| key | <code>string</code> | | The value of the key, such as a or Enter |
|
|
237
|
+
| [init] | <code>Object</code> | <code>{}</code> | Options for the events (for example code, shiftKey) |
|
|
238
|
+
|
|
117
239
|
<a name="module_pseudoDom/objects"></a>
|
|
118
240
|
|
|
119
241
|
## pseudoDom/objects : <code>Object</code>
|
|
120
242
|
All methods exported from this module are encapsulated within pseudoDom.
|
|
121
243
|
|
|
122
244
|
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
245
|
+
<a name="UIEventService"></a>
|
|
246
|
+
|
|
247
|
+
## UIEventService ⇐ [<code>EventService</code>](#EventService)
|
|
248
|
+
Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
|
|
249
|
+
interface (the mouse, the keyboard, focus and input).
|
|
250
|
+
|
|
251
|
+
**Kind**: global class
|
|
252
|
+
**Extends**: [<code>EventService</code>](#EventService)
|
|
253
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
254
|
+
**Properties**
|
|
255
|
+
|
|
256
|
+
| Name | Type |
|
|
257
|
+
| --- | --- |
|
|
258
|
+
| detail | <code>number</code> |
|
|
259
|
+
| view | <code>\*</code> |
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
* [UIEventService](#UIEventService) ⇐ [<code>EventService</code>](#EventService)
|
|
263
|
+
* [new UIEventService([typeArg], [init])](#new_UIEventService_new)
|
|
264
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
265
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
266
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
267
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
268
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
269
|
+
|
|
270
|
+
<a name="new_UIEventService_new"></a>
|
|
271
|
+
|
|
272
|
+
### new UIEventService([typeArg], [init])
|
|
273
|
+
|
|
274
|
+
| Param | Type | Default | Description |
|
|
275
|
+
| --- | --- | --- | --- |
|
|
276
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
277
|
+
| [init] | <code>UIEventInit</code> | <code>{}</code> | The options for the event |
|
|
278
|
+
|
|
279
|
+
<a name="EventService+inner"></a>
|
|
280
|
+
|
|
281
|
+
### uiEventService.inner ⇒ <code>EventInner</code>
|
|
282
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
283
|
+
|
|
284
|
+
**Kind**: instance property of [<code>UIEventService</code>](#UIEventService)
|
|
285
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
286
|
+
<a name="EventService+composedPath"></a>
|
|
287
|
+
|
|
288
|
+
### uiEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
289
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
290
|
+
|
|
291
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
292
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
293
|
+
<a name="EventService+preventDefault"></a>
|
|
294
|
+
|
|
295
|
+
### uiEventService.preventDefault() ⇒ <code>null</code>
|
|
296
|
+
Cancels the event (if it is cancelable).
|
|
297
|
+
|
|
298
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
299
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
300
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
301
|
+
|
|
302
|
+
### uiEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
303
|
+
For this particular event, no other listener will be called.
|
|
304
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
305
|
+
capture phase, for instance)
|
|
306
|
+
|
|
307
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
308
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
309
|
+
<a name="EventService+stopPropagation"></a>
|
|
310
|
+
|
|
311
|
+
### uiEventService.stopPropagation() ⇒ <code>null</code>
|
|
312
|
+
Stops the propagation of events further along in the Dom.
|
|
313
|
+
|
|
314
|
+
**Kind**: instance method of [<code>UIEventService</code>](#UIEventService)
|
|
315
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
316
|
+
<a name="PointerEventService"></a>
|
|
317
|
+
|
|
318
|
+
## PointerEventService ⇐ [<code>MouseEventService</code>](#MouseEventService)
|
|
319
|
+
Simulate the behaviour of the PointerEvent Class when there is no DOM available.
|
|
320
|
+
|
|
321
|
+
**Kind**: global class
|
|
322
|
+
**Extends**: [<code>MouseEventService</code>](#MouseEventService)
|
|
323
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
324
|
+
**Properties**
|
|
325
|
+
|
|
326
|
+
| Name | Type |
|
|
327
|
+
| --- | --- |
|
|
328
|
+
| pointerId | <code>number</code> |
|
|
329
|
+
| width | <code>number</code> |
|
|
330
|
+
| height | <code>number</code> |
|
|
331
|
+
| pressure | <code>number</code> |
|
|
332
|
+
| pointerType | <code>string</code> |
|
|
333
|
+
| isPrimary | <code>boolean</code> |
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
* [PointerEventService](#PointerEventService) ⇐ [<code>MouseEventService</code>](#MouseEventService)
|
|
337
|
+
* [new PointerEventService([typeArg], [init])](#new_PointerEventService_new)
|
|
338
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
339
|
+
* [.getModifierState(key)](#MouseEventService+getModifierState) ⇒ <code>boolean</code>
|
|
340
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
341
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
342
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
343
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
344
|
+
|
|
345
|
+
<a name="new_PointerEventService_new"></a>
|
|
346
|
+
|
|
347
|
+
### new PointerEventService([typeArg], [init])
|
|
348
|
+
|
|
349
|
+
| Param | Type | Default | Description |
|
|
350
|
+
| --- | --- | --- | --- |
|
|
351
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
352
|
+
| [init] | <code>PointerEventInit</code> | <code>{}</code> | The options for the event |
|
|
353
|
+
|
|
354
|
+
<a name="EventService+inner"></a>
|
|
355
|
+
|
|
356
|
+
### pointerEventService.inner ⇒ <code>EventInner</code>
|
|
357
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
358
|
+
|
|
359
|
+
**Kind**: instance property of [<code>PointerEventService</code>](#PointerEventService)
|
|
360
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
361
|
+
<a name="MouseEventService+getModifierState"></a>
|
|
362
|
+
|
|
363
|
+
### pointerEventService.getModifierState(key) ⇒ <code>boolean</code>
|
|
364
|
+
Whether a modifier key was held down when the event happened.
|
|
365
|
+
|
|
366
|
+
**Kind**: instance method of [<code>PointerEventService</code>](#PointerEventService)
|
|
367
|
+
**Overrides**: [<code>getModifierState</code>](#MouseEventService+getModifierState)
|
|
368
|
+
|
|
369
|
+
| Param | Type | Description |
|
|
370
|
+
| --- | --- | --- |
|
|
371
|
+
| key | <code>string</code> | Control, Shift, Alt or Meta |
|
|
372
|
+
|
|
373
|
+
<a name="EventService+composedPath"></a>
|
|
374
|
+
|
|
375
|
+
### pointerEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
376
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
377
|
+
|
|
378
|
+
**Kind**: instance method of [<code>PointerEventService</code>](#PointerEventService)
|
|
379
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
380
|
+
<a name="EventService+preventDefault"></a>
|
|
381
|
+
|
|
382
|
+
### pointerEventService.preventDefault() ⇒ <code>null</code>
|
|
383
|
+
Cancels the event (if it is cancelable).
|
|
384
|
+
|
|
385
|
+
**Kind**: instance method of [<code>PointerEventService</code>](#PointerEventService)
|
|
386
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
387
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
388
|
+
|
|
389
|
+
### pointerEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
390
|
+
For this particular event, no other listener will be called.
|
|
391
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
392
|
+
capture phase, for instance)
|
|
393
|
+
|
|
394
|
+
**Kind**: instance method of [<code>PointerEventService</code>](#PointerEventService)
|
|
395
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
396
|
+
<a name="EventService+stopPropagation"></a>
|
|
397
|
+
|
|
398
|
+
### pointerEventService.stopPropagation() ⇒ <code>null</code>
|
|
399
|
+
Stops the propagation of events further along in the Dom.
|
|
400
|
+
|
|
401
|
+
**Kind**: instance method of [<code>PointerEventService</code>](#PointerEventService)
|
|
402
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
123
403
|
<a name="NodeService"></a>
|
|
124
404
|
|
|
125
405
|
## NodeService ⇐ <code>PseudoEventTarget</code>
|
|
@@ -279,6 +559,249 @@ Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.
|
|
|
279
559
|
| --- | --- | --- | --- |
|
|
280
560
|
| [attributes] | <code>Array.<PseudoAttr></code> | <code>[]</code> | The attributes to start with |
|
|
281
561
|
|
|
562
|
+
<a name="MouseEventService"></a>
|
|
563
|
+
|
|
564
|
+
## MouseEventService ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
565
|
+
Simulate the behaviour of the MouseEvent Class when there is no DOM available.
|
|
566
|
+
|
|
567
|
+
**Kind**: global class
|
|
568
|
+
**Extends**: [<code>UIEventService</code>](#UIEventService)
|
|
569
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
570
|
+
**Properties**
|
|
571
|
+
|
|
572
|
+
| Name | Type |
|
|
573
|
+
| --- | --- |
|
|
574
|
+
| screenX | <code>number</code> |
|
|
575
|
+
| screenY | <code>number</code> |
|
|
576
|
+
| clientX | <code>number</code> |
|
|
577
|
+
| clientY | <code>number</code> |
|
|
578
|
+
| button | <code>number</code> |
|
|
579
|
+
| buttons | <code>number</code> |
|
|
580
|
+
| relatedTarget | <code>PseudoEventTarget</code> \| <code>null</code> |
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
* [MouseEventService](#MouseEventService) ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
584
|
+
* [new MouseEventService([typeArg], [init])](#new_MouseEventService_new)
|
|
585
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
586
|
+
* [.getModifierState(key)](#MouseEventService+getModifierState) ⇒ <code>boolean</code>
|
|
587
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
588
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
589
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
590
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
591
|
+
|
|
592
|
+
<a name="new_MouseEventService_new"></a>
|
|
593
|
+
|
|
594
|
+
### new MouseEventService([typeArg], [init])
|
|
595
|
+
|
|
596
|
+
| Param | Type | Default | Description |
|
|
597
|
+
| --- | --- | --- | --- |
|
|
598
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
599
|
+
| [init] | <code>MouseEventInit</code> | <code>{}</code> | The options for the event |
|
|
600
|
+
|
|
601
|
+
<a name="EventService+inner"></a>
|
|
602
|
+
|
|
603
|
+
### mouseEventService.inner ⇒ <code>EventInner</code>
|
|
604
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
605
|
+
|
|
606
|
+
**Kind**: instance property of [<code>MouseEventService</code>](#MouseEventService)
|
|
607
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
608
|
+
<a name="MouseEventService+getModifierState"></a>
|
|
609
|
+
|
|
610
|
+
### mouseEventService.getModifierState(key) ⇒ <code>boolean</code>
|
|
611
|
+
Whether a modifier key was held down when the event happened.
|
|
612
|
+
|
|
613
|
+
**Kind**: instance method of [<code>MouseEventService</code>](#MouseEventService)
|
|
614
|
+
|
|
615
|
+
| Param | Type | Description |
|
|
616
|
+
| --- | --- | --- |
|
|
617
|
+
| key | <code>string</code> | Control, Shift, Alt or Meta |
|
|
618
|
+
|
|
619
|
+
<a name="EventService+composedPath"></a>
|
|
620
|
+
|
|
621
|
+
### mouseEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
622
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
623
|
+
|
|
624
|
+
**Kind**: instance method of [<code>MouseEventService</code>](#MouseEventService)
|
|
625
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
626
|
+
<a name="EventService+preventDefault"></a>
|
|
627
|
+
|
|
628
|
+
### mouseEventService.preventDefault() ⇒ <code>null</code>
|
|
629
|
+
Cancels the event (if it is cancelable).
|
|
630
|
+
|
|
631
|
+
**Kind**: instance method of [<code>MouseEventService</code>](#MouseEventService)
|
|
632
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
633
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
634
|
+
|
|
635
|
+
### mouseEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
636
|
+
For this particular event, no other listener will be called.
|
|
637
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
638
|
+
capture phase, for instance)
|
|
639
|
+
|
|
640
|
+
**Kind**: instance method of [<code>MouseEventService</code>](#MouseEventService)
|
|
641
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
642
|
+
<a name="EventService+stopPropagation"></a>
|
|
643
|
+
|
|
644
|
+
### mouseEventService.stopPropagation() ⇒ <code>null</code>
|
|
645
|
+
Stops the propagation of events further along in the Dom.
|
|
646
|
+
|
|
647
|
+
**Kind**: instance method of [<code>MouseEventService</code>](#MouseEventService)
|
|
648
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
649
|
+
<a name="KeyboardEventService"></a>
|
|
650
|
+
|
|
651
|
+
## KeyboardEventService ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
652
|
+
Simulate the behaviour of the KeyboardEvent Class when there is no DOM available.
|
|
653
|
+
|
|
654
|
+
**Kind**: global class
|
|
655
|
+
**Extends**: [<code>UIEventService</code>](#UIEventService)
|
|
656
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
657
|
+
**Properties**
|
|
658
|
+
|
|
659
|
+
| Name | Type |
|
|
660
|
+
| --- | --- |
|
|
661
|
+
| key | <code>string</code> |
|
|
662
|
+
| code | <code>string</code> |
|
|
663
|
+
| location | <code>number</code> |
|
|
664
|
+
| repeat | <code>boolean</code> |
|
|
665
|
+
| isComposing | <code>boolean</code> |
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
* [KeyboardEventService](#KeyboardEventService) ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
669
|
+
* [new KeyboardEventService([typeArg], [init])](#new_KeyboardEventService_new)
|
|
670
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
671
|
+
* [.getModifierState(key)](#KeyboardEventService+getModifierState) ⇒ <code>boolean</code>
|
|
672
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
673
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
674
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
675
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
676
|
+
|
|
677
|
+
<a name="new_KeyboardEventService_new"></a>
|
|
678
|
+
|
|
679
|
+
### new KeyboardEventService([typeArg], [init])
|
|
680
|
+
|
|
681
|
+
| Param | Type | Default | Description |
|
|
682
|
+
| --- | --- | --- | --- |
|
|
683
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
684
|
+
| [init] | <code>KeyboardEventInit</code> | <code>{}</code> | The options for the event |
|
|
685
|
+
|
|
686
|
+
<a name="EventService+inner"></a>
|
|
687
|
+
|
|
688
|
+
### keyboardEventService.inner ⇒ <code>EventInner</code>
|
|
689
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
690
|
+
|
|
691
|
+
**Kind**: instance property of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
692
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
693
|
+
<a name="KeyboardEventService+getModifierState"></a>
|
|
694
|
+
|
|
695
|
+
### keyboardEventService.getModifierState(key) ⇒ <code>boolean</code>
|
|
696
|
+
Whether a modifier key was held down when the event happened.
|
|
697
|
+
|
|
698
|
+
**Kind**: instance method of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
699
|
+
|
|
700
|
+
| Param | Type | Description |
|
|
701
|
+
| --- | --- | --- |
|
|
702
|
+
| key | <code>string</code> | Control, Shift, Alt or Meta |
|
|
703
|
+
|
|
704
|
+
<a name="EventService+composedPath"></a>
|
|
705
|
+
|
|
706
|
+
### keyboardEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
707
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
708
|
+
|
|
709
|
+
**Kind**: instance method of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
710
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
711
|
+
<a name="EventService+preventDefault"></a>
|
|
712
|
+
|
|
713
|
+
### keyboardEventService.preventDefault() ⇒ <code>null</code>
|
|
714
|
+
Cancels the event (if it is cancelable).
|
|
715
|
+
|
|
716
|
+
**Kind**: instance method of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
717
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
718
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
719
|
+
|
|
720
|
+
### keyboardEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
721
|
+
For this particular event, no other listener will be called.
|
|
722
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
723
|
+
capture phase, for instance)
|
|
724
|
+
|
|
725
|
+
**Kind**: instance method of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
726
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
727
|
+
<a name="EventService+stopPropagation"></a>
|
|
728
|
+
|
|
729
|
+
### keyboardEventService.stopPropagation() ⇒ <code>null</code>
|
|
730
|
+
Stops the propagation of events further along in the Dom.
|
|
731
|
+
|
|
732
|
+
**Kind**: instance method of [<code>KeyboardEventService</code>](#KeyboardEventService)
|
|
733
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
734
|
+
<a name="InputEventService"></a>
|
|
735
|
+
|
|
736
|
+
## InputEventService ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
737
|
+
Simulate the behaviour of the InputEvent Class when there is no DOM available.
|
|
738
|
+
|
|
739
|
+
**Kind**: global class
|
|
740
|
+
**Extends**: [<code>UIEventService</code>](#UIEventService)
|
|
741
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
742
|
+
**Properties**
|
|
743
|
+
|
|
744
|
+
| Name | Type |
|
|
745
|
+
| --- | --- |
|
|
746
|
+
| data | <code>string</code> \| <code>null</code> |
|
|
747
|
+
| inputType | <code>string</code> |
|
|
748
|
+
| isComposing | <code>boolean</code> |
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
* [InputEventService](#InputEventService) ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
752
|
+
* [new InputEventService([typeArg], [init])](#new_InputEventService_new)
|
|
753
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
754
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
755
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
756
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
757
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
758
|
+
|
|
759
|
+
<a name="new_InputEventService_new"></a>
|
|
760
|
+
|
|
761
|
+
### new InputEventService([typeArg], [init])
|
|
762
|
+
|
|
763
|
+
| Param | Type | Default | Description |
|
|
764
|
+
| --- | --- | --- | --- |
|
|
765
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
766
|
+
| [init] | <code>InputEventInit</code> | <code>{}</code> | The options for the event |
|
|
767
|
+
|
|
768
|
+
<a name="EventService+inner"></a>
|
|
769
|
+
|
|
770
|
+
### inputEventService.inner ⇒ <code>EventInner</code>
|
|
771
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
772
|
+
|
|
773
|
+
**Kind**: instance property of [<code>InputEventService</code>](#InputEventService)
|
|
774
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
775
|
+
<a name="EventService+composedPath"></a>
|
|
776
|
+
|
|
777
|
+
### inputEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
778
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
779
|
+
|
|
780
|
+
**Kind**: instance method of [<code>InputEventService</code>](#InputEventService)
|
|
781
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
782
|
+
<a name="EventService+preventDefault"></a>
|
|
783
|
+
|
|
784
|
+
### inputEventService.preventDefault() ⇒ <code>null</code>
|
|
785
|
+
Cancels the event (if it is cancelable).
|
|
786
|
+
|
|
787
|
+
**Kind**: instance method of [<code>InputEventService</code>](#InputEventService)
|
|
788
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
789
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
790
|
+
|
|
791
|
+
### inputEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
792
|
+
For this particular event, no other listener will be called.
|
|
793
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
794
|
+
capture phase, for instance)
|
|
795
|
+
|
|
796
|
+
**Kind**: instance method of [<code>InputEventService</code>](#InputEventService)
|
|
797
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
798
|
+
<a name="EventService+stopPropagation"></a>
|
|
799
|
+
|
|
800
|
+
### inputEventService.stopPropagation() ⇒ <code>null</code>
|
|
801
|
+
Stops the propagation of events further along in the Dom.
|
|
802
|
+
|
|
803
|
+
**Kind**: instance method of [<code>InputEventService</code>](#InputEventService)
|
|
804
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
282
805
|
<a name="HTMLElementService"></a>
|
|
283
806
|
|
|
284
807
|
## HTMLElementService ⇐ <code>PseudoElement</code>
|
|
@@ -300,6 +823,14 @@ Simulate the behaviour of the HTMLElement Class when there is no DOM available.
|
|
|
300
823
|
| style | <code>Object</code> | A container to define all applied inline-styles |
|
|
301
824
|
| title | <code>string</code> | The title attribute which affects the text visible on hover |
|
|
302
825
|
|
|
826
|
+
|
|
827
|
+
* [HTMLElementService](#HTMLElementService) ⇐ <code>PseudoElement</code>
|
|
828
|
+
* [new HTMLElementService([elementOptions])](#new_HTMLElementService_new)
|
|
829
|
+
* [.canFocus](#HTMLElementService+canFocus) ⇒ <code>boolean</code>
|
|
830
|
+
* [.click()](#HTMLElementService+click)
|
|
831
|
+
* [.focus()](#HTMLElementService+focus)
|
|
832
|
+
* [.blur()](#HTMLElementService+blur)
|
|
833
|
+
|
|
303
834
|
<a name="new_HTMLElementService_new"></a>
|
|
304
835
|
|
|
305
836
|
### new HTMLElementService([elementOptions])
|
|
@@ -313,6 +844,102 @@ Simulate the HTMLElement object when the Dom is not available
|
|
|
313
844
|
| [elementOptions.parent] | <code>PseudoNode</code> \| <code>Object</code> | <code>{}</code> |
|
|
314
845
|
| [elementOptions.children] | <code>Array</code> | <code>[]</code> |
|
|
315
846
|
|
|
847
|
+
<a name="HTMLElementService+canFocus"></a>
|
|
848
|
+
|
|
849
|
+
### htmlElementService.canFocus ⇒ <code>boolean</code>
|
|
850
|
+
Whether this element can have the focus: form controls and links which are not disabled, and anything with a tabindex.
|
|
851
|
+
|
|
852
|
+
**Kind**: instance property of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
853
|
+
<a name="HTMLElementService+click"></a>
|
|
854
|
+
|
|
855
|
+
### htmlElementService.click()
|
|
856
|
+
Click the element: a click event is sent to it, which bubbles and can be cancelled, like one from a user but a
|
|
857
|
+
script made it (so it is not trusted). A disabled element does nothing.
|
|
858
|
+
|
|
859
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
860
|
+
<a name="HTMLElementService+focus"></a>
|
|
861
|
+
|
|
862
|
+
### htmlElementService.focus()
|
|
863
|
+
Give the element the focus. The element which had it gets blur then focusout, and this one gets focus then
|
|
864
|
+
focusin (blur and focus do not bubble, focusin and focusout do). Nothing happens when the element cannot have the
|
|
865
|
+
focus or already has it.
|
|
866
|
+
|
|
867
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
868
|
+
<a name="HTMLElementService+blur"></a>
|
|
869
|
+
|
|
870
|
+
### htmlElementService.blur()
|
|
871
|
+
Take the focus away from the element, when it has it: it gets blur then focusout.
|
|
872
|
+
|
|
873
|
+
**Kind**: instance method of [<code>HTMLElementService</code>](#HTMLElementService)
|
|
874
|
+
<a name="FocusEventService"></a>
|
|
875
|
+
|
|
876
|
+
## FocusEventService ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
877
|
+
Simulate the behaviour of the FocusEvent Class when there is no DOM available.
|
|
878
|
+
|
|
879
|
+
**Kind**: global class
|
|
880
|
+
**Extends**: [<code>UIEventService</code>](#UIEventService)
|
|
881
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
882
|
+
**Properties**
|
|
883
|
+
|
|
884
|
+
| Name | Type |
|
|
885
|
+
| --- | --- |
|
|
886
|
+
| relatedTarget | <code>PseudoEventTarget</code> \| <code>null</code> |
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
* [FocusEventService](#FocusEventService) ⇐ [<code>UIEventService</code>](#UIEventService)
|
|
890
|
+
* [new FocusEventService([typeArg], [init])](#new_FocusEventService_new)
|
|
891
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
892
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
893
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
894
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
895
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
896
|
+
|
|
897
|
+
<a name="new_FocusEventService_new"></a>
|
|
898
|
+
|
|
899
|
+
### new FocusEventService([typeArg], [init])
|
|
900
|
+
|
|
901
|
+
| Param | Type | Default | Description |
|
|
902
|
+
| --- | --- | --- | --- |
|
|
903
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
904
|
+
| [init] | <code>FocusEventInit</code> | <code>{}</code> | The options for the event |
|
|
905
|
+
|
|
906
|
+
<a name="EventService+inner"></a>
|
|
907
|
+
|
|
908
|
+
### focusEventService.inner ⇒ <code>EventInner</code>
|
|
909
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
910
|
+
|
|
911
|
+
**Kind**: instance property of [<code>FocusEventService</code>](#FocusEventService)
|
|
912
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
913
|
+
<a name="EventService+composedPath"></a>
|
|
914
|
+
|
|
915
|
+
### focusEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
916
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
917
|
+
|
|
918
|
+
**Kind**: instance method of [<code>FocusEventService</code>](#FocusEventService)
|
|
919
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
920
|
+
<a name="EventService+preventDefault"></a>
|
|
921
|
+
|
|
922
|
+
### focusEventService.preventDefault() ⇒ <code>null</code>
|
|
923
|
+
Cancels the event (if it is cancelable).
|
|
924
|
+
|
|
925
|
+
**Kind**: instance method of [<code>FocusEventService</code>](#FocusEventService)
|
|
926
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
927
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
928
|
+
|
|
929
|
+
### focusEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
930
|
+
For this particular event, no other listener will be called.
|
|
931
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
932
|
+
capture phase, for instance)
|
|
933
|
+
|
|
934
|
+
**Kind**: instance method of [<code>FocusEventService</code>](#FocusEventService)
|
|
935
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
936
|
+
<a name="EventService+stopPropagation"></a>
|
|
937
|
+
|
|
938
|
+
### focusEventService.stopPropagation() ⇒ <code>null</code>
|
|
939
|
+
Stops the propagation of events further along in the Dom.
|
|
940
|
+
|
|
941
|
+
**Kind**: instance method of [<code>FocusEventService</code>](#FocusEventService)
|
|
942
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
316
943
|
<a name="EventTargetService"></a>
|
|
317
944
|
|
|
318
945
|
## EventTargetService
|
|
@@ -917,6 +1544,75 @@ Simulate the behaviour of the DOMTokenList Class when there is no DOM available.
|
|
|
917
1544
|
| [value] | <code>string</code> | <code>"''"</code> | The space separated tokens to start with |
|
|
918
1545
|
| [onChange] | <code>function</code> | | Called with the new value whenever the tokens change |
|
|
919
1546
|
|
|
1547
|
+
<a name="CustomEventService"></a>
|
|
1548
|
+
|
|
1549
|
+
## CustomEventService ⇐ [<code>EventService</code>](#EventService)
|
|
1550
|
+
Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.
|
|
1551
|
+
|
|
1552
|
+
**Kind**: global class
|
|
1553
|
+
**Extends**: [<code>EventService</code>](#EventService)
|
|
1554
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
1555
|
+
**Properties**
|
|
1556
|
+
|
|
1557
|
+
| Name | Type |
|
|
1558
|
+
| --- | --- |
|
|
1559
|
+
| detail | <code>\*</code> |
|
|
1560
|
+
|
|
1561
|
+
|
|
1562
|
+
* [CustomEventService](#CustomEventService) ⇐ [<code>EventService</code>](#EventService)
|
|
1563
|
+
* [new CustomEventService([typeArg], [init])](#new_CustomEventService_new)
|
|
1564
|
+
* [.inner](#EventService+inner) ⇒ <code>EventInner</code>
|
|
1565
|
+
* [.composedPath()](#EventService+composedPath) ⇒ <code>Array.<PseudoEventTarget></code>
|
|
1566
|
+
* [.preventDefault()](#EventService+preventDefault) ⇒ <code>null</code>
|
|
1567
|
+
* [.stopImmediatePropagation()](#EventService+stopImmediatePropagation) ⇒ <code>null</code>
|
|
1568
|
+
* [.stopPropagation()](#EventService+stopPropagation) ⇒ <code>null</code>
|
|
1569
|
+
|
|
1570
|
+
<a name="new_CustomEventService_new"></a>
|
|
1571
|
+
|
|
1572
|
+
### new CustomEventService([typeArg], [init])
|
|
1573
|
+
|
|
1574
|
+
| Param | Type | Default | Description |
|
|
1575
|
+
| --- | --- | --- | --- |
|
|
1576
|
+
| [typeArg] | <code>string</code> | <code>"''"</code> | The type of the event |
|
|
1577
|
+
| [init] | <code>CustomEventInit</code> | <code>{}</code> | The options for the event |
|
|
1578
|
+
|
|
1579
|
+
<a name="EventService+inner"></a>
|
|
1580
|
+
|
|
1581
|
+
### customEventService.inner ⇒ <code>EventInner</code>
|
|
1582
|
+
Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
1583
|
+
|
|
1584
|
+
**Kind**: instance property of [<code>CustomEventService</code>](#CustomEventService)
|
|
1585
|
+
**Overrides**: [<code>inner</code>](#EventService+inner)
|
|
1586
|
+
<a name="EventService+composedPath"></a>
|
|
1587
|
+
|
|
1588
|
+
### customEventService.composedPath() ⇒ <code>Array.<PseudoEventTarget></code>
|
|
1589
|
+
Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
1590
|
+
|
|
1591
|
+
**Kind**: instance method of [<code>CustomEventService</code>](#CustomEventService)
|
|
1592
|
+
**Overrides**: [<code>composedPath</code>](#EventService+composedPath)
|
|
1593
|
+
<a name="EventService+preventDefault"></a>
|
|
1594
|
+
|
|
1595
|
+
### customEventService.preventDefault() ⇒ <code>null</code>
|
|
1596
|
+
Cancels the event (if it is cancelable).
|
|
1597
|
+
|
|
1598
|
+
**Kind**: instance method of [<code>CustomEventService</code>](#CustomEventService)
|
|
1599
|
+
**Overrides**: [<code>preventDefault</code>](#EventService+preventDefault)
|
|
1600
|
+
<a name="EventService+stopImmediatePropagation"></a>
|
|
1601
|
+
|
|
1602
|
+
### customEventService.stopImmediatePropagation() ⇒ <code>null</code>
|
|
1603
|
+
For this particular event, no other listener will be called.
|
|
1604
|
+
Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
1605
|
+
capture phase, for instance)
|
|
1606
|
+
|
|
1607
|
+
**Kind**: instance method of [<code>CustomEventService</code>](#CustomEventService)
|
|
1608
|
+
**Overrides**: [<code>stopImmediatePropagation</code>](#EventService+stopImmediatePropagation)
|
|
1609
|
+
<a name="EventService+stopPropagation"></a>
|
|
1610
|
+
|
|
1611
|
+
### customEventService.stopPropagation() ⇒ <code>null</code>
|
|
1612
|
+
Stops the propagation of events further along in the Dom.
|
|
1613
|
+
|
|
1614
|
+
**Kind**: instance method of [<code>CustomEventService</code>](#CustomEventService)
|
|
1615
|
+
**Overrides**: [<code>stopPropagation</code>](#EventService+stopPropagation)
|
|
920
1616
|
<a name="AttrService"></a>
|
|
921
1617
|
|
|
922
1618
|
## AttrService ⇐ [<code>NodeService</code>](#NodeService)
|
|
@@ -1442,10 +2138,48 @@ current one.
|
|
|
1442
2138
|
| --- | --- |
|
|
1443
2139
|
| event | <code>PseudoEvent</code> |
|
|
1444
2140
|
|
|
2141
|
+
<a name="eventDefaults"></a>
|
|
2142
|
+
|
|
2143
|
+
## eventDefaults : <code>Object.<string, EventDefinition></code>
|
|
2144
|
+
The events which the browser itself creates (for a user action, or for something like element.click()) have these
|
|
2145
|
+
options. A script which creates an event with the constructor gets none of them (everything is false) unless it asks
|
|
2146
|
+
for them, which is why createEvent only uses this table when it is told the browser is creating the event.
|
|
2147
|
+
The values follow the UI Events, HTML, Pointer Events, Clipboard, Drag and Drop, Touch and CSS specifications.
|
|
2148
|
+
|
|
2149
|
+
**Kind**: global variable
|
|
2150
|
+
<a name="focused"></a>
|
|
2151
|
+
|
|
2152
|
+
## focused
|
|
2153
|
+
The element which has the focus, kept for each tree (the root node of the tree it is in), like document.activeElement.
|
|
2154
|
+
|
|
2155
|
+
**Kind**: global constant
|
|
1445
2156
|
<a name="HTMLElementService_1"></a>
|
|
1446
2157
|
|
|
1447
2158
|
## HTMLElementService\_1 : <code>PseudoHTMLElement</code>
|
|
1448
2159
|
**Kind**: global constant
|
|
2160
|
+
<a name="modifierKeys"></a>
|
|
2161
|
+
|
|
2162
|
+
## modifierKeys([init]) ⇒ <code>ModifierKeys</code>
|
|
2163
|
+
Pick the modifier keys out of the init object of an event.
|
|
2164
|
+
|
|
2165
|
+
**Kind**: global function
|
|
2166
|
+
|
|
2167
|
+
| Param | Type | Default | Description |
|
|
2168
|
+
| --- | --- | --- | --- |
|
|
2169
|
+
| [init] | <code>Object</code> | <code>{}</code> | The init of an event |
|
|
2170
|
+
|
|
2171
|
+
<a name="modifierState"></a>
|
|
2172
|
+
|
|
2173
|
+
## modifierState(keys, key) ⇒ <code>boolean</code>
|
|
2174
|
+
Answer getModifierState for a set of held modifier keys.
|
|
2175
|
+
|
|
2176
|
+
**Kind**: global function
|
|
2177
|
+
|
|
2178
|
+
| Param | Type | Description |
|
|
2179
|
+
| --- | --- | --- |
|
|
2180
|
+
| keys | <code>ModifierKeys</code> | The modifier keys which were held down |
|
|
2181
|
+
| key | <code>string</code> | The name of the modifier (Control, Shift, Alt or Meta) |
|
|
2182
|
+
|
|
1449
2183
|
<a name="getParentNodesFromAttribute"></a>
|
|
1450
2184
|
|
|
1451
2185
|
## getParentNodesFromAttribute(attr, value, node) ⇒ <code>Array.<PseudoNode></code>
|
|
@@ -1473,6 +2207,29 @@ order in which an event travels down through them). A node which has no parent h
|
|
|
1473
2207
|
| --- | --- | --- |
|
|
1474
2208
|
| node | <code>PseudoEventTarget</code> \| <code>PseudoNode</code> \| <code>\*</code> | The node to find the ancestors of |
|
|
1475
2209
|
|
|
2210
|
+
<a name="getActiveElement"></a>
|
|
2211
|
+
|
|
2212
|
+
## getActiveElement(root) ⇒ <code>Object</code> \| <code>null</code>
|
|
2213
|
+
Find the element which has the focus in a tree.
|
|
2214
|
+
|
|
2215
|
+
**Kind**: global function
|
|
2216
|
+
|
|
2217
|
+
| Param | Type | Description |
|
|
2218
|
+
| --- | --- | --- |
|
|
2219
|
+
| root | <code>Object</code> | The root node of the tree |
|
|
2220
|
+
|
|
2221
|
+
<a name="setActiveElement"></a>
|
|
2222
|
+
|
|
2223
|
+
## setActiveElement(root, element)
|
|
2224
|
+
Remember the element which has the focus in a tree.
|
|
2225
|
+
|
|
2226
|
+
**Kind**: global function
|
|
2227
|
+
|
|
2228
|
+
| Param | Type | Description |
|
|
2229
|
+
| --- | --- | --- |
|
|
2230
|
+
| root | <code>Object</code> | The root node of the tree |
|
|
2231
|
+
| element | <code>Object</code> \| <code>null</code> | The element which now has the focus, or null when nothing has it |
|
|
2232
|
+
|
|
1476
2233
|
<a name="generateNodeList"></a>
|
|
1477
2234
|
|
|
1478
2235
|
## generateNodeList([innerList]) ⇒ [<code>PseudoNodeList</code>](#PseudoNodeList)
|
|
@@ -1537,3 +2294,20 @@ Create an instance of HTMLElement if not available
|
|
|
1537
2294
|
Define document when not available
|
|
1538
2295
|
|
|
1539
2296
|
**Kind**: inner constant of [<code>generateDocument</code>](#generateDocument)
|
|
2297
|
+
<a name="createEvent"></a>
|
|
2298
|
+
|
|
2299
|
+
## createEvent(type, [init], [options]) ⇒ [<code>EventService</code>](#EventService)
|
|
2300
|
+
Create an event of the kind which suits its type (a click is a MouseEvent, a keydown a KeyboardEvent, ...).
|
|
2301
|
+
By default this is like using the constructor of the event in a script: nothing bubbles or can be cancelled unless
|
|
2302
|
+
the init says so, and the event is not trusted. With browser: true the event is created the way the browser creates
|
|
2303
|
+
it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
|
|
2304
|
+
real user action (isTrusted).
|
|
2305
|
+
|
|
2306
|
+
**Kind**: global function
|
|
2307
|
+
|
|
2308
|
+
| Param | Type | Default | Description |
|
|
2309
|
+
| --- | --- | --- | --- |
|
|
2310
|
+
| type | <code>string</code> | | The type of the event, such as click |
|
|
2311
|
+
| [init] | <code>Object</code> | <code>{}</code> | The options for the event (bubbles, cancelable, composed and those of its kind of event) |
|
|
2312
|
+
| [options] | <code>CreateEventOptions</code> | <code>{}</code> | Whether the browser is creating the event, and whether it is trusted |
|
|
2313
|
+
|