pseudo-dom 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +1495 -119
  2. package/browser/pseudo-dom.js +3539 -482
  3. package/browser/pseudo-dom.min.js +1 -1
  4. package/dist/classes/PseudoEventListener.d.ts +96 -96
  5. package/dist/classes/PseudoEventListener.js +151 -151
  6. package/dist/classes/PseudoHTMLDocument.d.ts +67 -67
  7. package/dist/classes/PseudoHTMLDocument.js +144 -144
  8. package/dist/classes/PseudoNodeList.d.ts +34 -34
  9. package/dist/classes/PseudoNodeList.js +71 -71
  10. package/dist/classes.d.ts +20 -20
  11. package/dist/classes.js +31 -31
  12. package/dist/factories/createEvent.d.ts +28 -28
  13. package/dist/factories/createEvent.js +56 -56
  14. package/dist/factories/cssSelectAdapter.d.ts +23 -0
  15. package/dist/factories/cssSelectAdapter.js +87 -0
  16. package/dist/factories/cssSelectAdapter.min.js +1 -0
  17. package/dist/factories/eventDefaults.d.ts +31 -31
  18. package/dist/factories/eventDefaults.js +105 -105
  19. package/dist/factories/generateDocument.d.ts +11 -11
  20. package/dist/factories/generateDocument.js +65 -65
  21. package/dist/factories/generateNode.d.ts +32 -32
  22. package/dist/factories/generateNode.js +85 -85
  23. package/dist/factories/generateNodeList.d.ts +9 -9
  24. package/dist/factories/generateNodeList.js +13 -13
  25. package/dist/factories/query.d.ts +33 -0
  26. package/dist/factories/query.js +66 -0
  27. package/dist/factories/query.min.js +1 -0
  28. package/dist/factories.d.ts +11 -11
  29. package/dist/factories.js +27 -27
  30. package/dist/functions/activeElement.d.ts +14 -14
  31. package/dist/functions/activeElement.js +33 -33
  32. package/dist/functions/getParentNodes.d.ts +11 -11
  33. package/dist/functions/getParentNodes.js +22 -22
  34. package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
  35. package/dist/functions/getParentNodesFromAttribute.js +29 -29
  36. package/dist/functions/modifierState.d.ts +29 -29
  37. package/dist/functions/modifierState.js +41 -41
  38. package/dist/functions.d.ts +5 -5
  39. package/dist/functions.js +23 -23
  40. package/dist/interfaces/PseudoAnimation.d.ts +3 -3
  41. package/dist/interfaces/PseudoAnimation.js +5 -5
  42. package/dist/interfaces/PseudoAttr.d.ts +11 -11
  43. package/dist/interfaces/PseudoAttr.js +5 -5
  44. package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
  45. package/dist/interfaces/PseudoDOMTokenList.js +5 -5
  46. package/dist/interfaces/PseudoDocument.d.ts +7 -0
  47. package/dist/interfaces/PseudoDocument.js +5 -5
  48. package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -3
  49. package/dist/interfaces/PseudoDocumentFragment.js +5 -5
  50. package/dist/interfaces/PseudoElement.d.ts +48 -24
  51. package/dist/interfaces/PseudoElement.js +5 -5
  52. package/dist/interfaces/PseudoEvent.d.ts +79 -79
  53. package/dist/interfaces/PseudoEvent.js +10 -10
  54. package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
  55. package/dist/interfaces/PseudoEventTarget.js +5 -5
  56. package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -2
  57. package/dist/interfaces/PseudoHTMLCollection.js +5 -5
  58. package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
  59. package/dist/interfaces/PseudoHTMLElement.js +5 -5
  60. package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
  61. package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
  62. package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
  63. package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
  64. package/dist/interfaces/PseudoNode.d.ts +179 -179
  65. package/dist/interfaces/PseudoNode.js +5 -5
  66. package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
  67. package/dist/interfaces/PseudoShadowRoot.js +5 -5
  68. package/dist/main.d.ts +63 -63
  69. package/dist/main.js +155 -155
  70. package/dist/services/AnimationService.d.ts +4 -4
  71. package/dist/services/AnimationService.js +16 -16
  72. package/dist/services/AttrService.d.ts +37 -37
  73. package/dist/services/AttrService.js +81 -81
  74. package/dist/services/CommentService.d.ts +1 -1
  75. package/dist/services/CommentService.js +13 -13
  76. package/dist/services/CustomEventService.d.ts +37 -37
  77. package/dist/services/CustomEventService.js +35 -35
  78. package/dist/services/DOMTokenListService.d.ts +33 -33
  79. package/dist/services/DOMTokenListService.js +117 -117
  80. package/dist/services/DocumentFragmentService.d.ts +13 -13
  81. package/dist/services/DocumentFragmentService.js +24 -24
  82. package/dist/services/DocumentService.d.ts +7 -0
  83. package/dist/services/DocumentService.js +23 -0
  84. package/dist/services/DocumentService.min.js +1 -1
  85. package/dist/services/ElementService.d.ts +77 -1
  86. package/dist/services/ElementService.js +143 -0
  87. package/dist/services/ElementService.min.js +1 -1
  88. package/dist/services/EventService.d.ts +120 -120
  89. package/dist/services/EventService.js +250 -250
  90. package/dist/services/EventTargetService.d.ts +84 -84
  91. package/dist/services/EventTargetService.js +232 -232
  92. package/dist/services/FocusEventService.d.ts +32 -32
  93. package/dist/services/FocusEventService.js +35 -35
  94. package/dist/services/HTMLCollectionService.d.ts +51 -0
  95. package/dist/services/HTMLCollectionService.js +85 -1
  96. package/dist/services/HTMLCollectionService.min.js +1 -1
  97. package/dist/services/HTMLElementService.d.ts +57 -57
  98. package/dist/services/HTMLElementService.js +163 -163
  99. package/dist/services/HTMLSlotElementService.d.ts +4 -4
  100. package/dist/services/HTMLSlotElementService.js +9 -9
  101. package/dist/services/InputEventService.d.ts +41 -41
  102. package/dist/services/InputEventService.js +47 -47
  103. package/dist/services/KeyboardEventService.d.ts +70 -70
  104. package/dist/services/KeyboardEventService.js +86 -86
  105. package/dist/services/MouseEventService.d.ts +80 -80
  106. package/dist/services/MouseEventService.js +108 -108
  107. package/dist/services/NamedNodeMapService.d.ts +23 -23
  108. package/dist/services/NamedNodeMapService.js +77 -77
  109. package/dist/services/NodeService.d.ts +75 -1
  110. package/dist/services/NodeService.js +145 -7
  111. package/dist/services/NodeService.min.js +1 -1
  112. package/dist/services/PointerEventService.d.ts +51 -51
  113. package/dist/services/PointerEventService.js +67 -67
  114. package/dist/services/ShadowRootService.d.ts +4 -4
  115. package/dist/services/ShadowRootService.js +9 -9
  116. package/dist/services/TextService.d.ts +1 -1
  117. package/dist/services/TextService.js +13 -13
  118. package/dist/services/UIEventService.d.ts +43 -43
  119. package/dist/services/UIEventService.js +42 -42
  120. package/dist/simulate.d.ts +32 -32
  121. package/dist/simulate.js +115 -115
  122. package/package.json +3 -2
