pseudo-dom 0.17.0 → 1.0.1

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.
Files changed (99) hide show
  1. package/README.md +63 -5869
  2. package/browser/pseudo-dom.js +304 -688
  3. package/browser/pseudo-dom.min.js +1 -1
  4. package/dist/classes/PseudoEventListener.d.ts +11 -37
  5. package/dist/classes/PseudoEventListener.js +11 -37
  6. package/dist/classes/PseudoHTMLDocument.d.ts +4 -12
  7. package/dist/classes/PseudoHTMLDocument.js +1 -11
  8. package/dist/classes/PseudoNodeList.d.ts +1 -9
  9. package/dist/classes/PseudoNodeList.js +1 -9
  10. package/dist/factories/createDataset.d.ts +1 -3
  11. package/dist/factories/createDataset.js +3 -8
  12. package/dist/factories/createEvent.d.ts +5 -9
  13. package/dist/factories/createEvent.js +3 -5
  14. package/dist/factories/createStyleDeclaration.d.ts +4 -10
  15. package/dist/factories/createStyleDeclaration.js +4 -10
  16. package/dist/factories/cssSelectAdapter.d.ts +0 -2
  17. package/dist/factories/cssSelectAdapter.js +3 -8
  18. package/dist/factories/eventDefaults.d.ts +5 -9
  19. package/dist/factories/eventDefaults.js +1 -4
  20. package/dist/factories/generateDocument.d.ts +2 -4
  21. package/dist/factories/generateDocument.js +86 -82
  22. package/dist/factories/generateDocument.min.js +1 -1
  23. package/dist/factories/generateNodeList.d.ts +1 -2
  24. package/dist/factories/generateNodeList.js +1 -2
  25. package/dist/factories/installGlobal.d.ts +2 -3
  26. package/dist/factories/installGlobal.js +3 -6
  27. package/dist/factories/logElement.d.ts +2 -4
  28. package/dist/factories/logElement.js +3 -7
  29. package/dist/factories/parseHTML.d.ts +3 -5
  30. package/dist/factories/parseHTML.js +4 -8
  31. package/dist/factories/query.d.ts +8 -16
  32. package/dist/factories/query.js +9 -19
  33. package/dist/factories/serializeHTML.d.ts +4 -10
  34. package/dist/factories/serializeHTML.js +12 -25
  35. package/dist/functions/activeElement.d.ts +3 -6
  36. package/dist/functions/activeElement.js +3 -6
  37. package/dist/functions/getElementById.d.ts +2 -4
  38. package/dist/functions/getElementById.js +2 -4
  39. package/dist/functions/getParentNodes.d.ts +1 -3
  40. package/dist/functions/getParentNodes.js +1 -3
  41. package/dist/functions/getParentNodesFromAttribute.d.ts +3 -5
  42. package/dist/functions/getParentNodesFromAttribute.js +3 -5
  43. package/dist/functions/modifierState.d.ts +3 -12
  44. package/dist/functions/modifierState.js +3 -7
  45. package/dist/interfaces/PseudoCSSStyleDeclaration.d.ts +1 -1
  46. package/dist/interfaces/PseudoDocument.d.ts +4 -9
  47. package/dist/interfaces/PseudoDocumentFragment.d.ts +1 -2
  48. package/dist/interfaces/PseudoElement.d.ts +39 -78
  49. package/dist/interfaces/PseudoEvent.d.ts +11 -43
  50. package/dist/interfaces/PseudoEvent.js +1 -3
  51. package/dist/interfaces/PseudoEventTarget.d.ts +7 -16
  52. package/dist/interfaces/PseudoHTMLCollection.d.ts +2 -4
  53. package/dist/interfaces/PseudoHTMLElement.d.ts +8 -13
  54. package/dist/interfaces/PseudoNode.d.ts +3 -13
  55. package/dist/main.d.ts +1 -6
  56. package/dist/main.js +1 -6
  57. package/dist/services/AttrService.d.ts +5 -9
  58. package/dist/services/AttrService.js +5 -9
  59. package/dist/services/CSSStyleDeclarationService.d.ts +10 -23
  60. package/dist/services/CSSStyleDeclarationService.js +10 -23
  61. package/dist/services/CustomEventService.d.ts +4 -15
  62. package/dist/services/CustomEventService.js +3 -10
  63. package/dist/services/DOMTokenListService.d.ts +2 -5
  64. package/dist/services/DOMTokenListService.js +2 -5
  65. package/dist/services/DocumentFragmentService.d.ts +1 -5
  66. package/dist/services/DocumentFragmentService.js +1 -5
  67. package/dist/services/DocumentService.d.ts +4 -12
  68. package/dist/services/DocumentService.js +4 -12
  69. package/dist/services/ElementService.d.ts +62 -120
  70. package/dist/services/ElementService.js +61 -117
  71. package/dist/services/EventService.d.ts +6 -44
  72. package/dist/services/EventService.js +18 -44
  73. package/dist/services/EventTargetService.d.ts +16 -28
  74. package/dist/services/EventTargetService.js +16 -28
  75. package/dist/services/FocusEventService.d.ts +4 -12
  76. package/dist/services/FocusEventService.js +3 -10
  77. package/dist/services/HTMLCollectionService.d.ts +6 -16
  78. package/dist/services/HTMLCollectionService.js +6 -16
  79. package/dist/services/HTMLElementService.d.ts +132 -154
  80. package/dist/services/HTMLElementService.js +333 -353
  81. package/dist/services/InputEventService.d.ts +5 -16
  82. package/dist/services/InputEventService.js +3 -12
  83. package/dist/services/KeyboardEventService.d.ts +8 -26
  84. package/dist/services/KeyboardEventService.js +4 -16
  85. package/dist/services/MouseEventService.d.ts +7 -30
  86. package/dist/services/MouseEventService.js +4 -18
  87. package/dist/services/NamedNodeMapService.d.ts +1 -4
  88. package/dist/services/NamedNodeMapService.js +1 -4
  89. package/dist/services/NodeService.d.ts +38 -69
  90. package/dist/services/NodeService.js +39 -72
  91. package/dist/services/PointerEventService.d.ts +4 -22
  92. package/dist/services/PointerEventService.js +3 -15
  93. package/dist/services/ShadowRootService.d.ts +0 -3
  94. package/dist/services/ShadowRootService.js +0 -3
  95. package/dist/services/UIEventService.d.ts +5 -17
  96. package/dist/services/UIEventService.js +3 -11
  97. package/dist/simulate.d.ts +7 -9
  98. package/dist/simulate.js +9 -15
  99. package/package.json +8 -7
@@ -6,26 +6,18 @@
6
6
  value: true
7
7
  })
8
8
  /**
9
- * @file Substitute for the DOM EventEventListener Class.
10
- * @author Joshua Heagle <joshuaheagle@gmail.com>
11
- * @version 1.0.0
9
+ * Substitute for the DOM EventEventListener Class.
12
10
  */
13
11
  const EventService_1 = require('../services/EventService')
14
12
  /**
15
13
  * Handle events as they are stored and implemented.
16
- * @author Joshua Heagle <joshuaheagle@gmail.com>
17
- * @class
18
- * @property {string} eventType
19
- * @property {Object} eventOptions
20
- * @property {boolean} isDefault
21
14
  */
22
15
  class PseudoEventListener {
23
16
  /**
24
- * @param {string} eventType The type of event this listens for
25
- * @param {Object} [options] The capture, once and passive options
26
- * @param {Function} handleEvent The function which is called with the event, already bound to what it should run as
27
- * @param {Function} [originalCallback=handleEvent] The function (or object) which was given when registering, used to find this listener again
28
- * @constructor
17
+ * @param eventType The type of event this listens for
18
+ * @param options The capture, once and passive options
19
+ * @param handleEvent The function which is called with the event, already bound to what it should run as
20
+ * @param originalCallback The function (or object) which was given when registering, used to find this listener again
29
21
  */
30
22
  constructor (eventType, {
31
23
  capture = false,
@@ -85,10 +77,7 @@
85
77
  }
86
78
 
87
79
  /**
88
- * @method
89
- * @name PseudoEventListener#handleEvent
90
- * @param {PseudoEvent} event
91
- * @returns {*}
80
+ * @param event
92
81
  */
93
82
  handleEvent (event) {
94
83
  return this.handler(event)
@@ -96,10 +85,7 @@
96
85
 
97
86
  /**
98
87
  * A capture listener runs while the event travels down to the target.
99
- * @method
100
- * @name PseudoEventListener#doCapturePhase
101
- * @param {PseudoEvent} event
102
- * @returns {boolean}
88
+ * @param event
103
89
  */
104
90
  doCapturePhase (event) {
105
91
  return event.eventPhase === EventService_1.EventService.CAPTURING_PHASE && this.eventOptions.capture
@@ -107,10 +93,7 @@
107
93
 
108
94
  /**
109
95
  * Every listener of the target itself runs, capture listeners first.
110
- * @method
111
- * @name PseudoEventListener#doTargetPhase
112
- * @param {PseudoEvent} event
113
- * @returns {boolean}
96
+ * @param event
114
97
  */
115
98
  doTargetPhase (event) {
116
99
  return event.eventPhase === EventService_1.EventService.AT_TARGET
@@ -118,20 +101,14 @@
118
101
 
119
102
  /**
120
103
  * A listener which is not a capture listener runs while the event travels back up (when it bubbles).
121
- * @method
122
- * @name PseudoEventListener#doBubblePhase
123
- * @param {PseudoEvent} event
124
- * @returns {boolean}
104
+ * @param event
125
105
  */
126
106
  doBubblePhase (event) {
127
107
  return event.eventPhase === EventService_1.EventService.BUBBLING_PHASE && !this.eventOptions.capture
128
108
  }
129
109
 
130
110
  /**
131
- * @method
132
- * @name PseudoEventListener#skipPhase
133
- * @param {PseudoEvent} event
134
- * @returns {boolean}
111
+ * @param event
135
112
  */
136
113
  skipPhase (event) {
137
114
  return !this.doCapturePhase(event) && !this.doTargetPhase(event) && !this.doBubblePhase(event)
@@ -141,10 +118,7 @@
141
118
  * Whether this listener should not run for the event as it is now (it was removed, or it is for another phase).
142
119
  * Stopping propagation is handled by the dispatching, since it stops other targets and not the listeners of the
143
120
  * current one.
144
- * @method
145
- * @name PseudoEventListener#rejectEvent
146
- * @param {PseudoEvent} event
147
- * @returns {boolean}
121
+ * @param event
148
122
  */
149
123
  rejectEvent (event) {
150
124
  return this.isRemoved || this.skipPhase(event)
@@ -165,16 +139,10 @@
165
139
  * Simulate the behaviour of the HTMLDocument Class when there is no DOM available. Like the real HTMLDocument, this
166
140
  * only adds the html/head/body structure on top of what Document already gives (createElement, createTextNode,
167
141
  * createComment, createDocumentFragment, getElementById, textContent always null).
168
- * @author Joshua Heagle <joshuaheagle@gmail.com>
169
- * @class
170
- * @augments DocumentService
171
- * @property {PseudoHTMLElement} head - A reference to the Head child element
172
- * @property {PseudoHTMLElement} body - A reference to the Body child element
173
142
  */
174
143
  class PseudoHTMLDocument extends DocumentService_1.DocumentService {
175
144
  /**
176
145
  * The root HTML element is acts as the parent to all HTML elements in the document.
177
- * @constructor
178
146
  */
179
147
  constructor () {
180
148
  super()
@@ -182,13 +150,11 @@
182
150
  this.appendChild(html)
183
151
  /**
184
152
  * Create document head element
185
- * @type {PseudoHTMLElement}
186
153
  */
187
154
  this.head = this.createElement('head')
188
155
  html.appendChild(this.head)
189
156
  /**
190
157
  * Create document body element
191
- * @type {PseudoHTMLElement}
192
158
  */
193
159
  this.body = this.createElement('body')
194
160
  html.appendChild(this.body)
@@ -197,7 +163,6 @@
197
163
  /**
198
164
  * A copy of this document with none of its html/head/body (cloneNode, from the inherited cloneShallow hook, fills
199
165
  * them back in, deep copies own document's, empty otherwise - see cloneNode).
200
- * @returns {PseudoHTMLDocument}
201
166
  */
202
167
  cloneShallow () {
203
168
  const copy = new this.constructor()
@@ -212,8 +177,7 @@
212
177
  /**
213
178
  * Make a copy of this document. The copy has no parent or listeners, and a deep copy has copies of everything in
214
179
  * the document (a shallow one is an empty document).
215
- * @param {boolean} [deep=false] Copy everything in the document as well
216
- * @returns {PseudoHTMLDocument}
180
+ * @param deep Copy everything in the document as well
217
181
  */
218
182
  cloneNode (deep = false) {
219
183
  const copy = super.cloneNode(deep)
@@ -238,21 +202,16 @@
238
202
  })
239
203
  exports.PseudoNodeList = void 0
240
204
  /**
241
- * @file Substitute for the NodeList interface.
242
- * @author Joshua Heagle <joshuaheagle@gmail.com>
243
- * @version 1.0.0
205
+ * Substitute for the NodeList interface.
244
206
  */
245
207
  const LinkedTreeList_1 = require('collect-your-stuff/dist/collections/linked-tree-list/LinkedTreeList')
246
208
  /**
247
209
  * A NodeList, like the DOM one, iterates over the nodes themselves (the data stored in each TreeLinker), rather than
248
210
  * the linkers that hold them.
249
- * @class
250
- * @augments LinkedTreeList
251
211
  */
252
212
  class PseudoNodeList extends LinkedTreeList_1.LinkedTreeList {
253
213
  /**
254
214
  * Iterate over the nodes in this list.
255
- * @returns {Iterator}
256
215
  */
257
216
  [Symbol.iterator] () {
258
217
  // Walk the nodes of this list only (the linkers of a child list have no children of their own)
@@ -277,7 +236,6 @@
277
236
 
278
237
  /**
279
238
  * Iterate over [index, node] pairs.
280
- * @returns {Iterator}
281
239
  */
282
240
  entries () {
283
241
  return Array.from(this).map((node, index) => [index, node])[Symbol.iterator]()
@@ -285,7 +243,6 @@
285
243
 
286
244
  /**
287
245
  * Iterate over the indexes.
288
- * @returns {Iterator}
289
246
  */
290
247
  keys () {
291
248
  return Array.from(this).map((node, index) => index)[Symbol.iterator]()
@@ -293,7 +250,6 @@
293
250
 
294
251
  /**
295
252
  * Iterate over the nodes.
296
- * @returns {Iterator}
297
253
  */
298
254
  values () {
299
255
  return Array.from(this)[Symbol.iterator]()
@@ -310,20 +266,17 @@
310
266
  value: true
311
267
  })
312
268
  /**
313
- * @file Wraps an element in a Proxy which behaves like the DOM's DOMStringMap (element.dataset): a live view of its
269
+ * Wraps an element in a Proxy which behaves like the DOM's DOMStringMap (element.dataset): a live view of its
314
270
  * data-* attributes, under their camelCase names, backed by the element's own getAttribute / setAttribute /
315
271
  * hasAttribute / removeAttribute (nothing is stored separately, so it can never fall out of sync with the
316
272
  * attributes).
317
- * @author Joshua Heagle <joshuaheagle@gmail.com>
318
- * @version 1.0.0
319
273
  */
320
274
  const createStyleDeclaration_1 = require('./createStyleDeclaration')
321
275
  const DATA_PREFIX = 'data-'
322
276
  const attributeName = property => `${DATA_PREFIX}${(0, createStyleDeclaration_1.camelToKebab)(property)}`
323
277
  /**
324
278
  * Every data-* attribute name currently on the element, as [attributeName, camelCaseName] pairs.
325
- * @param {*} element
326
- * @returns {Array<Array<string>>}
279
+ * @param element
327
280
  */
328
281
  const dataAttributes = element => {
329
282
  const names = []
@@ -337,9 +290,7 @@
337
290
  }
338
291
  /**
339
292
  * A live DOMStringMap-like object for an element's data-* attributes.
340
- * @memberOf module:factories
341
- * @param {*} element The element whose data-* attributes this reflects
342
- * @returns {Object.<string, string>}
293
+ * @param element The element whose data-* attributes this reflects
343
294
  */
344
295
  const createDataset = element => new Proxy({}, {
345
296
  get (_target, property) {
@@ -413,11 +364,9 @@
413
364
  * the init says so, and the event is not trusted. With browser: true the event is created the way the browser creates
414
365
  * it, using the standard options for its type (see eventDefaults), and trusted: true makes it look like it came from a
415
366
  * real user action (isTrusted).
416
- * @function createEvent
417
- * @param {string} type The type of the event, such as click
418
- * @param {Object} [init={}] The options for the event (bubbles, cancelable, composed and those of its kind of event)
419
- * @param {CreateEventOptions} [options={}] Whether the browser is creating the event, and whether it is trusted
420
- * @returns {EventService}
367
+ * @param type The type of the event, such as click
368
+ * @param init The options for the event (bubbles, cancelable, composed and those of its kind of event)
369
+ * @param options Whether the browser is creating the event, and whether it is trusted
421
370
  */
422
371
  const createEvent = (type, init = {}, {
423
372
  browser = false,
@@ -447,24 +396,20 @@
447
396
  })
448
397
  exports.camelToKebab = exports.kebabToCamel = void 0
449
398
  /**
450
- * @file Wraps a CSSStyleDeclarationService in a Proxy so arbitrary camelCase CSS properties (element.style.
399
+ * Wraps a CSSStyleDeclarationService in a Proxy so arbitrary camelCase CSS properties (element.style.
451
400
  * backgroundColor) work like the DOM's, on top of its real methods (getPropertyValue, setProperty, cssText, ...).
452
- * @author Joshua Heagle <joshuaheagle@gmail.com>
453
- * @version 1.0.0
454
401
  */
455
402
  const CSSStyleDeclarationService_1 = require('../services/CSSStyleDeclarationService')
456
403
  const isIndex = property => /^\d+$/.test(property)
457
404
  /**
458
405
  * kebab-case -> camelCase ("background-color" -> "backgroundColor").
459
- * @param {string} name
460
- * @returns {string}
406
+ * @param name
461
407
  */
462
408
  const kebabToCamel = name => name.replace(/-([a-z0-9])/gi, (_match, letter) => letter.toUpperCase())
463
409
  exports.kebabToCamel = kebabToCamel
464
410
  /**
465
411
  * camelCase -> kebab-case ("backgroundColor" -> "background-color").
466
- * @param {string} name
467
- * @returns {string}
412
+ * @param name
468
413
  */
469
414
  const camelToKebab = name => name.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)
470
415
  exports.camelToKebab = camelToKebab
@@ -472,9 +417,7 @@
472
417
  * A live CSSStyleDeclaration-like object: its real methods (cssText, getPropertyValue, setProperty, ...) work as
473
418
  * declared, and any other property name is treated as a camelCase CSS property (declaration.backgroundColor reads /
474
419
  * writes the "background-color" declaration), matching what a real element.style supports.
475
- * @memberOf module:factories
476
- * @param {string} [cssText=''] Initial declarations
477
- * @returns {CSSStyleDeclarationService}
420
+ * @param cssText Initial declarations
478
421
  */
479
422
  const createStyleDeclaration = (cssText = '') => {
480
423
  const target = new CSSStyleDeclarationService_1.CSSStyleDeclarationService(cssText)
@@ -517,17 +460,14 @@
517
460
  })
518
461
  exports.cssSelectAdapter = void 0
519
462
  /**
520
- * @file The css-select Adapter which lets it query pseudo-dom's own tree, instead of the domutils-based tree it
463
+ * The css-select Adapter which lets it query pseudo-dom's own tree, instead of the domutils-based tree it
521
464
  * defaults to.
522
- * @author Joshua Heagle <joshuaheagle@gmail.com>
523
- * @version 1.0.0
524
465
  */
525
466
  const NodeService_1 = require('../services/NodeService')
526
467
  /**
527
468
  * Walk up from a node (not including it) to find the nearest element, in the given direction.
528
- * @param {*} node The node to start from
529
- * @param {'nextSibling'|'previousSibling'} direction Which sibling reference to follow
530
- * @returns {*|null}
469
+ * @param node The node to start from
470
+ * @param direction Which sibling reference to follow
531
471
  */
532
472
  const nearestElementSibling = (node, direction) => {
533
473
  let current = node ? node[direction] : null
@@ -540,8 +480,6 @@
540
480
  * Maps pseudo-dom's own Node / Element API onto the Adapter interface css-select needs to query a tree which is not
541
481
  * domutils' own (css-select's own Adapter<Node, ElementNode> type). Every method here is one pseudo-dom already has
542
482
  * under a different name; nothing here reimplements DOM behaviour.
543
- * @memberOf module:factories
544
- * @type {Object}
545
483
  */
546
484
  exports.cssSelectAdapter = {
547
485
  isTag: node => !!node && node.nodeType === NodeService_1.NodeService.ELEMENT_NODE,
@@ -598,9 +536,7 @@
598
536
  'use strict'
599
537
 
600
538
  /**
601
- * @file The standard event types of the browser, and how the browser creates them.
602
- * @author Joshua Heagle <joshuaheagle@gmail.com>
603
- * @version 1.0.0
539
+ * The standard event types of the browser, and how the browser creates them.
604
540
  */
605
541
  Object.defineProperty(exports, '__esModule', {
606
542
  value: true
@@ -617,7 +553,6 @@
617
553
  * options. A script which creates an event with the constructor gets none of them (everything is false) unless it asks
618
554
  * for them, which is why createEvent only uses this table when it is told the browser is creating the event.
619
555
  * The values follow the UI Events, HTML, Pointer Events, Clipboard, Drag and Drop, Touch and CSS specifications.
620
- * @type {Object.<string, EventDefinition>}
621
556
  */
622
557
  exports.eventDefaults = {
623
558
  // Mouse (UI Events)
@@ -718,25 +653,19 @@
718
653
  const NodeService_1 = require('../services/NodeService')
719
654
  const ElementService_1 = require('../services/ElementService')
720
655
  const HTMLElementService_1 = require('../services/HTMLElementService')
656
+ const EventService_1 = require('../services/EventService')
721
657
  const PseudoHTMLDocument_1 = __importDefault(require('../classes/PseudoHTMLDocument'))
722
658
  /**
723
659
  * Construct the Pseudo Dom to provide access to Dom objects which are otherwise not available outside the browser
724
660
  * context.
725
- * @function generateDocument
726
- * @param {Object} root
727
- * @param {Object} context
728
- * @returns {Window|PseudoEventTarget}
661
+ * @param root
662
+ * @param context
729
663
  */
730
664
  const generateDocument = (root, context = {}) => {
731
- /**
732
- *
733
- * @type {Window|PseudoEventTarget}
734
- */
735
665
  const newWindow = typeof root.document === 'undefined' ? root : new EventTargetService_1.default()
736
666
  /**
737
667
  * The Node class itself (matching the DOM's window.Node), not an instance - the right-hand side of `instanceof`
738
668
  * must be a constructor, so `x instanceof Node` needs this, not `new PseudoNode()`.
739
- * @type {Function}
740
669
  */
741
670
  const Node = root.Node || NodeService_1.NodeService
742
671
  if (typeof newWindow.Node === 'undefined') {
@@ -744,7 +673,6 @@
744
673
  }
745
674
  /**
746
675
  * The Element class itself, for the same reason as Node.
747
- * @type {Function}
748
676
  */
749
677
  const Element = root.Element || ElementService_1.ElementService
750
678
  if (typeof newWindow.Element === 'undefined') {
@@ -752,7 +680,6 @@
752
680
  }
753
681
  /**
754
682
  * The HTMLElement class itself, for the same reason as Node.
755
- * @type {Function}
756
683
  */
757
684
  const HTMLElement = root.HTMLElement || HTMLElementService_1.HTMLElementService
758
685
  if (typeof newWindow.HTMLElement === 'undefined') {
@@ -761,16 +688,28 @@
761
688
  /**
762
689
  * The HTMLDocument class itself, for the same reason as Node (so `document instanceof HTMLDocument`, a common
763
690
  * real-DOM-detection check, works).
764
- * @type {Function}
765
691
  */
766
692
  const HTMLDocument = root.HTMLDocument || PseudoHTMLDocument_1.default
767
693
  if (typeof newWindow.HTMLDocument === 'undefined') {
768
694
  newWindow.HTMLDocument = HTMLDocument
769
695
  }
770
696
  /**
697
+ * The Event class itself, so code which does `new Event(type)` then `target.dispatchEvent(...)` - the standard,
698
+ * environment-agnostic way to synthesize and dispatch an event - works the same as it would against a real DOM.
699
+ * Unlike Node/Element/HTMLElement/HTMLDocument above, this is NOT `root.Event || PseudoEvent`: Node.js itself has
700
+ * had a global Event/EventTarget since v15, unrelated to this module and incompatible with it (dispatchEvent
701
+ * below expects the inner/dispatching bookkeeping only this module's own instances carry) - so by the time this
702
+ * function is reached (no real document, meaning no real browser or jsdom either), any Event already on root can
703
+ * only be that unrelated native one, or this module's own from an earlier install (functionally identical to
704
+ * reinstalling it) - never a real browser's. Preferring root.Event the way the others do would keep Node's
705
+ * incompatible one every time, since it is never actually undefined.
706
+ */
707
+ if (newWindow.Event !== EventService_1.EventService) {
708
+ newWindow.Event = EventService_1.EventService
709
+ }
710
+ /**
771
711
  * Define document when not available - a real instance, unlike the classes above (window.document IS an object,
772
712
  * not a constructor).
773
- * @type {Document|PseudoHTMLDocument}
774
713
  */
775
714
  const document = root.document || new PseudoHTMLDocument_1.default()
776
715
  if (typeof newWindow.document === 'undefined') {
@@ -784,7 +723,7 @@
784
723
  return newWindow === mergeInto ? newWindow : Object.assign(mergeInto, newWindow)
785
724
  }
786
725
  exports.default = generateDocument
787
- }, { '../classes/PseudoHTMLDocument': 2, '../services/ElementService': 28, '../services/EventTargetService': 30, '../services/HTMLElementService': 33, '../services/NodeService': 38 }],
726
+ }, { '../classes/PseudoHTMLDocument': 2, '../services/ElementService': 28, '../services/EventService': 29, '../services/EventTargetService': 30, '../services/HTMLElementService': 33, '../services/NodeService': 38 }],
788
727
  10: [function (require, module, exports) {
789
728
  'use strict'
790
729
 
@@ -794,8 +733,7 @@
794
733
  const PseudoNodeList_1 = require('../classes/PseudoNodeList')
795
734
  /**
796
735
  * Create a PseudoNodeList, optionally starting from an existing chain of linkers.
797
- * @param {TreeLinker|null} [innerList=null]
798
- * @returns {PseudoNodeList}
736
+ * @param innerList
799
737
  */
800
738
  const generateNodeList = (innerList = null) => new PseudoNodeList_1.PseudoNodeList().initialize(innerList)
801
739
  exports.default = generateNodeList
@@ -814,11 +752,9 @@
814
752
  value: true
815
753
  })
816
754
  /**
817
- * @file Makes pseudo-dom a drop-in swap for a real DOM: code written against bare globals (document.createElement,
755
+ * Makes pseudo-dom a drop-in swap for a real DOM: code written against bare globals (document.createElement,
818
756
  * new Node(), ...) works unmodified, in the browser or in Node, without an if (typeof document === 'undefined')
819
757
  * check at every call site.
820
- * @author Joshua Heagle <joshuaheagle@gmail.com>
821
- * @version 1.0.0
822
758
  */
823
759
  const browser_or_node_1 = require('browser-or-node')
824
760
  const generateDocument_1 = __importDefault(require('./generateDocument'))
@@ -830,10 +766,9 @@
830
766
  * real browser's global scope - some code checks for a bare `window` before falling back to `global`), so code
831
767
  * written against a real DOM's globals works as-is. Does nothing when a real DOM is already there, matching
832
768
  * generateDocument's own only-fill-what-is-missing behaviour - calling this is always safe, in any environment.
833
- * @memberOf module:factories
834
- * @param {*} [target] The object to add document / Node / Element / HTMLElement / window onto - defaults to
769
+ * @param target The object to add document / Node / Element / HTMLElement / window onto - defaults to
835
770
  * globalThis, so bare `document`, `Node`, `window`, etc. resolve from anywhere once this has run
836
- * @returns {*} The same target, for convenience
771
+ * @returns The same target, for convenience
837
772
  */
838
773
  const installGlobal = (target = typeof globalThis !== 'undefined' ? globalThis : {}) => {
839
774
  if (!browser_or_node_1.isBrowser) {
@@ -853,18 +788,14 @@
853
788
  value: true
854
789
  })
855
790
  /**
856
- * @file Prints an element (or any node) to the console, readably - the point of pseudo-dom running headlessly is
791
+ * Prints an element (or any node) to the console, readably - the point of pseudo-dom running headlessly is
857
792
  * usually to watch what code does to a tree without a real browser to look at.
858
- * @author Joshua Heagle <joshuaheagle@gmail.com>
859
- * @version 1.0.0
860
793
  */
861
794
  const serializeHTML_1 = require('./serializeHTML')
862
795
  /**
863
796
  * Print a node's markup to the console, indented for readability (see prettyPrint).
864
- * @memberOf module:factories
865
- * @param {*} node
866
- * @param {string} [label=''] A label printed above the markup, to identify this log call
867
- * @returns {undefined}
797
+ * @param node
798
+ * @param label A label printed above the markup, to identify this log call
868
799
  */
869
800
  const logElement = (node, label = '') => {
870
801
  console.log(`${label ? `${label}\n` : ''}${(0, serializeHTML_1.prettyPrint)(node)}`)
@@ -878,7 +809,7 @@
878
809
  value: true
879
810
  })
880
811
  /**
881
- * @file Parses an HTML string into pseudo-dom nodes, for innerHTML / outerHTML / insertAdjacentHTML. Built on
812
+ * Parses an HTML string into pseudo-dom nodes, for innerHTML / outerHTML / insertAdjacentHTML. Built on
882
813
  * htmlparser2's Parser (a SAX-style tokenizer) with a custom handler which builds pseudo-dom nodes directly -
883
814
  * htmlparser2's own default DomHandler / domutils tree (which this never uses) is stubbed out of the browser bundle
884
815
  * by the browser.ignore config, the same way css-select's unused default adapter already is.
@@ -886,19 +817,15 @@
886
817
  * The class to build parsed elements with is given by the caller (rather than imported here) so this has no
887
818
  * dependency on ElementService / HTMLElementService - importing either here, from a factory ElementService itself
888
819
  * would need to call, would create an import cycle.
889
- * @author Joshua Heagle <joshuaheagle@gmail.com>
890
- * @version 1.0.0
891
820
  */
892
821
  const htmlparser2_1 = require('htmlparser2')
893
822
  const NodeService_1 = require('../services/NodeService')
894
823
  /**
895
824
  * Parse an HTML string into the nodes it describes (siblings at the top level, exactly like the DOM's own HTML
896
825
  * parsing does for innerHTML / insertAdjacentHTML - there is no single root unless the markup itself has one).
897
- * @memberOf module:factories
898
- * @param {string} html
899
- * @param {*} ownerDocument The document the new nodes belong to (matches what innerHTML etc. would set), or null
900
- * @param {function(new: *, {tagName: string})} ElementClass The class to build each parsed element with
901
- * @returns {Array<*>}
826
+ * @param html
827
+ * @param ownerDocument The document the new nodes belong to (matches what innerHTML etc. would set), or null
828
+ * @param ElementClass The class to build each parsed element with
902
829
  */
903
830
  const parseHTML = (html, ownerDocument, ElementClass) => {
904
831
  const roots = []
@@ -965,19 +892,15 @@
965
892
  })
966
893
  exports.closest = exports.matches = exports.querySelector = exports.querySelectorAll = void 0
967
894
  /**
968
- * @file Selector queries (querySelector, querySelectorAll, matches, closest), built on css-select and the
895
+ * Selector queries (querySelector, querySelectorAll, matches, closest), built on css-select and the
969
896
  * cssSelectAdapter which lets it query pseudo-dom's own tree.
970
- * @author Joshua Heagle <joshuaheagle@gmail.com>
971
- * @version 1.0.0
972
897
  */
973
898
  const css_select_1 = require('css-select')
974
899
  const cssSelectAdapter_1 = require('./cssSelectAdapter')
975
900
  /**
976
901
  * All of the elements below (not including) scope which match the selector, in tree order.
977
- * @memberOf module:factories
978
- * @param {string} selector A CSS selector
979
- * @param {*} scope The node to search below
980
- * @returns {Array<*>}
902
+ * @param selector A CSS selector
903
+ * @param scope The node to search below
981
904
  */
982
905
  const querySelectorAll = (selector, scope) => (0, css_select_1.selectAll)(selector, scope, {
983
906
  adapter: cssSelectAdapter_1.cssSelectAdapter
@@ -985,10 +908,8 @@
985
908
  exports.querySelectorAll = querySelectorAll
986
909
  /**
987
910
  * The first element below (not including) scope which matches the selector, in tree order, or null when there is none.
988
- * @memberOf module:factories
989
- * @param {string} selector A CSS selector
990
- * @param {*} scope The node to search below
991
- * @returns {*|null}
911
+ * @param selector A CSS selector
912
+ * @param scope The node to search below
992
913
  */
993
914
  const querySelector = (selector, scope) => (0, css_select_1.selectOne)(selector, scope, {
994
915
  adapter: cssSelectAdapter_1.cssSelectAdapter
@@ -996,10 +917,8 @@
996
917
  exports.querySelector = querySelector
997
918
  /**
998
919
  * Whether an element itself (not its descendants) matches the selector.
999
- * @memberOf module:factories
1000
- * @param {*} element The element to test
1001
- * @param {string} selector A CSS selector
1002
- * @returns {boolean}
920
+ * @param element The element to test
921
+ * @param selector A CSS selector
1003
922
  */
1004
923
  const matches = (element, selector) => (0, css_select_1.is)(element, selector, {
1005
924
  adapter: cssSelectAdapter_1.cssSelectAdapter
@@ -1008,10 +927,8 @@
1008
927
  /**
1009
928
  * The nearest ancestor of an element (starting with the element itself) which matches the selector, or null when
1010
929
  * none of them do.
1011
- * @memberOf module:factories
1012
- * @param {*} element The element to start from
1013
- * @param {string} selector A CSS selector
1014
- * @returns {*|null}
930
+ * @param element The element to start from
931
+ * @param selector A CSS selector
1015
932
  */
1016
933
  const closest = (element, selector) => {
1017
934
  let current = element
@@ -1052,9 +969,7 @@
1052
969
  })
1053
970
  exports.prettyPrint = exports.serializeOuter = exports.serializeChildren = void 0
1054
971
  /**
1055
- * @file Serializes pseudo-dom nodes back into an HTML string, for innerHTML / outerHTML.
1056
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1057
- * @version 1.0.0
972
+ * Serializes pseudo-dom nodes back into an HTML string, for innerHTML / outerHTML.
1058
973
  */
1059
974
  const NodeService_1 = require('../services/NodeService')
1060
975
  // Void elements are self-closing and never serialize a closing tag or children (there is no HTML parsing of their
@@ -1074,23 +989,20 @@
1074
989
  * Escape text so it is safe inside HTML text content. Coerces to a string first - unlike a real DOM, pseudo-dom's
1075
990
  * setAttribute does not itself coerce (see the same note on escapeAttributeValue), and nodeValue is not guaranteed
1076
991
  * to be a string either.
1077
- * @param {*} text
1078
- * @returns {string}
992
+ * @param text
1079
993
  */
1080
994
  const escapeText = text => String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
1081
995
  /**
1082
996
  * Escape a value so it is safe inside a double-quoted HTML attribute. Coerces to a string first: a real DOM's
1083
997
  * setAttribute always stores a string, however pseudo-dom's does not coerce what it is given, so a value set via
1084
998
  * setAttribute(name, 5) is stored (and read back by getAttribute) as the number 5, not the string '5'.
1085
- * @param {*} value
1086
- * @returns {string}
999
+ * @param value
1087
1000
  */
1088
1001
  const escapeAttributeValue = value => String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;')
1089
1002
  /**
1090
1003
  * Every attribute of the element, serialized (class instead of className, boolean attributes bare, the never-real
1091
1004
  * mock properties left out, style added from the live CSSStyleDeclaration when it is not empty).
1092
- * @param {*} element
1093
- * @returns {string}
1005
+ * @param element
1094
1006
  */
1095
1007
  const serializeAttributes = element => {
1096
1008
  let result = (element.getAttributeNames ? element.getAttributeNames() : []).filter(name => !NEVER_SERIALIZE.has(name)).map(name => {
@@ -1108,8 +1020,7 @@
1108
1020
  }
1109
1021
  /**
1110
1022
  * One node, serialized (its own markup only - see serializeChildren for its descendants too).
1111
- * @param {*} node
1112
- * @returns {string}
1023
+ * @param node
1113
1024
  */
1114
1025
  const serializeNode = node => {
1115
1026
  if (node.nodeType === NodeService_1.NodeService.TEXT_NODE) {
@@ -1130,27 +1041,22 @@
1130
1041
  }
1131
1042
  /**
1132
1043
  * A node's children, serialized in order (this is what innerHTML returns).
1133
- * @memberOf module:factories
1134
- * @param {*} node
1135
- * @returns {string}
1044
+ * @param node
1136
1045
  */
1137
1046
  const serializeChildren = node => Array.from(node.childNodes).map(serializeNode).join('')
1138
1047
  exports.serializeChildren = serializeChildren
1139
1048
  /**
1140
1049
  * An element itself, serialized with its children (this is what outerHTML returns).
1141
- * @memberOf module:factories
1142
- * @param {*} element
1143
- * @returns {string}
1050
+ * @param element
1144
1051
  */
1145
1052
  const serializeOuter = element => serializeNode(element)
1146
1053
  exports.serializeOuter = serializeOuter
1147
1054
  /**
1148
1055
  * One node, indented for readability (see prettyPrint) - unlike serializeNode, every non-empty node is its own
1149
1056
  * line, so the structure of a whole tree is easy to read at a glance.
1150
- * @param {*} node
1151
- * @param {number} depth
1152
- * @param {string} indent
1153
- * @returns {string}
1057
+ * @param node
1058
+ * @param depth
1059
+ * @param indent
1154
1060
  */
1155
1061
  const prettyPrintNode = (node, depth, indent) => {
1156
1062
  const pad = indent.repeat(depth)
@@ -1179,10 +1085,8 @@
1179
1085
  * A node's markup, indented one level per level of nesting - a real DOM's outerHTML / innerHTML has no line breaks
1180
1086
  * at all, which does not read well for a whole tree (a board full of cells, say). Useful for watching pseudo-dom-
1181
1087
  * driven code run headlessly, printed to a terminal - see also logElement, which does the printing too.
1182
- * @memberOf module:factories
1183
- * @param {*} node
1184
- * @param {string} [indent=' '] The indentation used per level of nesting
1185
- * @returns {string}
1088
+ * @param node
1089
+ * @param indent The indentation used per level of nesting
1186
1090
  */
1187
1091
  const prettyPrint = (node, indent = ' ') => prettyPrintNode(node, 0, indent)
1188
1092
  exports.prettyPrint = prettyPrint
@@ -1201,17 +1105,14 @@
1201
1105
  const focused = new WeakMap()
1202
1106
  /**
1203
1107
  * Find the element which has the focus in a tree.
1204
- * @function getActiveElement
1205
- * @param {Object} root The root node of the tree
1206
- * @returns {Object|null}
1108
+ * @param root The root node of the tree
1207
1109
  */
1208
1110
  const getActiveElement = root => focused.get(root) || null
1209
1111
  exports.getActiveElement = getActiveElement
1210
1112
  /**
1211
1113
  * Remember the element which has the focus in a tree.
1212
- * @function setActiveElement
1213
- * @param {Object} root The root node of the tree
1214
- * @param {Object|null} element The element which now has the focus, or null when nothing has it
1114
+ * @param root The root node of the tree
1115
+ * @param element The element which now has the focus, or null when nothing has it
1215
1116
  */
1216
1117
  const setActiveElement = (root, element) => {
1217
1118
  if (element === null) {
@@ -1233,10 +1134,8 @@
1233
1134
  * The first element, in tree order, below (not including) the given node whose id matches the given value, or null
1234
1135
  * when there is none. Shared by Document and DocumentFragment, which both implement the DOM's NonElementParentNode
1235
1136
  * mixin (so ShadowRoot, a DocumentFragment, gets it too).
1236
- * @memberOf module:functions
1237
- * @param {NodeService} root The node to search below
1238
- * @param {string} id
1239
- * @returns {PseudoElement|null}
1137
+ * @param root The node to search below
1138
+ * @param id
1240
1139
  */
1241
1140
  const getElementById = (root, id) => {
1242
1141
  const search = node => {
@@ -1266,9 +1165,7 @@
1266
1165
  /**
1267
1166
  * Get all of the ancestors of a node, starting with the root of the tree and ending with the node's own parent (the
1268
1167
  * order in which an event travels down through them). A node which has no parent has no ancestors.
1269
- * @function getParentNodes
1270
- * @param {PseudoEventTarget|PseudoNode|*} node The node to find the ancestors of
1271
- * @returns {Array<PseudoNode>}
1168
+ * @param node The node to find the ancestors of
1272
1169
  */
1273
1170
  const getParentNodes = node => {
1274
1171
  const parents = []
@@ -1301,11 +1198,9 @@
1301
1198
  * A selector function for retrieving existing parent PseudoNode from the given child item.
1302
1199
  * This function will check all the parents starting from node, and scan the attributes
1303
1200
  * property for matches. The return array contains all matching parent ancestors, starting with the root of the tree.
1304
- * @function getParentNodesFromAttribute
1305
- * @param {string} attr The property to compare on each ancestor (a missing property counts as false)
1306
- * @param {boolean|number|string} value The value the property must have
1307
- * @param {PseudoEventTarget|PseudoNode|*} node The node to find the matching ancestors of
1308
- * @returns {Array.<PseudoNode>}
1201
+ * @param attr The property to compare on each ancestor (a missing property counts as false)
1202
+ * @param value The value the property must have
1203
+ * @param node The node to find the matching ancestors of
1309
1204
  */
1310
1205
  const getParentNodesFromAttribute = (attr, value, node) => {
1311
1206
  return (0, getParentNodes_1.default)(node).filter(parent => (parent[attr] || false) === value)
@@ -1321,9 +1216,7 @@
1321
1216
  exports.modifierState = exports.modifierKeys = void 0
1322
1217
  /**
1323
1218
  * Pick the modifier keys out of the init object of an event.
1324
- * @function modifierKeys
1325
- * @param {Object} [init={}] The init of an event
1326
- * @returns {ModifierKeys}
1219
+ * @param init The init of an event
1327
1220
  */
1328
1221
  const modifierKeys = (init = {}) => ({
1329
1222
  ctrlKey: !!init.ctrlKey,
@@ -1334,10 +1227,8 @@
1334
1227
  exports.modifierKeys = modifierKeys
1335
1228
  /**
1336
1229
  * Answer getModifierState for a set of held modifier keys.
1337
- * @function modifierState
1338
- * @param {ModifierKeys} keys The modifier keys which were held down
1339
- * @param {string} key The name of the modifier (Control, Shift, Alt or Meta)
1340
- * @returns {boolean}
1230
+ * @param keys The modifier keys which were held down
1231
+ * @param key The name of the modifier (Control, Shift, Alt or Meta)
1341
1232
  */
1342
1233
  const modifierState = (keys, key) => {
1343
1234
  switch (key) {
@@ -1359,9 +1250,7 @@
1359
1250
  'use strict'
1360
1251
 
1361
1252
  /**
1362
- * @file All of the Pseudo Dom Helper Objects functions for simulating parts of the DOM when running scripts in NodeJs.
1363
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1364
- * @version 1.0.0
1253
+ * All of the Pseudo Dom Helper Objects functions for simulating parts of the DOM when running scripts in NodeJs.
1365
1254
  */
1366
1255
  const __importDefault = void 0 && (void 0).__importDefault || function (mod) {
1367
1256
  return mod && mod.__esModule
@@ -1489,9 +1378,6 @@
1489
1378
  })
1490
1379
  /**
1491
1380
  * All methods exported from this module are encapsulated within pseudoDom.
1492
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1493
- * @typedef {Object} pseudoDom
1494
- * @module pseudoDom/objects
1495
1381
  */
1496
1382
  const pseudoDom = {
1497
1383
  generateDocument: generateDocument_1.default,
@@ -1536,18 +1422,14 @@
1536
1422
  const NodeService_1 = require('./NodeService')
1537
1423
  /**
1538
1424
  * Simulate the behaviour of the Attr Class when there is no DOM available.
1539
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1540
- * @class
1541
- * @augments NodeService
1542
1425
  */
1543
1426
  class AttrService extends NodeService_1.NodeService {
1544
1427
  /**
1545
- * @param {string} name The name of the attribute
1546
- * @param {string} [value=''] The value of the attribute
1547
- * @param {PseudoElement|null} [ownerElement=null] The element which has this attribute
1548
- * @param {string} [namespaceURI=''] The namespace of the attribute
1549
- * @param {string|null} [prefix=null] The namespace prefix of the attribute
1550
- * @constructor
1428
+ * @param name The name of the attribute
1429
+ * @param value The value of the attribute
1430
+ * @param ownerElement The element which has this attribute
1431
+ * @param namespaceURI The namespace of the attribute
1432
+ * @param prefix The namespace prefix of the attribute
1551
1433
  */
1552
1434
  constructor (name = '', value = '', ownerElement = null, namespaceURI = '', prefix = null) {
1553
1435
  super()
@@ -1613,9 +1495,7 @@
1613
1495
  'use strict'
1614
1496
 
1615
1497
  /**
1616
- * @file Substitute for the DOM CSSStyleDeclaration Class (the object behind Element.style).
1617
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1618
- * @version 1.0.0
1498
+ * Substitute for the DOM CSSStyleDeclaration Class (the object behind Element.style).
1619
1499
  */
1620
1500
  require('core-js/modules/esnext.iterator.constructor.js')
1621
1501
  require('core-js/modules/esnext.iterator.for-each.js')
@@ -1643,13 +1523,10 @@
1643
1523
  * given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS
1644
1524
  * engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by
1645
1525
  * createStyleDeclaration, which wraps an instance of this class in a Proxy.
1646
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1647
- * @class
1648
1526
  */
1649
1527
  class CSSStyleDeclarationService {
1650
1528
  /**
1651
- * @param {string} [cssText=''] Initial declarations, as CSS text ("color: red; font-size: 12px;")
1652
- * @constructor
1529
+ * @param cssText Initial declarations, as CSS text ("color: red; font-size: 12px;")
1653
1530
  */
1654
1531
  constructor (cssText = '') {
1655
1532
  this.properties = new Map()
@@ -1658,7 +1535,6 @@
1658
1535
 
1659
1536
  /**
1660
1537
  * How many properties are currently set.
1661
- * @returns {number}
1662
1538
  */
1663
1539
  get length () {
1664
1540
  return this.properties.size
@@ -1667,8 +1543,7 @@
1667
1543
  /**
1668
1544
  * The name of the property at the given index, in the order it was set, or '' when there is none (matches the
1669
1545
  * DOM's CSSStyleDeclaration, which is array-like).
1670
- * @param {number} index
1671
- * @returns {string}
1546
+ * @param index
1672
1547
  */
1673
1548
  item (index) {
1674
1549
  return Array.from(this.properties.keys())[index] || ''
@@ -1676,8 +1551,7 @@
1676
1551
 
1677
1552
  /**
1678
1553
  * The value of the given property, or '' when it is not set.
1679
- * @param {string} property A CSS property name (kebab-case, e.g. "background-color")
1680
- * @returns {string}
1554
+ * @param property A CSS property name (kebab-case, e.g. "background-color")
1681
1555
  */
1682
1556
  getPropertyValue (property) {
1683
1557
  const entry = this.properties.get(property)
@@ -1686,8 +1560,7 @@
1686
1560
 
1687
1561
  /**
1688
1562
  * "important" when the property was set with !important, otherwise ''.
1689
- * @param {string} property A CSS property name (kebab-case)
1690
- * @returns {string}
1563
+ * @param property A CSS property name (kebab-case)
1691
1564
  */
1692
1565
  getPropertyPriority (property) {
1693
1566
  const entry = this.properties.get(property)
@@ -1697,10 +1570,9 @@
1697
1570
  /**
1698
1571
  * Set a property's value (and optionally its priority). An empty, null or undefined value removes the property
1699
1572
  * instead, like the DOM.
1700
- * @param {string} property A CSS property name (kebab-case)
1701
- * @param {string} value The value, or '' to remove the property
1702
- * @param {string} [priority=''] "important" to mark it !important
1703
- * @returns {undefined}
1573
+ * @param property A CSS property name (kebab-case)
1574
+ * @param value The value, or '' to remove the property
1575
+ * @param priority "important" to mark it !important
1704
1576
  */
1705
1577
  setProperty (property, value, priority = '') {
1706
1578
  if (value === '' || value === null || typeof value === 'undefined') {
@@ -1715,8 +1587,7 @@
1715
1587
 
1716
1588
  /**
1717
1589
  * Remove a property, returning the value it had (or '' when it was not set).
1718
- * @param {string} property A CSS property name (kebab-case)
1719
- * @returns {string}
1590
+ * @param property A CSS property name (kebab-case)
1720
1591
  */
1721
1592
  removeProperty (property) {
1722
1593
  const value = this.getPropertyValue(property)
@@ -1726,7 +1597,6 @@
1726
1597
 
1727
1598
  /**
1728
1599
  * All the declarations as one CSS text string.
1729
- * @returns {string}
1730
1600
  */
1731
1601
  get cssText () {
1732
1602
  return Array.from(this.properties.entries()).map(([property, {
@@ -1737,8 +1607,7 @@
1737
1607
 
1738
1608
  /**
1739
1609
  * Replace every declaration by parsing a CSS text string ("color: red; font-size: 12px !important;").
1740
- * @param {string} cssText
1741
- * @returns {undefined}
1610
+ * @param cssText
1742
1611
  */
1743
1612
  set cssText (cssText) {
1744
1613
  this.properties.clear()
@@ -1775,23 +1644,16 @@
1775
1644
  })
1776
1645
  exports.CustomEventService = void 0
1777
1646
  /**
1778
- * @file Substitute for the DOM CustomEvent Class.
1779
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1780
- * @version 1.0.0
1647
+ * Substitute for the DOM CustomEvent Class.
1781
1648
  */
1782
1649
  const EventService_1 = require('./EventService')
1783
1650
  /**
1784
1651
  * Simulate the behaviour of the CustomEvent Class when there is no DOM available: an event which carries data.
1785
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1786
- * @class
1787
- * @augments EventService
1788
- * @property {*} detail
1789
1652
  */
1790
1653
  class CustomEventService extends EventService_1.EventService {
1791
1654
  /**
1792
- * @param {string} [typeArg=''] The type of the event
1793
- * @param {CustomEventInit} [init={}] The options for the event
1794
- * @constructor
1655
+ * @param typeArg The type of the event
1656
+ * @param init The options for the event
1795
1657
  */
1796
1658
  constructor (typeArg = '', init = {}) {
1797
1659
  super(typeArg, init)
@@ -1817,14 +1679,11 @@
1817
1679
  exports.DOMTokenListService = void 0
1818
1680
  /**
1819
1681
  * Simulate the behaviour of the DOMTokenList Class when there is no DOM available.
1820
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1821
- * @class
1822
1682
  */
1823
1683
  class DOMTokenListService {
1824
1684
  /**
1825
- * @param {string} [value=''] The space separated tokens to start with
1826
- * @param {function(string): void} [onChange] Called with the new value whenever the tokens change
1827
- * @constructor
1685
+ * @param value The space separated tokens to start with
1686
+ * @param onChange Called with the new value whenever the tokens change
1828
1687
  */
1829
1688
  constructor (value = '', onChange = () => undefined) {
1830
1689
  this.tokens = DOMTokenListService.parse(value)
@@ -1942,9 +1801,6 @@
1942
1801
  /**
1943
1802
  * Simulate the behaviour of the DocumentFragment Class when there is no DOM available: a container for nodes which is
1944
1803
  * not part of a tree, when it is inserted its children are moved into the tree instead.
1945
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1946
- * @class
1947
- * @augments NodeService
1948
1804
  */
1949
1805
  class DocumentFragmentService extends NodeService_1.NodeService {
1950
1806
  get nodeName () {
@@ -1958,8 +1814,7 @@
1958
1814
  /**
1959
1815
  * The first element, in tree order, whose id matches the given value, or null when there is none (the DOM's
1960
1816
  * NonElementParentNode mixin, which Document and DocumentFragment both implement).
1961
- * @param {string} id
1962
- * @returns {PseudoElement|null}
1817
+ * @param id
1963
1818
  */
1964
1819
  getElementById (id) {
1965
1820
  return (0, getElementById_1.default)(this, id)
@@ -1987,9 +1842,6 @@
1987
1842
  const getElementById_1 = __importDefault(require('../functions/getElementById'))
1988
1843
  /**
1989
1844
  * Simulate the behaviour of the Document Class when there is no DOM available.
1990
- * @author Joshua Heagle <joshuaheagle@gmail.com>
1991
- * @class
1992
- * @augments NodeService
1993
1845
  */
1994
1846
  class DocumentService extends NodeService_1.NodeService {
1995
1847
  get nodeName () {
@@ -2008,8 +1860,7 @@
2008
1860
  set textContent (text) {}
2009
1861
  /**
2010
1862
  * The first element, in tree order, whose id matches the given value, or null when there is none.
2011
- * @param {string} id
2012
- * @returns {PseudoElement|null}
1863
+ * @param id
2013
1864
  */
2014
1865
  getElementById (id) {
2015
1866
  return (0, getElementById_1.default)(this, id)
@@ -2017,8 +1868,7 @@
2017
1868
 
2018
1869
  /**
2019
1870
  * Make an element of the given type which belongs to this document but is not added anywhere until it is appended.
2020
- * @param {string} [tagName='div'] The type of element to create
2021
- * @returns {PseudoElement}
1871
+ * @param tagName The type of element to create
2022
1872
  */
2023
1873
  createElement (tagName = 'div') {
2024
1874
  // Like the DOM, the new element is not added anywhere: it has no parent until it is appended
@@ -2031,8 +1881,7 @@
2031
1881
 
2032
1882
  /**
2033
1883
  * Make a text node which belongs to this document.
2034
- * @param {string} [data=''] The text
2035
- * @returns {TextService}
1884
+ * @param data The text
2036
1885
  */
2037
1886
  createTextNode (data = '') {
2038
1887
  const text = new NodeService_1.TextService(data)
@@ -2042,8 +1891,7 @@
2042
1891
 
2043
1892
  /**
2044
1893
  * Make a comment which belongs to this document.
2045
- * @param {string} [data=''] The comment
2046
- * @returns {CommentService}
1894
+ * @param data The comment
2047
1895
  */
2048
1896
  createComment (data = '') {
2049
1897
  const comment = new NodeService_1.CommentService(data)
@@ -2054,7 +1902,6 @@
2054
1902
  /**
2055
1903
  * Make an empty document fragment which belongs to this document, a container for nodes which can be built up and
2056
1904
  * then inserted in one go.
2057
- * @returns {DocumentFragmentService}
2058
1905
  */
2059
1906
  createDocumentFragment () {
2060
1907
  const fragment = new DocumentFragmentService_1.DocumentFragmentService()
@@ -2124,27 +1971,14 @@
2124
1971
  })
2125
1972
  /**
2126
1973
  * Simulate the behaviour of the Element Class when there is no DOM available.
2127
- * @author Joshua Heagle <joshuaheagle@gmail.com>
2128
- * @class
2129
- * @augments PseudoNode
2130
- * @property {string} tagName
2131
- * @property {string} className
2132
- * @property {string} id
2133
- * @property {string} innerHtml
2134
- * @property {Array} attributes
2135
- * @property {function} hasAttribute
2136
- * @property {function} setAttribute
2137
- * @property {function} getAttribute
2138
- * @property {function} removeAttribute
2139
1974
  */
2140
1975
  class ElementService extends NodeService_1.NodeService {
2141
1976
  /**
2142
- * @param {Object} [settings={}]
2143
- * @param {string} [settings.tagName=''] The name of the tag this element represents
2144
- * @param {Array<{name: string, value: *}>} [settings.attributes=[]] The attributes (also assigned as properties) to start with
2145
- * @param {PseudoNode|null} [settings.parent=null] The node to add this element to as its last child
2146
- * @param {Array<PseudoNode>} [settings.children=[]] The nodes to start as children
2147
- * @constructor
1977
+ * @param settings
1978
+ * @param settings.tagName The name of the tag this element represents
1979
+ * @param settings.attributes The attributes (also assigned as properties) to start with
1980
+ * @param settings.parent The node to add this element to as its last child
1981
+ * @param settings.children The nodes to start as children
2148
1982
  */
2149
1983
  constructor ({
2150
1984
  tagName = '',
@@ -2223,7 +2057,6 @@
2223
2057
  /**
2224
2058
  * The attributes with the values they have now: the ones which are also properties (className, id, style, ...) can
2225
2059
  * have been changed through the property, which does not change the stored list.
2226
- * @returns {Array<{name: string, value: *}>}
2227
2060
  */
2228
2061
  currentAttributes () {
2229
2062
  return this.attributeList.map(({
@@ -2242,7 +2075,6 @@
2242
2075
  /**
2243
2076
  * A copy of this element without its children: the same tag and attributes (the values which are objects, such as
2244
2077
  * style, are copied too rather than shared), but not its parent or listeners.
2245
- * @returns {ElementService}
2246
2078
  */
2247
2079
  cloneShallow () {
2248
2080
  const copy = new this.constructor({
@@ -2269,8 +2101,7 @@
2269
2101
  /**
2270
2102
  * Elements are equal when they have the same tag and the same attributes (in any order), which is what isEqualNode
2271
2103
  * checks before it compares the children.
2272
- * @param {NodeService} other The element to compare with
2273
- * @returns {boolean}
2104
+ * @param other The element to compare with
2274
2105
  */
2275
2106
  equalsShallow (other) {
2276
2107
  const mine = this.currentAttributes()
@@ -2291,7 +2122,6 @@
2291
2122
  /**
2292
2123
  * The local part of the element's qualified name. There is no real namespace parsing here, so this is always the
2293
2124
  * same as tagName.
2294
- * @returns {string}
2295
2125
  */
2296
2126
  get localName () {
2297
2127
  return this.tag
@@ -2300,7 +2130,6 @@
2300
2130
  /**
2301
2131
  * The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is
2302
2132
  * always null.
2303
- * @returns {string|null}
2304
2133
  */
2305
2134
  get prefix () {
2306
2135
  return null
@@ -2309,7 +2138,6 @@
2309
2138
  /**
2310
2139
  * The HTML markup of this element's children. Only the getter is here (the setter, which needs to build new
2311
2140
  * elements from parsed HTML, is on HTMLElementService - see its class comment).
2312
- * @returns {string}
2313
2141
  */
2314
2142
  get innerHTML () {
2315
2143
  return (0, serializeHTML_1.serializeChildren)(this)
@@ -2317,7 +2145,6 @@
2317
2145
 
2318
2146
  /**
2319
2147
  * The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).
2320
- * @returns {string}
2321
2148
  */
2322
2149
  get outerHTML () {
2323
2150
  return (0, serializeHTML_1.serializeOuter)(this)
@@ -2348,11 +2175,9 @@
2348
2175
 
2349
2176
  /**
2350
2177
  * Some elements have default behaviour, this registers it when the element is added.
2351
- * @returns {Function}
2352
2178
  */
2353
2179
  /**
2354
2180
  * A live view of this element's element children (text, comments and the like are not included).
2355
- * @returns {PseudoHTMLCollection}
2356
2181
  */
2357
2182
  get children () {
2358
2183
  return new HTMLCollectionService_1.HTMLCollectionService(this)
@@ -2360,7 +2185,6 @@
2360
2185
 
2361
2186
  /**
2362
2187
  * How many element children this element has.
2363
- * @returns {number}
2364
2188
  */
2365
2189
  get childElementCount () {
2366
2190
  return this.children.length
@@ -2368,7 +2192,6 @@
2368
2192
 
2369
2193
  /**
2370
2194
  * The first child of this element which is an element, or null when there is none.
2371
- * @returns {PseudoElement|null}
2372
2195
  */
2373
2196
  get firstElementChild () {
2374
2197
  return this.children.item(0)
@@ -2376,7 +2199,6 @@
2376
2199
 
2377
2200
  /**
2378
2201
  * The last child of this element which is an element, or null when there is none.
2379
- * @returns {PseudoElement|null}
2380
2202
  */
2381
2203
  get lastElementChild () {
2382
2204
  const elementChildren = this.children
@@ -2385,7 +2207,6 @@
2385
2207
 
2386
2208
  /**
2387
2209
  * The sibling after this one which is an element, or null when there is none.
2388
- * @returns {PseudoElement|null}
2389
2210
  */
2390
2211
  get nextElementSibling () {
2391
2212
  let sibling = this.nextSibling
@@ -2397,7 +2218,6 @@
2397
2218
 
2398
2219
  /**
2399
2220
  * The sibling before this one which is an element, or null when there is none.
2400
- * @returns {PseudoElement|null}
2401
2221
  */
2402
2222
  get previousElementSibling () {
2403
2223
  let sibling = this.previousSibling
@@ -2411,9 +2231,9 @@
2411
2231
  * Put an element at a position relative to this one: beforebegin (before this element, as its previous sibling),
2412
2232
  * afterbegin (as this element's first child), beforeend (as this element's last child) or afterend (after this
2413
2233
  * element, as its next sibling).
2414
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
2415
- * @param {ElementService} element The element to insert
2416
- * @returns {ElementService|null} The inserted element, or null when the position needed a parent this element does not have
2234
+ * @param position beforebegin, afterbegin, beforeend or afterend
2235
+ * @param element The element to insert
2236
+ * @returns The inserted element, or null when the position needed a parent this element does not have
2417
2237
  * @throws {Error} When the position is not one of the four above
2418
2238
  */
2419
2239
  insertAdjacentElement (position, element) {
@@ -2422,8 +2242,8 @@
2422
2242
 
2423
2243
  /**
2424
2244
  * Put text at a position relative to this element, the same as insertAdjacentElement but the text becomes a text node.
2425
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
2426
- * @param {string} text The text to insert
2245
+ * @param position beforebegin, afterbegin, beforeend or afterend
2246
+ * @param text The text to insert
2427
2247
  * @throws {Error} When the position is not one of the four above
2428
2248
  */
2429
2249
  insertAdjacentText (position, text) {
@@ -2432,9 +2252,9 @@
2432
2252
 
2433
2253
  /**
2434
2254
  * Shared implementation for insertAdjacentElement / insertAdjacentText.
2435
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
2436
- * @param {PseudoNode|string} node The node (or text) to insert
2437
- * @returns {PseudoNode|null} The inserted node, or null when the position needed a parent this element does not have
2255
+ * @param position beforebegin, afterbegin, beforeend or afterend
2256
+ * @param node The node (or text) to insert
2257
+ * @returns The inserted node, or null when the position needed a parent this element does not have
2438
2258
  * @throws {Error} When the position is not one of the four above
2439
2259
  */
2440
2260
  insertAdjacent (position, node) {
@@ -2464,8 +2284,8 @@
2464
2284
 
2465
2285
  /**
2466
2286
  * Not implemented yet (HTML parsing is out of scope for now).
2467
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
2468
- * @param {string} text The markup which would be parsed
2287
+ * @param position beforebegin, afterbegin, beforeend or afterend
2288
+ * @param text The markup which would be parsed
2469
2289
  * @throws {Error}
2470
2290
  */
2471
2291
  insertAdjacentHTML (position, text) {
@@ -2474,8 +2294,7 @@
2474
2294
 
2475
2295
  /**
2476
2296
  * Whether this element itself (not its descendants) matches the given CSS selector.
2477
- * @param {string} selectors A CSS selector
2478
- * @returns {boolean}
2297
+ * @param selectors A CSS selector
2479
2298
  */
2480
2299
  matches (selectors) {
2481
2300
  return (0, query_1.matches)(this, selectors)
@@ -2484,8 +2303,7 @@
2484
2303
  /**
2485
2304
  * The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or
2486
2305
  * null when none of them do.
2487
- * @param {string} selectors A CSS selector
2488
- * @returns {PseudoElement|null}
2306
+ * @param selectors A CSS selector
2489
2307
  */
2490
2308
  closest (selectors) {
2491
2309
  return (0, query_1.closest)(this, selectors)
@@ -2519,7 +2337,7 @@
2519
2337
 
2520
2338
  /**
2521
2339
  * An element which is added as a child gets its default events (for example a submit button submits its form).
2522
- * @param {NodeService} child The node which was inserted
2340
+ * @param child The node which was inserted
2523
2341
  */
2524
2342
  childInserted (child) {
2525
2343
  if (typeof child.applyDefaultEvent === 'function') {
@@ -2529,8 +2347,7 @@
2529
2347
 
2530
2348
  /**
2531
2349
  * Check whether the element has an attribute by that name.
2532
- * @param {string} attributeName
2533
- * @returns {boolean}
2350
+ * @param attributeName
2534
2351
  */
2535
2352
  hasAttribute (attributeName) {
2536
2353
  return this.attributeList.some(({
@@ -2540,9 +2357,8 @@
2540
2357
 
2541
2358
  /**
2542
2359
  * Set the value of an attribute, adding the attribute if it did not exist.
2543
- * @param {string} attributeName
2544
- * @param {string} attributeValue
2545
- * @returns {undefined}
2360
+ * @param attributeName
2361
+ * @param attributeValue
2546
2362
  */
2547
2363
  setAttribute (attributeName, attributeValue) {
2548
2364
  const existing = this.attributeList.find(({
@@ -2563,8 +2379,8 @@
2563
2379
 
2564
2380
  /**
2565
2381
  * Retrieve the value of an attribute.
2566
- * @param {string} attributeName
2567
- * @returns {string|null} The value, or null when there is no such attribute
2382
+ * @param attributeName
2383
+ * @returns The value, or null when there is no such attribute
2568
2384
  */
2569
2385
  getAttribute (attributeName) {
2570
2386
  const found = this.currentAttributes().find(({
@@ -2575,8 +2391,7 @@
2575
2391
 
2576
2392
  /**
2577
2393
  * Remove an attribute from the element.
2578
- * @param {string} attributeName
2579
- * @returns {undefined}
2394
+ * @param attributeName
2580
2395
  */
2581
2396
  removeAttribute (attributeName) {
2582
2397
  const index = this.attributeList.findIndex(({
@@ -2589,7 +2404,6 @@
2589
2404
 
2590
2405
  /**
2591
2406
  * The name of every attribute on the element, in the order they were set.
2592
- * @returns {Array<string>}
2593
2407
  */
2594
2408
  getAttributeNames () {
2595
2409
  return this.currentAttributes().map(({
@@ -2599,7 +2413,6 @@
2599
2413
 
2600
2414
  /**
2601
2415
  * Whether the element has any attributes at all.
2602
- * @returns {boolean}
2603
2416
  */
2604
2417
  hasAttributes () {
2605
2418
  return this.attributeList.length > 0
@@ -2607,8 +2420,8 @@
2607
2420
 
2608
2421
  /**
2609
2422
  * Retrieve the node representation of an attribute.
2610
- * @param {string} attributeName
2611
- * @returns {AttrService|null} An Attr for the attribute, or null when there is no such attribute
2423
+ * @param attributeName
2424
+ * @returns An Attr for the attribute, or null when there is no such attribute
2612
2425
  */
2613
2426
  getAttributeNode (attributeName) {
2614
2427
  return this.hasAttribute(attributeName) ? new AttrService_1.AttrService(attributeName, this.getAttribute(attributeName) || '', this) : null
@@ -2617,9 +2430,9 @@
2617
2430
  /**
2618
2431
  * Retrieve the node representation of an attribute. There is no real namespace parsing here, so this ignores
2619
2432
  * the namespace and behaves exactly like getAttributeNode.
2620
- * @param {string} namespace Ignored
2621
- * @param {string} attributeName
2622
- * @returns {AttrService|null} An Attr for the attribute, or null when there is no such attribute
2433
+ * @param namespace Ignored
2434
+ * @param attributeName
2435
+ * @returns An Attr for the attribute, or null when there is no such attribute
2623
2436
  */
2624
2437
  getAttributeNodeNS (namespace, attributeName) {
2625
2438
  return this.getAttributeNode(attributeName)
@@ -2628,9 +2441,9 @@
2628
2441
  /**
2629
2442
  * Retrieve the value of an attribute. There is no real namespace parsing here, so this ignores the namespace
2630
2443
  * and behaves exactly like getAttribute.
2631
- * @param {string} namespace Ignored
2632
- * @param {string} attributeName
2633
- * @returns {string|null} The value, or null when there is no such attribute
2444
+ * @param namespace Ignored
2445
+ * @param attributeName
2446
+ * @returns The value, or null when there is no such attribute
2634
2447
  */
2635
2448
  getAttributeNS (namespace, attributeName) {
2636
2449
  return this.getAttribute(attributeName)
@@ -2639,9 +2452,8 @@
2639
2452
  /**
2640
2453
  * Check whether the element has an attribute by that name. There is no real namespace parsing here, so this
2641
2454
  * ignores the namespace and behaves exactly like hasAttribute.
2642
- * @param {string} namespace Ignored
2643
- * @param {string} attributeName
2644
- * @returns {boolean}
2455
+ * @param namespace Ignored
2456
+ * @param attributeName
2645
2457
  */
2646
2458
  hasAttributeNS (namespace, attributeName) {
2647
2459
  return this.hasAttribute(attributeName)
@@ -2649,8 +2461,8 @@
2649
2461
 
2650
2462
  /**
2651
2463
  * Remove the node representation of an attribute from the element, and return it.
2652
- * @param {AttrService} attr
2653
- * @returns {AttrService} The removed Attr
2464
+ * @param attr
2465
+ * @returns The removed Attr
2654
2466
  * @throws {Error} When the element has no attribute matching attr.name
2655
2467
  */
2656
2468
  removeAttributeNode (attr) {
@@ -2665,9 +2477,8 @@
2665
2477
  /**
2666
2478
  * Remove an attribute from the element. There is no real namespace parsing here, so this ignores the namespace
2667
2479
  * and behaves exactly like removeAttribute.
2668
- * @param {string} namespace Ignored
2669
- * @param {string} attributeName
2670
- * @returns {undefined}
2480
+ * @param namespace Ignored
2481
+ * @param attributeName
2671
2482
  */
2672
2483
  removeAttributeNS (namespace, attributeName) {
2673
2484
  this.removeAttribute(attributeName)
@@ -2676,8 +2487,8 @@
2676
2487
  /**
2677
2488
  * Set the node representation of an attribute, adding the attribute if it did not exist. Returns any previous
2678
2489
  * Attr that had the same name, or null when there was none.
2679
- * @param {AttrService} attr
2680
- * @returns {AttrService|null} The replaced Attr, or null when the attribute was new
2490
+ * @param attr
2491
+ * @returns The replaced Attr, or null when the attribute was new
2681
2492
  */
2682
2493
  setAttributeNode (attr) {
2683
2494
  const existing = this.getAttributeNode(attr.name)
@@ -2688,8 +2499,8 @@
2688
2499
  /**
2689
2500
  * Set the node representation of an attribute. There is no real namespace parsing here, so this behaves
2690
2501
  * exactly like setAttributeNode (Attr.name already carries any prefix).
2691
- * @param {AttrService} attr
2692
- * @returns {AttrService|null} The replaced Attr, or null when the attribute was new
2502
+ * @param attr
2503
+ * @returns The replaced Attr, or null when the attribute was new
2693
2504
  */
2694
2505
  setAttributeNodeNS (attr) {
2695
2506
  return this.setAttributeNode(attr)
@@ -2698,10 +2509,9 @@
2698
2509
  /**
2699
2510
  * Set the value of an attribute, adding the attribute if it did not exist. There is no real namespace parsing
2700
2511
  * here, so this ignores the namespace and behaves exactly like setAttribute.
2701
- * @param {string} namespace Ignored
2702
- * @param {string} attributeName
2703
- * @param {string} attributeValue
2704
- * @returns {undefined}
2512
+ * @param namespace Ignored
2513
+ * @param attributeName
2514
+ * @param attributeValue
2705
2515
  */
2706
2516
  setAttributeNS (namespace, attributeName, attributeValue) {
2707
2517
  this.setAttribute(attributeName, attributeValue)
@@ -2710,9 +2520,8 @@
2710
2520
  /**
2711
2521
  * Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says
2712
2522
  * which of those to do instead. Returns whether the attribute is present after the call.
2713
- * @param {string} attributeName
2714
- * @param {boolean} [force]
2715
- * @returns {boolean}
2523
+ * @param attributeName
2524
+ * @param force
2716
2525
  */
2717
2526
  toggleAttribute (attributeName, force) {
2718
2527
  const present = this.hasAttribute(attributeName)
@@ -2727,7 +2536,6 @@
2727
2536
 
2728
2537
  /**
2729
2538
  * The size of the element and its position, settable directly - there is no layout engine here to compute it.
2730
- * @returns {DOMRect}
2731
2539
  */
2732
2540
  getBoundingClientRect () {
2733
2541
  return this.boundingClientRect
@@ -2736,7 +2544,6 @@
2736
2544
  /**
2737
2545
  * The bounding rectangles for each line of text in the element, settable directly - there is no layout engine
2738
2546
  * here to compute it.
2739
- * @returns {Array<DOMRect>}
2740
2547
  */
2741
2548
  getClientRects () {
2742
2549
  return this.clientRects
@@ -2744,7 +2551,6 @@
2744
2551
 
2745
2552
  /**
2746
2553
  * The Animation objects currently active on the element, settable directly - there is no animation engine here.
2747
- * @returns {Array<*>}
2748
2554
  */
2749
2555
  getAnimations () {
2750
2556
  return this.animations
@@ -2752,7 +2558,6 @@
2752
2558
 
2753
2559
  /**
2754
2560
  * Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
2755
- * @returns {boolean}
2756
2561
  */
2757
2562
  checkVisibility () {
2758
2563
  return this.isVisible
@@ -2761,7 +2566,6 @@
2761
2566
  /**
2762
2567
  * A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a
2763
2568
  * real computed style - just what the element's own style object holds).
2764
- * @returns {{get: function(string): (string|undefined)}}
2765
2569
  */
2766
2570
  computedStyleMap () {
2767
2571
  const style = this.style
@@ -2775,8 +2579,7 @@
2775
2579
 
2776
2580
  /**
2777
2581
  * Whether this element currently has capture of the given pointer.
2778
- * @param {number} pointerId
2779
- * @returns {boolean}
2582
+ * @param pointerId
2780
2583
  */
2781
2584
  hasPointerCapture (pointerId) {
2782
2585
  return this.capturedPointers.has(pointerId)
@@ -2784,8 +2587,7 @@
2784
2587
 
2785
2588
  /**
2786
2589
  * Give this element capture of the given pointer.
2787
- * @param {number} pointerId
2788
- * @returns {undefined}
2590
+ * @param pointerId
2789
2591
  */
2790
2592
  setPointerCapture (pointerId) {
2791
2593
  this.capturedPointers.add(pointerId)
@@ -2793,8 +2595,7 @@
2793
2595
 
2794
2596
  /**
2795
2597
  * Release this element's capture of the given pointer, if it had it.
2796
- * @param {number} pointerId
2797
- * @returns {undefined}
2598
+ * @param pointerId
2798
2599
  */
2799
2600
  releasePointerCapture (pointerId) {
2800
2601
  this.capturedPointers.delete(pointerId)
@@ -2803,9 +2604,8 @@
2803
2604
  /**
2804
2605
  * Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable
2805
2606
  * viewport here: this just sets scrollLeft / scrollTop.
2806
- * @param {number|{left: number, top: number}} [x=0]
2807
- * @param {number} [y=0]
2808
- * @returns {undefined}
2607
+ * @param x
2608
+ * @param y
2809
2609
  */
2810
2610
  scroll (x = 0, y = 0) {
2811
2611
  if (typeof x === 'number') {
@@ -2823,9 +2623,8 @@
2823
2623
 
2824
2624
  /**
2825
2625
  * Scroll to the given position. An alias for scroll.
2826
- * @param {number|{left: number, top: number}} [x=0]
2827
- * @param {number} [y=0]
2828
- * @returns {undefined}
2626
+ * @param x
2627
+ * @param y
2829
2628
  */
2830
2629
  scrollTo (x = 0, y = 0) {
2831
2630
  this.scroll(x, y)
@@ -2833,9 +2632,8 @@
2833
2632
 
2834
2633
  /**
2835
2634
  * Scroll by the given amount, relative to the current position.
2836
- * @param {number|{left: number, top: number}} [x=0]
2837
- * @param {number} [y=0]
2838
- * @returns {undefined}
2635
+ * @param x
2636
+ * @param y
2839
2637
  */
2840
2638
  scrollBy (x = 0, y = 0) {
2841
2639
  if (typeof x === 'number') {
@@ -2851,13 +2649,11 @@
2851
2649
  /**
2852
2650
  * Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so
2853
2651
  * this does nothing (override it on an instance in a test which needs to observe the call).
2854
- * @returns {undefined}
2855
2652
  */
2856
2653
  scrollIntoView () {}
2857
2654
  /**
2858
2655
  * Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just
2859
2656
  * resolves, like a browser granting the request would.
2860
- * @returns {Promise<void>}
2861
2657
  */
2862
2658
  requestFullscreen () {
2863
2659
  return Promise.resolve()
@@ -2866,7 +2662,6 @@
2866
2662
  /**
2867
2663
  * Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this
2868
2664
  * just resolves, like a browser granting the request would.
2869
- * @returns {Promise<void>}
2870
2665
  */
2871
2666
  requestPointerLock () {
2872
2667
  return Promise.resolve()
@@ -2874,8 +2669,7 @@
2874
2669
 
2875
2670
  /**
2876
2671
  * Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
2877
- * @param {{mode: string}} options
2878
- * @returns {PseudoShadowRoot}
2672
+ * @param options
2879
2673
  * @throws {Error}
2880
2674
  */
2881
2675
  attachShadow (options) {
@@ -2892,7 +2686,6 @@
2892
2686
  /**
2893
2687
  * This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is
2894
2688
  * 'closed' - it still exists, but is not reachable this way, like the DOM's).
2895
- * @returns {PseudoShadowRoot|null}
2896
2689
  */
2897
2690
  get shadowRoot () {
2898
2691
  return this.shadowRootInstance && this.shadowRootInstance.mode === 'open' ? this.shadowRootInstance : null
@@ -2900,8 +2693,7 @@
2900
2693
 
2901
2694
  /**
2902
2695
  * Read one of the aria-* reflected properties (see the individual aria* getters/setters below).
2903
- * @param {string} attributeName A real aria-* attribute name (aria-label, ...)
2904
- * @returns {string}
2696
+ * @param attributeName A real aria-* attribute name (aria-label, ...)
2905
2697
  */
2906
2698
  getAriaAttribute (attributeName) {
2907
2699
  return this.getAttribute(attributeName) || ''
@@ -2909,9 +2701,8 @@
2909
2701
 
2910
2702
  /**
2911
2703
  * Write one of the aria-* reflected properties.
2912
- * @param {string} attributeName A real aria-* attribute name (aria-label, ...)
2913
- * @param {string} value
2914
- * @returns {undefined}
2704
+ * @param attributeName A real aria-* attribute name (aria-label, ...)
2705
+ * @param value
2915
2706
  */
2916
2707
  setAriaAttribute (attributeName, value) {
2917
2708
  this.setAttribute(attributeName, value)
@@ -3219,9 +3010,7 @@
3219
3010
  'use strict'
3220
3011
 
3221
3012
  /**
3222
- * @file Substitute for the DOM Event Class.
3223
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3224
- * @version 1.0.0
3013
+ * Substitute for the DOM Event Class.
3225
3014
  */
3226
3015
  Object.defineProperty(exports, '__esModule', {
3227
3016
  value: true
@@ -3229,42 +3018,15 @@
3229
3018
  exports.EventService = void 0
3230
3019
  /**
3231
3020
  * Simulate the behaviour of the Event Class when there is no DOM available.
3232
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3233
- * @class
3234
- * @property {number} NONE
3235
- * @property {number} CAPTURING_PHASE
3236
- * @property {number} AT_TARGET
3237
- * @property {number} BUBBLING_PHASE
3238
- * @property {boolean} bubbles - A Boolean indicating whether the event bubbles up through the Dom or not.
3239
- * @property {boolean} cancelable - A Boolean indicating whether the event is cancelable.
3240
- * @property {boolean} composed - A Boolean value indicating whether the event can bubble across the boundary
3241
- * between the shadow Dom and the regular Dom.
3242
- * @property {function|PseudoEventTarget} currentTarget - A reference to the currently registered target for the event. This
3243
- * is the object to which the event is currently slated to be sent; it's possible this has been changed along the way
3244
- * through re-targeting.
3245
- * @property {boolean} defaultPrevented - Indicates whether event.preventDefault() has been called on the event.
3246
- * @property {boolean} immediatePropagationStopped - Flag that no further propagation should occur, including on current
3247
- * target.
3248
- * @property {boolean} propagationStopped - Flag that no further propagation should occur.
3249
- * @property {int} eventPhase - Indicates which phase of the event flow is being processed. Uses EventService constants.
3250
- * @property {EventTarget|PseudoEventTarget} target - A reference to the target to which the event was originally
3251
- * dispatched.
3252
- * @property {int} timeStamp - The time at which the event was created (in milliseconds). By specification, this
3253
- * value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this
3254
- * to be a DomHighResTimeStamp instead.
3255
- * @property {string} type - The name of the event (case-insensitive).
3256
- * @property {boolean} isTrusted - Indicates whether the event was initiated by the browser (after a user
3257
- * click for instance) or by a script (using an event creation method, like event.initEvent)
3258
3021
  */
3259
3022
  class EventService {
3260
3023
  /**
3261
3024
  *
3262
- * @param {string} typeArg
3263
- * @param {Object} [eventOptions={}]
3264
- * @param {boolean} [eventOptions.bubbles=false]
3265
- * @param {boolean} [eventOptions.cancelable=false]
3266
- * @param {boolean} [eventOptions.composed=false]
3267
- * @constructor
3025
+ * @param typeArg
3026
+ * @param eventOptions
3027
+ * @param eventOptions.bubbles
3028
+ * @param eventOptions.cancelable
3029
+ * @param eventOptions.composed
3268
3030
  */
3269
3031
  constructor (typeArg = '', {
3270
3032
  bubbles = false,
@@ -3272,17 +3034,29 @@
3272
3034
  composed = false
3273
3035
  } = {}) {
3274
3036
  this.properties = {
3037
+ /** A Boolean indicating whether the event bubbles up through the Dom or not. */
3275
3038
  bubbles: false,
3039
+ /** A Boolean indicating whether the event is cancelable. */
3276
3040
  cancelable: false,
3041
+ /** A Boolean value indicating whether the event can bubble across the boundary between the shadow Dom and the regular Dom. */
3277
3042
  composed: false,
3043
+ /** 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. */
3278
3044
  currentTarget: null,
3045
+ /** Indicates whether event.preventDefault() has been called on the event. */
3279
3046
  defaultPrevented: false,
3047
+ /** Flag that no further propagation should occur, including on current target. */
3280
3048
  immediatePropagationStopped: false,
3049
+ /** Flag that no further propagation should occur. */
3281
3050
  propagationStopped: false,
3051
+ /** Indicates which phase of the event flow is being processed. Uses EventService constants. */
3282
3052
  eventPhase: 0,
3053
+ /** A reference to the target to which the event was originally dispatched. */
3283
3054
  target: null,
3055
+ /** 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. */
3284
3056
  timeStamp: Math.floor(Date.now() / 1000),
3057
+ /** The name of the event (case-insensitive). */
3285
3058
  type: '',
3059
+ /** 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) */
3286
3060
  isTrusted: false,
3287
3061
  dispatching: false,
3288
3062
  inPassiveListener: false,
@@ -3338,7 +3112,6 @@
3338
3112
 
3339
3113
  /**
3340
3114
  * Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
3341
- * @returns {EventInner}
3342
3115
  */
3343
3116
  get inner () {
3344
3117
  const self = this
@@ -3407,8 +3180,6 @@
3407
3180
 
3408
3181
  /**
3409
3182
  * Return an array of targets that will have the event executed open them. The order is based on the eventPhase
3410
- * @method
3411
- * @returns {Array.<PseudoEventTarget>}
3412
3183
  */
3413
3184
  composedPath () {
3414
3185
  // While the event is being dispatched this is every target it travels through, the target first and the root last
@@ -3417,8 +3188,6 @@
3417
3188
 
3418
3189
  /**
3419
3190
  * Cancels the event (if it is cancelable).
3420
- * @method
3421
- * @returns {null}
3422
3191
  */
3423
3192
  preventDefault () {
3424
3193
  // Only an event which can be cancelled can be prevented, and a passive listener cannot prevent the default
@@ -3434,8 +3203,6 @@
3434
3203
  * For this particular event, no other listener will be called.
3435
3204
  * Neither those attached on the same element, nor those attached on elements which will be traversed later (in
3436
3205
  * capture phase, for instance)
3437
- * @method
3438
- * @returns {null}
3439
3206
  */
3440
3207
  stopImmediatePropagation () {
3441
3208
  this.setReadOnlyProperties({
@@ -3446,8 +3213,6 @@
3446
3213
 
3447
3214
  /**
3448
3215
  * Stops the propagation of events further along in the Dom.
3449
- * @method
3450
- * @returns {null}
3451
3216
  */
3452
3217
  stopPropagation () {
3453
3218
  this.setReadOnlyProperties({
@@ -3487,9 +3252,7 @@
3487
3252
  value: true
3488
3253
  })
3489
3254
  /**
3490
- * @file Substitute for the DOM EventTarget Class.
3491
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3492
- * @version 1.0.0
3255
+ * Substitute for the DOM EventTarget Class.
3493
3256
  */
3494
3257
  const EventService_1 = require('./EventService')
3495
3258
  const PseudoEventListener_1 = __importDefault(require('../classes/PseudoEventListener'))
@@ -3500,17 +3263,8 @@
3500
3263
  * Dispatching an event sends it through the tree the way the DOM does: down from the root to the target (capture
3501
3264
  * listeners), to the target itself, then back up to the root (the listeners which are not capture listeners, when the
3502
3265
  * event bubbles).
3503
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3504
- * @class
3505
- * @property {Object.<string, Array.<PseudoEventListener>>} listeners
3506
- * @property {function} addEventListener
3507
- * @property {function} removeEventListener
3508
- * @property {function} dispatchEvent
3509
3266
  */
3510
3267
  class EventTargetService {
3511
- /**
3512
- * @constructor
3513
- */
3514
3268
  constructor () {
3515
3269
  this.listeners = {}
3516
3270
  this.defaultEvent = {}
@@ -3518,8 +3272,7 @@
3518
3272
 
3519
3273
  /**
3520
3274
  * The listeners registered for a type of event, creating the (empty) list of them when there are none yet.
3521
- * @param {string} type
3522
- * @returns {LinkedList}
3275
+ * @param type
3523
3276
  */
3524
3277
  listenersFor (type) {
3525
3278
  if (!(type in this.listeners)) {
@@ -3533,8 +3286,8 @@
3533
3286
  * (at the target, the capture listeners run before the others). Listeners which are added while this runs do not run
3534
3287
  * for this event, and listeners which are removed while it runs no longer do. Running stops as soon as immediate
3535
3288
  * propagation is stopped. A listener which throws does not stop the others.
3536
- * @param {EventService} event The event, which is at a phase and has a current target
3537
- * @returns {Array<*>} The errors which the listeners threw
3289
+ * @param event The event, which is at a phase and has a current target
3290
+ * @returns The errors which the listeners threw
3538
3291
  */
3539
3292
  runEvents (event) {
3540
3293
  const errors = []
@@ -3567,8 +3320,8 @@
3567
3320
 
3568
3321
  /**
3569
3322
  * Take a listener out of the registered listeners, so that it does not run again.
3570
- * @param {string} type
3571
- * @param {PseudoEventListener} listener
3323
+ * @param type
3324
+ * @param listener
3572
3325
  */
3573
3326
  removeListener (type, listener) {
3574
3327
  listener.removed = true
@@ -3578,8 +3331,8 @@
3578
3331
 
3579
3332
  /**
3580
3333
  * Register the function to run when nothing else has prevented the default for this type of event.
3581
- * @param {string} type
3582
- * @param {Function} callback
3334
+ * @param type
3335
+ * @param callback
3583
3336
  */
3584
3337
  setDefaultEvent (type, callback) {
3585
3338
  this.listenersFor(type)
@@ -3589,9 +3342,9 @@
3589
3342
  /**
3590
3343
  * Registers an event handler of a specific event type. Adding the same handler again for the same type and phase does
3591
3344
  * nothing, like the DOM.
3592
- * @param {string} type The type of event to listen for
3593
- * @param {Function|Object} callback The function to call (or an object with a handleEvent function)
3594
- * @param {Object|boolean} [useCapture=false] Listen while the event travels down to the target (true), or an object with capture, once and passive
3345
+ * @param type The type of event to listen for
3346
+ * @param callback The function to call (or an object with a handleEvent function)
3347
+ * @param useCapture Listen while the event travels down to the target (true), or an object with capture, once and passive
3595
3348
  */
3596
3349
  addEventListener (type, callback, useCapture = false) {
3597
3350
  let options = {
@@ -3625,9 +3378,9 @@
3625
3378
 
3626
3379
  /**
3627
3380
  * Removes an event listener, the one which was added with the same type, handler and phase.
3628
- * @param {string} type The type of event
3629
- * @param {Function|Object} callback The handler which was added
3630
- * @param {Object|boolean} [options=false] Whether the listener was a capture listener (true), or an object with capture
3381
+ * @param type The type of event
3382
+ * @param callback The handler which was added
3383
+ * @param options Whether the listener was a capture listener (true), or an object with capture
3631
3384
  */
3632
3385
  removeEventListener (type, callback, options = false) {
3633
3386
  if (!(type in this.listeners)) {
@@ -3643,8 +3396,8 @@
3643
3396
  * parent up to the root. stopPropagation() stops it reaching further targets, stopImmediatePropagation() also stops
3644
3397
  * the remaining listeners of the current target. Afterwards, unless the default was prevented, the default action
3645
3398
  * of this target (see setDefaultEvent) runs. The event can be dispatched again afterwards.
3646
- * @param {EventService} event The event to dispatch
3647
- * @returns {boolean} False when the event was cancelable and a listener prevented the default, otherwise true
3399
+ * @param event The event to dispatch
3400
+ * @returns False when the event was cancelable and a listener prevented the default, otherwise true
3648
3401
  * @throws {Error} When the event is already being dispatched, or (after the whole dispatch has finished) the error
3649
3402
  * which a listener threw (an error with all of them in its errors property when several did)
3650
3403
  */
@@ -3709,23 +3462,16 @@
3709
3462
  })
3710
3463
  exports.FocusEventService = void 0
3711
3464
  /**
3712
- * @file Substitute for the DOM FocusEvent Class.
3713
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3714
- * @version 1.0.0
3465
+ * Substitute for the DOM FocusEvent Class.
3715
3466
  */
3716
3467
  const UIEventService_1 = require('./UIEventService')
3717
3468
  /**
3718
3469
  * Simulate the behaviour of the FocusEvent Class when there is no DOM available.
3719
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3720
- * @class
3721
- * @augments UIEventService
3722
- * @property {PseudoEventTarget|null} relatedTarget
3723
3470
  */
3724
3471
  class FocusEventService extends UIEventService_1.UIEventService {
3725
3472
  /**
3726
- * @param {string} [typeArg=''] The type of the event
3727
- * @param {FocusEventInit} [init={}] The options for the event
3728
- * @constructor
3473
+ * @param typeArg The type of the event
3474
+ * @param init The options for the event
3729
3475
  */
3730
3476
  constructor (typeArg = '', init = {}) {
3731
3477
  super(typeArg, init)
@@ -3749,24 +3495,19 @@
3749
3495
  })
3750
3496
  exports.HTMLCollectionService = void 0
3751
3497
  /**
3752
- * @file Substitute for the DOM HTMLCollection Class.
3753
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3754
- * @version 1.0.0
3498
+ * Substitute for the DOM HTMLCollection Class.
3755
3499
  */
3756
3500
  const NodeService_1 = require('./NodeService')
3757
3501
  /**
3758
3502
  * Simulate the behaviour of the HTMLCollection Class when there is no DOM available: a live view of some of a node's
3759
3503
  * element descendants, recomputed each time it is used rather than kept in sync as they change.
3760
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3761
- * @class
3762
3504
  */
3763
3505
  class HTMLCollectionService {
3764
3506
  /**
3765
- * @param {NodeService} owner The node this is a live view of a part of
3766
- * @param {function(*): boolean} [predicate] Only elements which pass this are included (every element by default)
3767
- * @param {boolean} [deep=false] Include every matching descendant (true, like getElementsByTagName), not just the
3507
+ * @param owner The node this is a live view of a part of
3508
+ * @param predicate Only elements which pass this are included (every element by default)
3509
+ * @param deep Include every matching descendant (true, like getElementsByTagName), not just the
3768
3510
  * direct element children (false, like Element.children)
3769
- * @constructor
3770
3511
  */
3771
3512
  constructor (owner, predicate = () => true, deep = false) {
3772
3513
  this.owner = owner
@@ -3776,7 +3517,6 @@
3776
3517
 
3777
3518
  /**
3778
3519
  * The current elements the collection holds, in tree order.
3779
- * @returns {Array<PseudoNode>}
3780
3520
  */
3781
3521
  elements () {
3782
3522
  const results = []
@@ -3796,7 +3536,6 @@
3796
3536
 
3797
3537
  /**
3798
3538
  * How many elements are in the collection right now.
3799
- * @returns {number}
3800
3539
  */
3801
3540
  get length () {
3802
3541
  return this.elements().length
@@ -3804,8 +3543,7 @@
3804
3543
 
3805
3544
  /**
3806
3545
  * The element at the given index, or null when there is none.
3807
- * @param {number} index
3808
- * @returns {*}
3546
+ * @param index
3809
3547
  */
3810
3548
  item (index) {
3811
3549
  return this.elements()[index] || null
@@ -3813,8 +3551,7 @@
3813
3551
 
3814
3552
  /**
3815
3553
  * The element whose id, or (failing that) whose name attribute, is the given value, or null when there is none.
3816
- * @param {string} name
3817
- * @returns {*}
3554
+ * @param name
3818
3555
  */
3819
3556
  namedItem (name) {
3820
3557
  const elements = this.elements()
@@ -3823,7 +3560,6 @@
3823
3560
 
3824
3561
  /**
3825
3562
  * Iterate over the current elements.
3826
- * @returns {Iterator}
3827
3563
  */
3828
3564
  [Symbol.iterator] () {
3829
3565
  return this.elements()[Symbol.iterator]()
@@ -3854,27 +3590,21 @@
3854
3590
  const parseHTML_1 = __importDefault(require('../factories/parseHTML'))
3855
3591
  /**
3856
3592
  * Simulate the behaviour of the HTMLElement Class when there is no DOM available.
3857
- * @author Joshua Heagle <joshuaheagle@gmail.com>
3858
- * @class
3859
- * @augments PseudoElement
3860
- * @property {boolean} hidden - State of whether element is visible
3861
- * @property {number} offsetHeight - The height of the element as offset by the parent element
3862
- * @property {number} offsetLeft - The position of the left side of the element based on the parent element
3863
- * @property {PseudoHTMLElement} offsetParent - A reference to the closest positioned parent element
3864
- * @property {number} offsetTop - The position of the top side of the element based on the parent element
3865
- * @property {number} offsetWidth - The width of the element as offset by the parent element
3866
- * @property {CSSStyleDeclarationService} style - The element's inline styles, live and settable per property
3867
- * @property {Object.<string, string>} dataset - The element's data-* attributes, live, under their camelCase names
3868
- * @property {string} title - The title attribute which affects the text visible on hover
3593
+ *
3594
+ * It also has these simple properties, which are stored as attributes:
3595
+ * - `hidden`: state of whether the element is visible
3596
+ * - `title`: the title attribute, which affects the text visible on hover
3597
+ * - `offsetHeight`, `offsetWidth`: the height and width of the element as offset by the parent element
3598
+ * - `offsetLeft`, `offsetTop`: the position of the left and top sides of the element based on the parent element
3599
+ * - `offsetParent`: a reference to the closest positioned parent element
3869
3600
  */
3870
3601
  class HTMLElementService extends ElementService_1.ElementService {
3871
3602
  /**
3872
3603
  * Simulate the HTMLElement object when the Dom is not available
3873
- * @param {Object} [elementOptions={}]
3874
- * @param {string} [elementOptions.tagName='']
3875
- * @param {PseudoNode|Object} [elementOptions.parent={}]
3876
- * @param {Array} [elementOptions.children=[]]
3877
- * @constructor
3604
+ * @param elementOptions
3605
+ * @param elementOptions.tagName
3606
+ * @param elementOptions.parent
3607
+ * @param elementOptions.children
3878
3608
  */
3879
3609
  constructor ({
3880
3610
  tagName = '',
@@ -3917,7 +3647,6 @@
3917
3647
  /**
3918
3648
  * The element's inline styles: a live CSSStyleDeclaration-like object, so both style.setProperty('color', 'red')
3919
3649
  * and style.color = 'red' work.
3920
- * @returns {CSSStyleDeclarationService}
3921
3650
  */
3922
3651
  get style () {
3923
3652
  return this.styleDeclaration
@@ -3926,7 +3655,6 @@
3926
3655
  /**
3927
3656
  * The element's data-* attributes, live, under their camelCase names (data-foo-bar <-> dataset.fooBar). Backed
3928
3657
  * directly by getAttribute / setAttribute, so it is never out of sync with the attributes themselves.
3929
- * @returns {Object.<string, string>}
3930
3658
  */
3931
3659
  get dataset () {
3932
3660
  return this.datasetProxy
@@ -3934,7 +3662,6 @@
3934
3662
 
3935
3663
  /**
3936
3664
  * Whether this tag has a `value` (the form controls which do).
3937
- * @returns {boolean}
3938
3665
  */
3939
3666
  hasValueProperty () {
3940
3667
  return ['input', 'textarea', 'select', 'button', 'option', 'output'].indexOf(this.tagName.toLowerCase()) >= 0
@@ -3942,7 +3669,6 @@
3942
3669
 
3943
3670
  /**
3944
3671
  * Whether this tag has a `checked` (only input does).
3945
- * @returns {boolean}
3946
3672
  */
3947
3673
  hasCheckedProperty () {
3948
3674
  return this.tagName.toLowerCase() === 'input'
@@ -3950,9 +3676,8 @@
3950
3676
 
3951
3677
  /**
3952
3678
  * Put a plain own property on the element, as assigning a property this element does not have does in the DOM.
3953
- * @param {string} name
3954
- * @param {*} value
3955
- * @returns {undefined}
3679
+ * @param name
3680
+ * @param value
3956
3681
  */
3957
3682
  setExpando (name, value) {
3958
3683
  Object.defineProperty(this, name, {
@@ -3967,7 +3692,6 @@
3967
3692
  * The current value of a form control. Until it is set (or edited), it is the value attribute (the default value),
3968
3693
  * or '' when there is none ('on' for a checkbox or radio); setting it never changes the attribute, like the DOM's.
3969
3694
  * Only form controls (input, textarea, select, button, option, output) have one.
3970
- * @returns {string|undefined}
3971
3695
  */
3972
3696
  get value () {
3973
3697
  if (!this.hasValueProperty()) {
@@ -3994,7 +3718,6 @@
3994
3718
  /**
3995
3719
  * Whether a checkbox or radio input is checked. Until it is set, it follows the checked attribute (which sets the
3996
3720
  * default); setting it never changes the attribute, like the DOM's. Only input has one.
3997
- * @returns {boolean|undefined}
3998
3721
  */
3999
3722
  get checked () {
4000
3723
  if (!this.hasCheckedProperty()) {
@@ -4014,7 +3737,6 @@
4014
3737
  /**
4015
3738
  * Style is not attribute-backed like most properties (see the constructor), so cloneNode needs its own copy of it,
4016
3739
  * and a form control keeps its current value and checkedness (as the DOM's cloneNode does).
4017
- * @returns {NodeService}
4018
3740
  */
4019
3741
  cloneShallow () {
4020
3742
  const copy = super.cloneShallow()
@@ -4026,8 +3748,7 @@
4026
3748
 
4027
3749
  /**
4028
3750
  * Style is not attribute-backed like most properties, so isEqualNode needs to compare it separately too.
4029
- * @param {NodeService} other The node to compare with
4030
- * @returns {boolean}
3751
+ * @param other The node to compare with
4031
3752
  */
4032
3753
  equalsShallow (other) {
4033
3754
  return super.equalsShallow(other) && this.style.cssText === other.style.cssText
@@ -4036,8 +3757,7 @@
4036
3757
  /**
4037
3758
  * Parses html with this class building each new element (matches HTML: parsed elements behave like plain
4038
3759
  * HTMLElements, not whatever specialized class happens to be setting innerHTML / outerHTML).
4039
- * @param {string} html
4040
- * @returns {Array<*>}
3760
+ * @param html
4041
3761
  */
4042
3762
  parse (html) {
4043
3763
  return (0, parseHTML_1.default)(html, this.ownerDocument, HTMLElementService)
@@ -4046,8 +3766,7 @@
4046
3766
  /**
4047
3767
  * Replace this element's children by parsing html. innerHTML's setter is here rather than on ElementService (which
4048
3768
  * only has the getter) because building the new elements needs a concrete element class - see parse().
4049
- * @param {string} html
4050
- * @returns {undefined}
3769
+ * @param html
4051
3770
  */
4052
3771
  set innerHTML (html) {
4053
3772
  this.replaceChildren(...this.parse(html))
@@ -4060,8 +3779,7 @@
4060
3779
  /**
4061
3780
  * Replace this element itself, in its parent, by parsing html. Does nothing when it has no parent, like
4062
3781
  * replaceWith. outerHTML's setter is here rather than on ElementService for the same reason as innerHTML's.
4063
- * @param {string} html
4064
- * @returns {undefined}
3782
+ * @param html
4065
3783
  */
4066
3784
  set outerHTML (html) {
4067
3785
  this.replaceWith(...this.parse(html))
@@ -4074,9 +3792,8 @@
4074
3792
  /**
4075
3793
  * Parse html and insert the resulting nodes at the given position, like insertAdjacentElement /
4076
3794
  * insertAdjacentText.
4077
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
4078
- * @param {string} html The markup to parse
4079
- * @returns {undefined}
3795
+ * @param position beforebegin, afterbegin, beforeend or afterend
3796
+ * @param html The markup to parse
4080
3797
  * @throws {Error} When the position is not one of the four above
4081
3798
  */
4082
3799
  insertAdjacentHTML (position, html) {
@@ -4101,7 +3818,6 @@
4101
3818
 
4102
3819
  /**
4103
3820
  * Whether this element can have the focus: form controls and links which are not disabled, and anything with a tabindex.
4104
- * @returns {boolean}
4105
3821
  */
4106
3822
  get canFocus () {
4107
3823
  if (this.hasAttribute('disabled')) {
@@ -4195,25 +3911,16 @@
4195
3911
  })
4196
3912
  exports.InputEventService = void 0
4197
3913
  /**
4198
- * @file Substitute for the DOM InputEvent Class.
4199
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4200
- * @version 1.0.0
3914
+ * Substitute for the DOM InputEvent Class.
4201
3915
  */
4202
3916
  const UIEventService_1 = require('./UIEventService')
4203
3917
  /**
4204
3918
  * Simulate the behaviour of the InputEvent Class when there is no DOM available.
4205
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4206
- * @class
4207
- * @augments UIEventService
4208
- * @property {string|null} data
4209
- * @property {string} inputType
4210
- * @property {boolean} isComposing
4211
3919
  */
4212
3920
  class InputEventService extends UIEventService_1.UIEventService {
4213
3921
  /**
4214
- * @param {string} [typeArg=''] The type of the event
4215
- * @param {InputEventInit} [init={}] The options for the event
4216
- * @constructor
3922
+ * @param typeArg The type of the event
3923
+ * @param init The options for the event
4217
3924
  */
4218
3925
  constructor (typeArg = '', init = {}) {
4219
3926
  super(typeArg, init)
@@ -4244,28 +3951,17 @@
4244
3951
  })
4245
3952
  exports.KeyboardEventService = void 0
4246
3953
  /**
4247
- * @file Substitute for the DOM KeyboardEvent Class.
4248
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4249
- * @version 1.0.0
3954
+ * Substitute for the DOM KeyboardEvent Class.
4250
3955
  */
4251
3956
  const UIEventService_1 = require('./UIEventService')
4252
3957
  const modifierState_1 = require('../functions/modifierState')
4253
3958
  /**
4254
3959
  * Simulate the behaviour of the KeyboardEvent Class when there is no DOM available.
4255
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4256
- * @class
4257
- * @augments UIEventService
4258
- * @property {string} key
4259
- * @property {string} code
4260
- * @property {number} location
4261
- * @property {boolean} repeat
4262
- * @property {boolean} isComposing
4263
3960
  */
4264
3961
  class KeyboardEventService extends UIEventService_1.UIEventService {
4265
3962
  /**
4266
- * @param {string} [typeArg=''] The type of the event
4267
- * @param {KeyboardEventInit} [init={}] The options for the event
4268
- * @constructor
3963
+ * @param typeArg The type of the event
3964
+ * @param init The options for the event
4269
3965
  */
4270
3966
  constructor (typeArg = '', init = {}) {
4271
3967
  super(typeArg, init)
@@ -4315,8 +4011,7 @@
4315
4011
 
4316
4012
  /**
4317
4013
  * Whether a modifier key was held down when the event happened.
4318
- * @param {string} key Control, Shift, Alt or Meta
4319
- * @returns {boolean}
4014
+ * @param key Control, Shift, Alt or Meta
4320
4015
  */
4321
4016
  getModifierState (key) {
4322
4017
  return (0, modifierState_1.modifierState)(this.modifiers, key)
@@ -4332,30 +4027,17 @@
4332
4027
  })
4333
4028
  exports.MouseEventService = void 0
4334
4029
  /**
4335
- * @file Substitute for the DOM MouseEvent Class.
4336
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4337
- * @version 1.0.0
4030
+ * Substitute for the DOM MouseEvent Class.
4338
4031
  */
4339
4032
  const UIEventService_1 = require('./UIEventService')
4340
4033
  const modifierState_1 = require('../functions/modifierState')
4341
4034
  /**
4342
4035
  * Simulate the behaviour of the MouseEvent Class when there is no DOM available.
4343
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4344
- * @class
4345
- * @augments UIEventService
4346
- * @property {number} screenX
4347
- * @property {number} screenY
4348
- * @property {number} clientX
4349
- * @property {number} clientY
4350
- * @property {number} button
4351
- * @property {number} buttons
4352
- * @property {PseudoEventTarget|null} relatedTarget
4353
4036
  */
4354
4037
  class MouseEventService extends UIEventService_1.UIEventService {
4355
4038
  /**
4356
- * @param {string} [typeArg=''] The type of the event
4357
- * @param {MouseEventInit} [init={}] The options for the event
4358
- * @constructor
4039
+ * @param typeArg The type of the event
4040
+ * @param init The options for the event
4359
4041
  */
4360
4042
  constructor (typeArg = '', init = {}) {
4361
4043
  super(typeArg, init)
@@ -4425,8 +4107,7 @@
4425
4107
 
4426
4108
  /**
4427
4109
  * Whether a modifier key was held down when the event happened.
4428
- * @param {string} key Control, Shift, Alt or Meta
4429
- * @returns {boolean}
4110
+ * @param key Control, Shift, Alt or Meta
4430
4111
  */
4431
4112
  getModifierState (key) {
4432
4113
  return (0, modifierState_1.modifierState)(this.modifiers, key)
@@ -4445,13 +4126,10 @@
4445
4126
  exports.NamedNodeMapService = void 0
4446
4127
  /**
4447
4128
  * Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.
4448
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4449
- * @class
4450
4129
  */
4451
4130
  class NamedNodeMapService {
4452
4131
  /**
4453
- * @param {Array<PseudoAttr>} [attributes=[]] The attributes to start with
4454
- * @constructor
4132
+ * @param attributes The attributes to start with
4455
4133
  */
4456
4134
  constructor (attributes = []) {
4457
4135
  this.attributes = attributes.slice()
@@ -4532,9 +4210,7 @@
4532
4210
  })
4533
4211
  exports.CommentService = exports.TextService = exports.NodeService = void 0
4534
4212
  /**
4535
- * @file Substitute for the DOM Node Class.
4536
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4537
- * @version 1.0.0
4213
+ * Substitute for the DOM Node Class.
4538
4214
  */
4539
4215
  const generateNodeList_1 = __importDefault(require('../factories/generateNodeList'))
4540
4216
  const TreeLinker_1 = require('collect-your-stuff/dist/collections/linked-tree-list/TreeLinker')
@@ -4543,18 +4219,8 @@
4543
4219
  const query_1 = require('../factories/query')
4544
4220
  /**
4545
4221
  * Simulate the behaviour of the Node Class when there is no DOM available.
4546
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4547
- * @class
4548
- * @augments PseudoEventTarget
4549
- * @property {string} name
4550
- * @property {function} appendChild
4551
- * @property {function} removeChild
4552
4222
  */
4553
4223
  class NodeService extends EventTargetService_1.default {
4554
- /**
4555
- *
4556
- * @constructor
4557
- */
4558
4224
  constructor () {
4559
4225
  super()
4560
4226
  this.nodeValueStore = null
@@ -4660,8 +4326,8 @@
4660
4326
 
4661
4327
  /**
4662
4328
  * Add a node as the last child of this node (a node which is already in a tree is moved).
4663
- * @param {PseudoNode} childNode The node to add
4664
- * @returns {PseudoNode} The added node
4329
+ * @param childNode The node to add
4330
+ * @returns The added node
4665
4331
  */
4666
4332
  appendChild (childNode) {
4667
4333
  return this.insertBefore(childNode, null)
@@ -4669,7 +4335,6 @@
4669
4335
 
4670
4336
  /**
4671
4337
  * Whether this kind of node can have children (text, comments and attributes cannot).
4672
- * @returns {boolean}
4673
4338
  */
4674
4339
  get acceptsChildren () {
4675
4340
  return true
@@ -4678,7 +4343,6 @@
4678
4343
  /**
4679
4344
  * Make a copy of this node without its children, its parent or its listeners, which is what cloneNode starts from.
4680
4345
  * Kinds of node which are made with arguments override this to give them.
4681
- * @returns {NodeService}
4682
4346
  */
4683
4347
  cloneShallow () {
4684
4348
  const copy = new this.constructor()
@@ -4690,8 +4354,7 @@
4690
4354
  /**
4691
4355
  * Whether another node of the same type is equal to this one apart from its children, which isEqualNode compares
4692
4356
  * afterwards. Kinds of node with more to compare (an element has attributes) override this.
4693
- * @param {NodeService} other The node to compare with
4694
- * @returns {boolean}
4357
+ * @param other The node to compare with
4695
4358
  */
4696
4359
  equalsShallow (other) {
4697
4360
  return this.nodeName === other.nodeName && this.nodeValue === other.nodeValue
@@ -4699,7 +4362,7 @@
4699
4362
 
4700
4363
  /**
4701
4364
  * Add nodes (strings become text nodes) as the last children of this node, in the order given.
4702
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
4365
+ * @param nodes The nodes (or text) to add
4703
4366
  * @throws {Error} When this kind of node cannot have children
4704
4367
  */
4705
4368
  append (...nodes) {
@@ -4708,7 +4371,7 @@
4708
4371
 
4709
4372
  /**
4710
4373
  * Add nodes (strings become text nodes) as the first children of this node, in the order given.
4711
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
4374
+ * @param nodes The nodes (or text) to add
4712
4375
  * @throws {Error} When this kind of node cannot have children
4713
4376
  */
4714
4377
  prepend (...nodes) {
@@ -4718,7 +4381,7 @@
4718
4381
 
4719
4382
  /**
4720
4383
  * Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
4721
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
4384
+ * @param nodes The nodes (or text) to add
4722
4385
  * @throws {Error} When this kind of node cannot have children
4723
4386
  */
4724
4387
  replaceChildren (...nodes) {
@@ -4731,7 +4394,7 @@
4731
4394
  /**
4732
4395
  * Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has
4733
4396
  * no parent.
4734
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
4397
+ * @param nodes The nodes (or text) to add
4735
4398
  */
4736
4399
  before (...nodes) {
4737
4400
  const parent = this.parentNode
@@ -4744,7 +4407,7 @@
4744
4407
  /**
4745
4408
  * Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no
4746
4409
  * parent.
4747
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to add
4410
+ * @param nodes The nodes (or text) to add
4748
4411
  */
4749
4412
  after (...nodes) {
4750
4413
  const parent = this.parentNode
@@ -4758,7 +4421,7 @@
4758
4421
  /**
4759
4422
  * Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing
4760
4423
  * when this node has no parent.
4761
- * @param {...(PseudoNode|string)} nodes The nodes (or text) to put in this node's place
4424
+ * @param nodes The nodes (or text) to put in this node's place
4762
4425
  */
4763
4426
  replaceWith (...nodes) {
4764
4427
  const parent = this.parentNode
@@ -4781,8 +4444,7 @@
4781
4444
  /**
4782
4445
  * Turn a value given to append / prepend / before / after / replaceWith / replaceChildren into a node: a string
4783
4446
  * becomes a text node belonging to this node's document, anything else is returned as it is.
4784
- * @param {PseudoNode|string} value The value to add
4785
- * @returns {PseudoNode}
4447
+ * @param value The value to add
4786
4448
  */
4787
4449
  toChildNode (value) {
4788
4450
  if (typeof value !== 'string') {
@@ -4795,8 +4457,7 @@
4795
4457
 
4796
4458
  /**
4797
4459
  * Every element below this node with the given tag name (or every element when tagName is *), live.
4798
- * @param {string} tagName
4799
- * @returns {PseudoHTMLCollection}
4460
+ * @param tagName
4800
4461
  */
4801
4462
  getElementsByTagName (tagName) {
4802
4463
  const matchesTag = tagName === '*' ? () => true : element => element.tagName === tagName
@@ -4805,8 +4466,7 @@
4805
4466
 
4806
4467
  /**
4807
4468
  * Every element below this node which has all of the given (space separated) classes, live.
4808
- * @param {string} className
4809
- * @returns {PseudoHTMLCollection}
4469
+ * @param className
4810
4470
  */
4811
4471
  getElementsByClassName (className) {
4812
4472
  const names = className.trim().split(/\s+/).filter(Boolean)
@@ -4816,9 +4476,8 @@
4816
4476
  /**
4817
4477
  * Every element below this node with the given tag name, live. There is no real namespace parsing here, so this
4818
4478
  * ignores the namespace and behaves exactly like getElementsByTagName.
4819
- * @param {string} namespace Ignored
4820
- * @param {string} tagName
4821
- * @returns {PseudoHTMLCollection}
4479
+ * @param namespace Ignored
4480
+ * @param tagName
4822
4481
  */
4823
4482
  getElementsByTagNameNS (namespace, tagName) {
4824
4483
  return this.getElementsByTagName(tagName)
@@ -4826,8 +4485,7 @@
4826
4485
 
4827
4486
  /**
4828
4487
  * The first element below this node which matches the CSS selector, in tree order, or null when there is none.
4829
- * @param {string} selectors A CSS selector
4830
- * @returns {PseudoElement|null}
4488
+ * @param selectors A CSS selector
4831
4489
  */
4832
4490
  querySelector (selectors) {
4833
4491
  return (0, query_1.querySelector)(selectors, this)
@@ -4836,8 +4494,7 @@
4836
4494
  /**
4837
4495
  * Every element below this node which matches the CSS selector, in tree order. A plain array (not a live
4838
4496
  * collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
4839
- * @param {string} selectors A CSS selector
4840
- * @returns {Array<PseudoElement>}
4497
+ * @param selectors A CSS selector
4841
4498
  */
4842
4499
  querySelectorAll (selectors) {
4843
4500
  return (0, query_1.querySelectorAll)(selectors, this)
@@ -4846,14 +4503,13 @@
4846
4503
  /**
4847
4504
  * Called each time a node has been inserted as a child of this node, so that nodes which need to react to children
4848
4505
  * (for example elements applying default events) can do so.
4849
- * @param {NodeService} child The node which was inserted
4506
+ * @param child The node which was inserted
4850
4507
  */
4851
4508
  childInserted (child) {}
4852
4509
  /**
4853
4510
  * Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied
4854
4511
  * too, all the way down.
4855
- * @param {boolean} [deep=false] Copy the children as well
4856
- * @returns {PseudoNode}
4512
+ * @param deep Copy the children as well
4857
4513
  */
4858
4514
  cloneNode (deep = false) {
4859
4515
  const copy = this.cloneShallow()
@@ -4868,8 +4524,7 @@
4868
4524
  * itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree,
4869
4525
  * CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant,
4870
4526
  * otherwise PRECEDING or FOLLOWING by their order in the tree.
4871
- * @param {PseudoNode} otherNode The node to locate
4872
- * @returns {number}
4527
+ * @param otherNode The node to locate
4873
4528
  */
4874
4529
  compareDocumentPosition (otherNode) {
4875
4530
  if (otherNode === this) {
@@ -4910,8 +4565,7 @@
4910
4565
 
4911
4566
  /**
4912
4567
  * Check whether a node is this node or one of its descendants.
4913
- * @param {PseudoNode|null} otherNode The node to look for
4914
- * @returns {boolean}
4568
+ * @param otherNode The node to look for
4915
4569
  */
4916
4570
  contains (otherNode) {
4917
4571
  let current = otherNode
@@ -4937,9 +4591,9 @@
4937
4591
  /**
4938
4592
  * Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is
4939
4593
  * already in a tree is moved, and the children of a document fragment are moved in order.
4940
- * @param {PseudoNode} newNode The node to insert
4941
- * @param {PseudoNode|null} [referenceNode=null] The child of this node to insert before, or null to insert at the end
4942
- * @returns {PseudoNode} The inserted node
4594
+ * @param newNode The node to insert
4595
+ * @param referenceNode The child of this node to insert before, or null to insert at the end
4596
+ * @returns The inserted node
4943
4597
  * @throws {Error} When the reference node is not a child of this node, or the new node is this node or contains it
4944
4598
  */
4945
4599
  insertBefore (newNode, referenceNode = null) {
@@ -4985,8 +4639,7 @@
4985
4639
  /**
4986
4640
  * Whether another node is the same as this one, by what they hold: the same type, name and value (an element also
4987
4641
  * needs the same attributes), and children which are equal in the same order.
4988
- * @param {PseudoNode|null} otherNode The node to compare with
4989
- * @returns {boolean}
4642
+ * @param otherNode The node to compare with
4990
4643
  */
4991
4644
  isEqualNode (otherNode) {
4992
4645
  if (!otherNode || otherNode.nodeType !== this.nodeType || !this.equalsShallow(otherNode)) {
@@ -5039,8 +4692,8 @@
5039
4692
 
5040
4693
  /**
5041
4694
  * Remove a child from this node, it no longer has a parent or siblings afterwards.
5042
- * @param {PseudoNode} childElement The child node to remove
5043
- * @returns {PseudoNode} The removed node
4695
+ * @param childElement The child node to remove
4696
+ * @returns The removed node
5044
4697
  * @throws {Error} When the node is not a child of this node
5045
4698
  */
5046
4699
  removeChild (childElement) {
@@ -5056,9 +4709,9 @@
5056
4709
 
5057
4710
  /**
5058
4711
  * Replace a child of this node with another node (which is moved if it is already in a tree).
5059
- * @param {PseudoNode} newChild The node which takes the place
5060
- * @param {PseudoNode} oldChild The child of this node to replace
5061
- * @returns {PseudoNode} The replaced node
4712
+ * @param newChild The node which takes the place
4713
+ * @param oldChild The child of this node to replace
4714
+ * @returns The replaced node
5062
4715
  * @throws {Error} When the old node is not a child of this node
5063
4716
  */
5064
4717
  replaceChild (newChild, oldChild) {
@@ -5101,17 +4754,10 @@
5101
4754
  NodeService.nextNodeId = 1
5102
4755
  /**
5103
4756
  * Simulate the behaviour of the Text Class when there is no DOM available: the text in an element.
5104
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5105
- * @class
5106
- * @augments NodeService
5107
- * @property {string} data - The text
5108
- * @property {number} length - How many characters there are
5109
- * @property {string} wholeText - The text of this node and of the text nodes next to it
5110
4757
  */
5111
4758
  class TextService extends NodeService {
5112
4759
  /**
5113
- * @param {string} [data=''] The text
5114
- * @constructor
4760
+ * @param data The text
5115
4761
  */
5116
4762
  constructor (data = '') {
5117
4763
  super()
@@ -5130,6 +4776,7 @@
5130
4776
  return NodeService.TEXT_NODE
5131
4777
  }
5132
4778
 
4779
+ /** The text */
5133
4780
  get data () {
5134
4781
  return this.nodeValue
5135
4782
  }
@@ -5138,6 +4785,7 @@
5138
4785
  this.nodeValue = String(data)
5139
4786
  }
5140
4787
 
4788
+ /** How many characters there are */
5141
4789
  get length () {
5142
4790
  return this.data.length
5143
4791
  }
@@ -5150,6 +4798,7 @@
5150
4798
  this.data = text === null ? '' : String(text)
5151
4799
  }
5152
4800
 
4801
+ /** The text of this node and of the text nodes next to it */
5153
4802
  get wholeText () {
5154
4803
  let first = this
5155
4804
  while (first.previousSibling && first.previousSibling.nodeType === NodeService.TEXT_NODE) {
@@ -5165,8 +4814,8 @@
5165
4814
  /**
5166
4815
  * Break this text node in two at a position: this node keeps the text before it and a new node with the rest is put
5167
4816
  * after this one.
5168
- * @param {number} offset How many characters stay in this node
5169
- * @returns {TextService} The new node
4817
+ * @param offset How many characters stay in this node
4818
+ * @returns The new node
5170
4819
  * @throws {Error} When the offset is beyond the end of the text
5171
4820
  */
5172
4821
  splitText (offset) {
@@ -5191,16 +4840,10 @@
5191
4840
  exports.TextService = TextService
5192
4841
  /**
5193
4842
  * Simulate the behaviour of the Comment Class when there is no DOM available: a note in the markup which is not shown.
5194
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5195
- * @class
5196
- * @augments NodeService
5197
- * @property {string} data - The comment
5198
- * @property {number} length - How many characters there are
5199
4843
  */
5200
4844
  class CommentService extends NodeService {
5201
4845
  /**
5202
- * @param {string} [data=''] The comment
5203
- * @constructor
4846
+ * @param data The comment
5204
4847
  */
5205
4848
  constructor (data = '') {
5206
4849
  super()
@@ -5219,6 +4862,7 @@
5219
4862
  return NodeService.COMMENT_NODE
5220
4863
  }
5221
4864
 
4865
+ /** The comment */
5222
4866
  get data () {
5223
4867
  return this.nodeValue
5224
4868
  }
@@ -5227,6 +4871,7 @@
5227
4871
  this.nodeValue = String(data)
5228
4872
  }
5229
4873
 
4874
+ /** How many characters there are */
5230
4875
  get length () {
5231
4876
  return this.data.length
5232
4877
  }
@@ -5255,28 +4900,16 @@
5255
4900
  })
5256
4901
  exports.PointerEventService = void 0
5257
4902
  /**
5258
- * @file Substitute for the DOM PointerEvent Class.
5259
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5260
- * @version 1.0.0
4903
+ * Substitute for the DOM PointerEvent Class.
5261
4904
  */
5262
4905
  const MouseEventService_1 = require('./MouseEventService')
5263
4906
  /**
5264
4907
  * Simulate the behaviour of the PointerEvent Class when there is no DOM available.
5265
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5266
- * @class
5267
- * @augments MouseEventService
5268
- * @property {number} pointerId
5269
- * @property {number} width
5270
- * @property {number} height
5271
- * @property {number} pressure
5272
- * @property {string} pointerType
5273
- * @property {boolean} isPrimary
5274
4908
  */
5275
4909
  class PointerEventService extends MouseEventService_1.MouseEventService {
5276
4910
  /**
5277
- * @param {string} [typeArg=''] The type of the event
5278
- * @param {PointerEventInit} [init={}] The options for the event
5279
- * @constructor
4911
+ * @param typeArg The type of the event
4912
+ * @param init The options for the event
5280
4913
  */
5281
4914
  constructor (typeArg = '', init = {}) {
5282
4915
  super(typeArg, init)
@@ -5327,9 +4960,6 @@
5327
4960
  /**
5328
4961
  * Simulate the behaviour of the ShadowRoot Class when there is no DOM available: a DocumentFragment attached to an
5329
4962
  * element via attachShadow, which sets host and mode.
5330
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5331
- * @class
5332
- * @augments DocumentFragmentService
5333
4963
  */
5334
4964
  class ShadowRootService extends DocumentFragmentService_1.DocumentFragmentService {
5335
4965
  constructor () {
@@ -5350,25 +4980,17 @@
5350
4980
  })
5351
4981
  exports.UIEventService = void 0
5352
4982
  /**
5353
- * @file Substitute for the DOM UIEvent Class.
5354
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5355
- * @version 1.0.0
4983
+ * Substitute for the DOM UIEvent Class.
5356
4984
  */
5357
4985
  const EventService_1 = require('./EventService')
5358
4986
  /**
5359
4987
  * Simulate the behaviour of the UIEvent Class when there is no DOM available: the events which come from a user
5360
4988
  * interface (the mouse, the keyboard, focus and input).
5361
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5362
- * @class
5363
- * @augments EventService
5364
- * @property {number} detail
5365
- * @property {*} view
5366
4989
  */
5367
4990
  class UIEventService extends EventService_1.EventService {
5368
4991
  /**
5369
- * @param {string} [typeArg=''] The type of the event
5370
- * @param {UIEventInit} [init={}] The options for the event
5371
- * @constructor
4992
+ * @param typeArg The type of the event
4993
+ * @param init The options for the event
5372
4994
  */
5373
4995
  constructor (typeArg = '', init = {}) {
5374
4996
  super(typeArg, init)
@@ -5401,10 +5023,7 @@
5401
5023
  })
5402
5024
  exports.keyPress = exports.click = void 0
5403
5025
  /**
5404
- * @file Simulate what a user does, with the events the browser sends for it.
5405
- * @author Joshua Heagle <joshuaheagle@gmail.com>
5406
- * @version 1.0.0
5407
- * @module pseudoDom/simulate
5026
+ * Simulate what a user does, with the events the browser sends for it.
5408
5027
  */
5409
5028
  const createEvent_1 = __importDefault(require('./factories/createEvent'))
5410
5029
  const activeElement_1 = require('./functions/activeElement')
@@ -5414,8 +5033,7 @@
5414
5033
  }))
5415
5034
  /**
5416
5035
  * The nearest element (starting with the element itself) which can have the focus.
5417
- * @param {*} element Where to start
5418
- * @returns {*|null}
5036
+ * @param element Where to start
5419
5037
  */
5420
5038
  const focusableFrom = element => {
5421
5039
  let current = element
@@ -5431,10 +5049,9 @@
5431
5049
  * Click an element the way a user does: pointerdown and mousedown, then the focus moves to the nearest element which
5432
5050
  * can have it (or is taken away from the one which had it) unless mousedown was cancelled, then pointerup, mouseup
5433
5051
  * and finally click. Every event is trusted and has the options the browser gives it. A disabled element gets nothing.
5434
- * @function click
5435
- * @param {*} element The element to click
5436
- * @param {Object} [init={}] Options for the events (for example clientX, clientY, shiftKey)
5437
- * @returns {boolean} False when the click was cancelled (or the element is disabled), so its default action did not happen
5052
+ * @param element The element to click
5053
+ * @param init Options for the events (for example clientX, clientY, shiftKey)
5054
+ * @returns False when the click was cancelled (or the element is disabled), so its default action did not happen
5438
5055
  */
5439
5056
  const click = (element, init = {}) => {
5440
5057
  if (element.hasAttribute && element.hasAttribute('disabled')) {
@@ -5483,11 +5100,10 @@
5483
5100
  exports.click = click
5484
5101
  /**
5485
5102
  * Press and release a key on an element (the element which has the focus, or one given): keydown and then keyup.
5486
- * @function keyPress
5487
- * @param {*} element The element which gets the key
5488
- * @param {string} key The value of the key, such as a or Enter
5489
- * @param {Object} [init={}] Options for the events (for example code, shiftKey)
5490
- * @returns {boolean} False when keydown was cancelled, so its default action did not happen
5103
+ * @param element The element which gets the key
5104
+ * @param key The value of the key, such as a or Enter
5105
+ * @param init Options for the events (for example code, shiftKey)
5106
+ * @returns False when keydown was cancelled, so its default action did not happen
5491
5107
  */
5492
5108
  const keyPress = (element, key, init = {}) => {
5493
5109
  const options = Object.assign({