@@ -470,9 +470,10 @@ export interface PseudoElement extends PseudoNode {
470
470
  */
471
471
  set ariaValueText(value: string);
472
472
  /**
473
- * Inserts a set of Node objects or strings in the children list of the Element's parent, just after the Element.
473
+ * Inserts a set of Node objects or strings in the children list of the Element's parent, just after the Element. Does
474
+ * nothing when the element has no parent.
474
475
  */
475
- after(...nodes: PseudoNode[]): void;
476
+ after(...nodes: Array<PseudoNode | string>): void;
476
477
  /**
477
478
  * A shortcut method to create and run an animation on an element. Returns the created Animation object instance.
478
479
  */
@@ -485,7 +486,7 @@ export interface PseudoElement extends PseudoNode {
485
486
  /**
486
487
  * Inserts a set of Node objects or strings after the last child of the element.
487
488
  */
488
- append(...params: PseudoNode[]): void;
489
+ append(...nodes: Array<PseudoNode | string>): void;
489
490
  /**
490
491
  * Attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.
491
492
  */
@@ -496,17 +497,20 @@ export interface PseudoElement extends PseudoNode {
496
497
  slotAssignment: string;
497
498
  }): PseudoShadowRoot;
498
499
  /**
499
- * Inserts a set of Node objects or strings in the children list of the Element's parent, just before the Element.
500
+ * Inserts a set of Node objects or strings in the children list of the Element's parent, just before the Element. Does
501
+ * nothing when the element has no parent.
500
502
  */
501
- before(...params: PseudoNode[]): void;
503
+ before(...nodes: Array<PseudoNode | string>): void;
502
504
  /**
503
505
  * Returns whether an element is expected to be visible or not based on configurable checks.
504
506
  */
505
507
  checkVisibility(): string;
506
508
  /**
507
509
  * Returns the Element which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter.
510
+ * @param {string} selectors A CSS selector
511
+ * @returns {PseudoElement|null}
508
512
  */
509
- closest(): string;
513
+ closest(selectors: string): PseudoElement | null;
510
514
  /**
511
515
  * Returns a StylePropertyMapReadOnly interface which provides a read-only representation of a CSS declaration block that is an alternative to CSSStyleDeclaration.
512
516
  */
@@ -545,14 +549,19 @@ export interface PseudoElement extends PseudoNode {
545
549
  getClientRects(): string;
546
550
  /**
547
551
  * Returns a live HTMLCollection that contains all descendants of the current element that possess the list of classes given in the parameter.
552
+ * @param {string} className One or more space separated classes
553
+ * @returns {PseudoHTMLCollection}
548
554
  */
549
- getElementsByClassName(): string;
555
+ getElementsByClassName(className: string): PseudoHTMLCollection;
550
556
  /**
551
557
  * Returns a live HTMLCollection containing all descendant elements, of a particular tag name, from the current element.
558
+ * @param {string} tagName A tag name, or * for every element
559
+ * @returns {PseudoHTMLCollection}
552
560
  */
553
- getElementsByTagName(): string;
561
+ getElementsByTagName(tagName: string): PseudoHTMLCollection;
554
562
  /**
555
- * Returns a live HTMLCollection containing all descendant elements, of a particular tag name and namespace, from the current element.
563
+ * Returns a live HTMLCollection containing all descendant elements, of a particular tag name and namespace, from
564
+ * the current element. Not implemented yet (namespaces are out of scope for now).
556
565
  */
557
566
  getElementsByTagNameNS(): string;
558
567
  /**
@@ -572,41 +581,55 @@ export interface PseudoElement extends PseudoNode {
572
581
  */
573
582
  hasPointerCapture(): string;
574
583
  /**
575
- * Inserts a given element node at a given position relative to the element it is invoked upon.
584
+ * Inserts a given element at a given position relative to the element it is invoked upon.
585
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
586
+ * @param {PseudoElement} element The element to insert
587
+ * @returns {PseudoElement|null} The inserted element, or null when the position needs a parent this element does not have
576
588
  */
577
- insertAdjacentElement(): string;
589
+ insertAdjacentElement(position: string, element: PseudoElement): PseudoElement | null;
578
590
  /**
579
- * Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given.
591
+ * Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given. Not implemented
592
+ * yet (HTML parsing is out of scope for now).
593
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
594
+ * @param {string} text The markup to parse
580
595
  */
581
- insertAdjacentHTML(): string;
596
+ insertAdjacentHTML(position: string, text: string): void;
582
597
  /**
583
- * Inserts a given text node at a given position relative to the element it is invoked upon.
598
+ * Inserts a given text at a given position relative to the element it is invoked upon.
599
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
600
+ * @param {string} text The text to insert
584
601
  */
585
- insertAdjacentText(): string;
602
+ insertAdjacentText(position: string, text: string): void;
586
603
  /**
587
604
  * Returns a boolean value indicating whether or not the element would be selected by the specified selector string.
605
+ * @param {string} selectors A CSS selector
606
+ * @returns {boolean}
588
607
  */
589
- matches(): string;
608
+ matches(selectors: string): boolean;
590
609
  /**
591
610
  * Inserts a set of Node objects or strings before the first child of the element.
592
611
  */
593
- prepend(): string;
612
+ prepend(...nodes: Array<PseudoNode | string>): void;
594
613
  /**
595
614
  * Returns the first Node which matches the specified selector string relative to the element.
615
+ * @param {string} selectors A CSS selector
616
+ * @returns {PseudoElement|null}
596
617
  */
597
- querySelector(): string;
618
+ querySelector(selectors: string): PseudoElement | null;
598
619
  /**
599
620
  * Returns a NodeList of nodes which match the specified selector string relative to the element.
621
+ * @param {string} selectors A CSS selector
622
+ * @returns {Array<PseudoElement>}
600
623
  */
601
- querySelectorAll(): string;
624
+ querySelectorAll(selectors: string): Array<PseudoElement>;
602
625
  /**
603
626
  * Releases (stops) pointer capture that was previously set for a specific pointer event.
604
627
  */
605
628
  releasePointerCapture(): string;
606
629
  /**
607
- * Removes the element from the children list of its parent.
630
+ * Removes the element from the children list of its parent. Does nothing when it has no parent.
608
631
  */
609
- remove(): string;
632
+ remove(): void;
610
633
  /**
611
634
  * Removes the named attribute from the current node.
612
635
  */
@@ -622,11 +645,12 @@ export interface PseudoElement extends PseudoNode {
622
645
  /**
623
646
  * Replaces the existing children of a Node with a specified new set of children.
624
647
  */
625
- replaceChildren(): string;
648
+ replaceChildren(...nodes: Array<PseudoNode | string>): void;
626
649
  /**
627
- * Replaces the element in the children list of its parent with a set of Node objects or strings.
650
+ * Replaces the element in the children list of its parent with a set of Node objects or strings. Does nothing when it
651
+ * has no parent.
628
652
  */
629
- replaceWith(): string;
653
+ replaceWith(...nodes: Array<PseudoNode | string>): void;
630
654
  /**
631
655
  * Asynchronously asks the browser to make the element fullscreen.
632
656
  */
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -1,79 +1,79 @@
1
- /**
2
- * @file Substitute for the DOM Event Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { PseudoEventTarget } from './PseudoEventTarget';
7
- /**
8
- * Simulate the behaviour of the Event Class when there is no DOM available.
9
- * @author Joshua Heagle <joshuaheagle@gmail.com>
10
- * @class
11
- * @property {number} NONE
12
- * @property {number} CAPTURING_PHASE
13
- * @property {number} AT_TARGET
14
- * @property {number} BUBBLING_PHASE
15
- * @property {boolean} bubbles - A Boolean indicating whether the event bubbles up through the Dom or not.
16
- * @property {boolean} cancelable - A Boolean indicating whether the event is cancelable.
17
- * @property {boolean} composed - A Boolean value indicating whether the event can bubble across the boundary
18
- * between the shadow Dom and the regular Dom.
19
- * @property {function|PseudoEventTarget} currentTarget - A reference to the currently registered target for the event. This
20
- * is the object to which the event is currently slated to be sent; it's possible this has been changed along the way
21
- * through re-targeting.
22
- * @property {boolean} defaultPrevented - Indicates whether event.preventDefault() has been called on the event.
23
- * @property {int} eventPhase - Indicates which phase of the event flow is being processed. Uses PseudoEvent constants.
24
- * @property {EventTarget|PseudoEventTarget} target - A reference to the target to which the event was originally
25
- * dispatched.
26
- * @property {int} timeStamp - The time at which the event was created (in milliseconds). By specification, this
27
- * value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this
28
- * to be a DomHighResTimeStamp instead.
29
- * @property {string} type - The name of the event (case-insensitive).
30
- * @property {boolean} isTrusted - Indicates whether the event was initiated by the browser (after a user
31
- * click for instance) or by a script (using an event creation method, like event.initEvent)
32
- */
33
- export interface PseudoEvent {
34
- /**
35
- *
36
- * @param {string} type
37
- * @param {Object} [eventOptions={}]
38
- * @param {boolean} [eventOptions.bubbles=true]
39
- * @param {boolean} [eventOptions.cancelable=true]
40
- * @param {boolean} [eventOptions.composed=true]
41
- * @constructor
42
- */
43
- get bubbles(): boolean;
44
- get cancelable(): boolean;
45
- get composed(): boolean;
46
- get currentTarget(): PseudoEventTarget;
47
- get defaultPrevented(): boolean;
48
- get eventPhase(): number;
49
- get isTrusted(): boolean;
50
- get target(): PseudoEventTarget;
51
- get timeStamp(): number;
52
- get type(): string;
53
- /**
54
- * Return an array of targets that will have the event executed open them. The order is based on the eventPhase
55
- * @method
56
- * @returns {Array.<PseudoEventTarget>}
57
- */
58
- composedPath(): Array<PseudoEventTarget>;
59
- /**
60
- * Cancels the event (if it is cancelable).
61
- * @method
62
- * @returns {null}
63
- */
64
- preventDefault(): null;
65
- /**
66
- * For this particular event, no other listener will be called.
67
- * Neither those attached on the same element, nor those attached on elements which will be traversed later (in
68
- * capture phase, for instance)
69
- * @method
70
- * @returns {null}
71
- */
72
- stopImmediatePropagation(): null;
73
- /**
74
- * Stops the propagation of events further along in the Dom.
75
- * @method
76
- * @returns {null}
77
- */
78
- stopPropagation(): null;
79
- }
1
+ /**
2
+ * @file Substitute for the DOM Event Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { PseudoEventTarget } from './PseudoEventTarget';
7
+ /**
8
+ * Simulate the behaviour of the Event Class when there is no DOM available.
9
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
10
+ * @class
11
+ * @property {number} NONE
12
+ * @property {number} CAPTURING_PHASE
13
+ * @property {number} AT_TARGET
14
+ * @property {number} BUBBLING_PHASE
15
+ * @property {boolean} bubbles - A Boolean indicating whether the event bubbles up through the Dom or not.
16
+ * @property {boolean} cancelable - A Boolean indicating whether the event is cancelable.
17
+ * @property {boolean} composed - A Boolean value indicating whether the event can bubble across the boundary
18
+ * between the shadow Dom and the regular Dom.
19
+ * @property {function|PseudoEventTarget} currentTarget - A reference to the currently registered target for the event. This
20
+ * is the object to which the event is currently slated to be sent; it's possible this has been changed along the way
21
+ * through re-targeting.
22
+ * @property {boolean} defaultPrevented - Indicates whether event.preventDefault() has been called on the event.
23
+ * @property {int} eventPhase - Indicates which phase of the event flow is being processed. Uses PseudoEvent constants.
24
+ * @property {EventTarget|PseudoEventTarget} target - A reference to the target to which the event was originally
25
+ * dispatched.
26
+ * @property {int} timeStamp - The time at which the event was created (in milliseconds). By specification, this
27
+ * value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this
28
+ * to be a DomHighResTimeStamp instead.
29
+ * @property {string} type - The name of the event (case-insensitive).
30
+ * @property {boolean} isTrusted - Indicates whether the event was initiated by the browser (after a user
31
+ * click for instance) or by a script (using an event creation method, like event.initEvent)
32
+ */
33
+ export interface PseudoEvent {
34
+ /**
35
+ *
36
+ * @param {string} type
37
+ * @param {Object} [eventOptions={}]
38
+ * @param {boolean} [eventOptions.bubbles=true]
39
+ * @param {boolean} [eventOptions.cancelable=true]
40
+ * @param {boolean} [eventOptions.composed=true]
41
+ * @constructor
42
+ */
43
+ get bubbles(): boolean;
44
+ get cancelable(): boolean;
45
+ get composed(): boolean;
46
+ get currentTarget(): PseudoEventTarget;
47
+ get defaultPrevented(): boolean;
48
+ get eventPhase(): number;
49
+ get isTrusted(): boolean;
50
+ get target(): PseudoEventTarget;
51
+ get timeStamp(): number;
52
+ get type(): string;
53
+ /**
54
+ * Return an array of targets that will have the event executed open them. The order is based on the eventPhase
55
+ * @method
56
+ * @returns {Array.<PseudoEventTarget>}
57
+ */
58
+ composedPath(): Array<PseudoEventTarget>;
59
+ /**
60
+ * Cancels the event (if it is cancelable).
61
+ * @method
62
+ * @returns {null}
63
+ */
64
+ preventDefault(): null;
65
+ /**
66
+ * For this particular event, no other listener will be called.
67
+ * Neither those attached on the same element, nor those attached on elements which will be traversed later (in
68
+ * capture phase, for instance)
69
+ * @method
70
+ * @returns {null}
71
+ */
72
+ stopImmediatePropagation(): null;
73
+ /**
74
+ * Stops the propagation of events further along in the Dom.
75
+ * @method
76
+ * @returns {null}
77
+ */
78
+ stopPropagation(): null;
79
+ }
@@ -1,10 +1,10 @@
1
- 'use strict'
2
-
3
- /**
4
- * @file Substitute for the DOM Event Class.
5
- * @author Joshua Heagle <joshuaheagle@gmail.com>
6
- * @version 1.0.0
7
- */
8
- Object.defineProperty(exports, '__esModule', {
9
- value: true
10
- })
1
+ 'use strict'
2
+
3
+ /**
4
+ * @file Substitute for the DOM Event Class.
5
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
6
+ * @version 1.0.0
7
+ */
8
+ Object.defineProperty(exports, '__esModule', {
9
+ value: true
10
+ })
@@ -1,46 +1,46 @@
1
- /**
2
- * @file Substitute for the DOM EventTarget Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { PseudoEvent } from './PseudoEvent';
7
- export type listenerOptions = {
8
- capture: boolean;
9
- once: boolean;
10
- passive: boolean;
11
- };
12
- /**
13
- * Simulate the behaviour of the EventTarget Class when there is no DOM available.
14
- * @author Joshua Heagle <joshuaheagle@gmail.com>
15
- * @interface
16
- * @property {function} addEventListener
17
- * @property {function} removeEventListener
18
- * @property {function} dispatchEvent
19
- */
20
- export interface PseudoEventTarget {
21
- /**
22
- * Creates a new EventTarget object instance.
23
- */
24
- /**
25
- * Registers an event handler of a specific event type on the EventTarget.
26
- * @param {string} type
27
- * @param {function|Object} callback
28
- * @param {boolean|Object} [useCapture=false]
29
- */
30
- addEventListener(type: string, callback: Function | {
31
- handleEvent: Function;
32
- } | any, useCapture: listenerOptions | boolean): void;
33
- /**
34
- * Removes an event listener from the EventTarget.
35
- * @param {string} type
36
- * @param {function} callback
37
- */
38
- removeEventListener(type: string, callback: Function, options?: listenerOptions | boolean): void;
39
- /**
40
- * Dispatches an event to this EventTarget.
41
- * @param {Event|PseudoEvent} event
42
- * @param {EventTarget|PseudoEventTarget} target
43
- * @returns {boolean}
44
- */
45
- dispatchEvent(event: PseudoEvent): boolean;
46
- }
1
+ /**
2
+ * @file Substitute for the DOM EventTarget Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { PseudoEvent } from './PseudoEvent';
7
+ export type listenerOptions = {
8
+ capture: boolean;
9
+ once: boolean;
10
+ passive: boolean;
11
+ };
12
+ /**
13
+ * Simulate the behaviour of the EventTarget Class when there is no DOM available.
14
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
15
+ * @interface
16
+ * @property {function} addEventListener
17
+ * @property {function} removeEventListener
18
+ * @property {function} dispatchEvent
19
+ */
20
+ export interface PseudoEventTarget {
21
+ /**
22
+ * Creates a new EventTarget object instance.
23
+ */
24
+ /**
25
+ * Registers an event handler of a specific event type on the EventTarget.
26
+ * @param {string} type
27
+ * @param {function|Object} callback
28
+ * @param {boolean|Object} [useCapture=false]
29
+ */
30
+ addEventListener(type: string, callback: Function | {
31
+ handleEvent: Function;
32
+ } | any, useCapture: listenerOptions | boolean): void;
33
+ /**
34
+ * Removes an event listener from the EventTarget.
35
+ * @param {string} type
36
+ * @param {function} callback
37
+ */
38
+ removeEventListener(type: string, callback: Function, options?: listenerOptions | boolean): void;
39
+ /**
40
+ * Dispatches an event to this EventTarget.
41
+ * @param {Event|PseudoEvent} event
42
+ * @param {EventTarget|PseudoEventTarget} target
43
+ * @returns {boolean}
44
+ */
45
+ dispatchEvent(event: PseudoEvent): boolean;
46
+ }
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -1,2 +1,23 @@
1
- export interface PseudoHTMLCollection {
2
- }
1
+ import { PseudoElement } from './PseudoElement';
2
+ /**
3
+ * A live collection of an element's (or a document's / document fragment's) element children: it is not a snapshot,
4
+ * reading it after the tree changes reflects the change.
5
+ */
6
+ export interface PseudoHTMLCollection extends Iterable<PseudoElement> {
7
+ /**
8
+ * How many elements are in the collection.
9
+ */
10
+ get length(): number;
11
+ /**
12
+ * The element at the given index, or null when there is none.
13
+ * @param {number} index
14
+ * @returns {PseudoElement|null}
15
+ */
16
+ item(index: number): PseudoElement | null;
17
+ /**
18
+ * The element whose id, or whose name attribute, is the given value, or null when there is none.
19
+ * @param {string} name
20
+ * @returns {PseudoElement|null}
21
+ */
22
+ namedItem(name: string): PseudoElement | null;
23
+ }
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -1,22 +1,22 @@
1
- /**
2
- * @file Substitute for the DOM HTMLElement Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { PseudoElement } from './PseudoElement';
7
- /**
8
- * Simulate the behaviour of the HTMLElement Class when there is no DOM available.
9
- * @author Joshua Heagle <joshuaheagle@gmail.com>
10
- * @class
11
- * @augments PseudoElement
12
- * @property {boolean} hidden - State of whether element is visible
13
- * @property {number} offsetHeight - The height of the element as offset by the parent element
14
- * @property {number} offsetLeft - The position of the left side of the element based on the parent element
15
- * @property {PseudoHTMLElement} offsetParent - A reference to the closest positioned parent element
16
- * @property {number} offsetTop - The position of the top side of the element based on the parent element
17
- * @property {number} offsetWidth - The width of the element as offset by the parent element
18
- * @property {Object} style - A container to define all applied inline-styles
19
- * @property {string} title - The title attribute which affects the text visible on hover
20
- */
21
- export interface PseudoHTMLElement extends PseudoElement {
22
- }
1
+ /**
2
+ * @file Substitute for the DOM HTMLElement Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { PseudoElement } from './PseudoElement';
7
+ /**
8
+ * Simulate the behaviour of the HTMLElement Class when there is no DOM available.
9
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
10
+ * @class
11
+ * @augments PseudoElement
12
+ * @property {boolean} hidden - State of whether element is visible
13
+ * @property {number} offsetHeight - The height of the element as offset by the parent element
14
+ * @property {number} offsetLeft - The position of the left side of the element based on the parent element
15
+ * @property {PseudoHTMLElement} offsetParent - A reference to the closest positioned parent element
16
+ * @property {number} offsetTop - The position of the top side of the element based on the parent element
17
+ * @property {number} offsetWidth - The width of the element as offset by the parent element
18
+ * @property {Object} style - A container to define all applied inline-styles
19
+ * @property {string} title - The title attribute which affects the text visible on hover
20
+ */
21
+ export interface PseudoHTMLElement extends PseudoElement {
22
+ }
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -1,3 +1,3 @@
1
- import { PseudoHTMLElement } from './PseudoHTMLElement';
2
- export interface PseudoHTMLSlotElement extends PseudoHTMLElement {
3
- }
1
+ import { PseudoHTMLElement } from './PseudoHTMLElement';
2
+ export interface PseudoHTMLSlotElement extends PseudoHTMLElement {
3
+ }
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })
@@ -1,11 +1,11 @@
1
- import { PseudoAttr } from './PseudoAttr';
2
- export interface PseudoNamedNodeMap {
3
- get length(): number;
4
- getNamedItem(name: string): PseudoAttr | null;
5
- setNamedItem(attr: PseudoAttr): PseudoAttr | null;
6
- removeNamedItem(attrName: string): PseudoAttr;
7
- item(index: number): PseudoAttr | null;
8
- getNamedItemNS(namespace: string, localName: string): PseudoAttr | null;
9
- setNamedItemNS(attr: PseudoAttr): PseudoAttr | null;
10
- removeNamedItemNS(namespace: string, localName: string): PseudoAttr;
11
- }
1
+ import { PseudoAttr } from './PseudoAttr';
2
+ export interface PseudoNamedNodeMap {
3
+ get length(): number;
4
+ getNamedItem(name: string): PseudoAttr | null;
5
+ setNamedItem(attr: PseudoAttr): PseudoAttr | null;
6
+ removeNamedItem(attrName: string): PseudoAttr;
7
+ item(index: number): PseudoAttr | null;
8
+ getNamedItemNS(namespace: string, localName: string): PseudoAttr | null;
9
+ setNamedItemNS(attr: PseudoAttr): PseudoAttr | null;
10
+ removeNamedItemNS(namespace: string, localName: string): PseudoAttr;
11
+ }
@@ -1,5 +1,5 @@
1
- 'use strict'
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- })
1
+ 'use strict'
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ })