happy-dom 7.3.0 → 7.5.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.

Potentially problematic release.


This version of happy-dom might be problematic. Click here for more details.

Files changed (114) hide show
  1. package/lib/css/declaration/AbstractCSSStyleDeclaration.js +9 -0
  2. package/lib/css/declaration/AbstractCSSStyleDeclaration.js.map +1 -1
  3. package/lib/css/declaration/utilities/CSSStyleDeclarationElementStyle.d.ts +0 -2
  4. package/lib/css/declaration/utilities/CSSStyleDeclarationElementStyle.js +54 -25
  5. package/lib/css/declaration/utilities/CSSStyleDeclarationElementStyle.js.map +1 -1
  6. package/lib/event/EventTarget.d.ts +14 -1
  7. package/lib/event/EventTarget.js +16 -1
  8. package/lib/event/EventTarget.js.map +1 -1
  9. package/lib/event/IEventTarget.d.ts +20 -0
  10. package/lib/event/NonImplementedEventTypes.js +2 -1
  11. package/lib/event/NonImplementedEventTypes.js.map +1 -1
  12. package/lib/fetch/IRequestInit.d.ts +1 -0
  13. package/lib/form-data/IFormData.d.ts +2 -0
  14. package/lib/nodes/character-data/CharacterData.js +3 -0
  15. package/lib/nodes/character-data/CharacterData.js.map +1 -1
  16. package/lib/nodes/document/Document.d.ts +110 -1
  17. package/lib/nodes/document/Document.js +112 -1
  18. package/lib/nodes/document/Document.js.map +1 -1
  19. package/lib/nodes/document/IDocument.d.ts +109 -1
  20. package/lib/nodes/element/Element.d.ts +35 -0
  21. package/lib/nodes/element/Element.js +42 -7
  22. package/lib/nodes/element/Element.js.map +1 -1
  23. package/lib/nodes/element/IElement.d.ts +35 -0
  24. package/lib/nodes/html-dialog-element/HTMLDialogElement.d.ts +3 -0
  25. package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -0
  26. package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
  27. package/lib/nodes/html-dialog-element/IHTMLDialogElement.d.ts +3 -0
  28. package/lib/nodes/html-element/HTMLElement.d.ts +26 -0
  29. package/lib/nodes/html-element/HTMLElement.js +26 -0
  30. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  31. package/lib/nodes/html-element/IHTMLElement.d.ts +26 -0
  32. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +4 -0
  33. package/lib/nodes/html-form-element/HTMLFormElement.js +7 -0
  34. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  35. package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +4 -0
  36. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +4 -0
  37. package/lib/nodes/html-input-element/HTMLInputElement.js +4 -0
  38. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  39. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +4 -0
  40. package/lib/nodes/html-media-element/HTMLMediaElement.d.ts +23 -8
  41. package/lib/nodes/html-media-element/HTMLMediaElement.js +15 -0
  42. package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
  43. package/lib/nodes/html-media-element/IHTMLMediaElement.d.ts +24 -0
  44. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +3 -0
  45. package/lib/nodes/html-select-element/HTMLSelectElement.js +3 -0
  46. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  47. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +3 -0
  48. package/lib/nodes/html-slot-element/HTMLSlotElement.d.ts +2 -0
  49. package/lib/nodes/html-slot-element/HTMLSlotElement.js +5 -0
  50. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  51. package/lib/nodes/html-slot-element/IHTMLSlotElement.d.ts +2 -0
  52. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +4 -1
  53. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +4 -1
  54. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  55. package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +3 -0
  56. package/lib/nodes/node/Node.js +9 -0
  57. package/lib/nodes/node/Node.js.map +1 -1
  58. package/lib/nodes/shadow-root/IShadowRoot.d.ts +2 -0
  59. package/lib/nodes/shadow-root/ShadowRoot.d.ts +2 -0
  60. package/lib/nodes/shadow-root/ShadowRoot.js +2 -0
  61. package/lib/nodes/shadow-root/ShadowRoot.js.map +1 -1
  62. package/lib/nodes/svg-element/ISVGElement.d.ts +7 -0
  63. package/lib/nodes/svg-element/ISVGSVGElement.d.ts +19 -0
  64. package/lib/nodes/svg-element/SVGElement.d.ts +7 -0
  65. package/lib/nodes/svg-element/SVGElement.js +7 -0
  66. package/lib/nodes/svg-element/SVGElement.js.map +1 -1
  67. package/lib/nodes/svg-element/SVGSVGElement.d.ts +19 -0
  68. package/lib/nodes/svg-element/SVGSVGElement.js +22 -0
  69. package/lib/nodes/svg-element/SVGSVGElement.js.map +1 -1
  70. package/lib/query-selector/QuerySelector.d.ts +21 -0
  71. package/lib/query-selector/QuerySelector.js +45 -4
  72. package/lib/query-selector/QuerySelector.js.map +1 -1
  73. package/lib/query-selector/SelectorItem.d.ts +14 -11
  74. package/lib/query-selector/SelectorItem.js +35 -19
  75. package/lib/query-selector/SelectorItem.js.map +1 -1
  76. package/lib/window/GlobalWindow.d.ts +2 -0
  77. package/lib/window/IWindow.d.ts +4 -0
  78. package/lib/window/Window.d.ts +3 -0
  79. package/package.json +2 -2
  80. package/src/css/declaration/AbstractCSSStyleDeclaration.ts +12 -0
  81. package/src/css/declaration/utilities/CSSStyleDeclarationElementStyle.ts +86 -36
  82. package/src/event/EventTarget.ts +17 -1
  83. package/src/event/IEventTarget.ts +22 -0
  84. package/src/event/NonImplementedEventTypes.ts +2 -1
  85. package/src/nodes/character-data/CharacterData.ts +4 -0
  86. package/src/nodes/document/Document.ts +115 -1
  87. package/src/nodes/document/IDocument.ts +111 -1
  88. package/src/nodes/element/Element.ts +46 -7
  89. package/src/nodes/element/IElement.ts +37 -0
  90. package/src/nodes/html-dialog-element/HTMLDialogElement.ts +4 -0
  91. package/src/nodes/html-dialog-element/IHTMLDialogElement.ts +5 -0
  92. package/src/nodes/html-element/HTMLElement.ts +28 -0
  93. package/src/nodes/html-element/IHTMLElement.ts +28 -0
  94. package/src/nodes/html-form-element/HTMLFormElement.ts +6 -0
  95. package/src/nodes/html-form-element/IHTMLFormElement.ts +6 -0
  96. package/src/nodes/html-input-element/HTMLInputElement.ts +5 -0
  97. package/src/nodes/html-input-element/IHTMLInputElement.ts +6 -0
  98. package/src/nodes/html-media-element/HTMLMediaElement.ts +23 -8
  99. package/src/nodes/html-media-element/IHTMLMediaElement.ts +26 -0
  100. package/src/nodes/html-select-element/HTMLSelectElement.ts +5 -0
  101. package/src/nodes/html-select-element/IHTMLSelectElement.ts +5 -0
  102. package/src/nodes/html-slot-element/HTMLSlotElement.ts +4 -0
  103. package/src/nodes/html-slot-element/IHTMLSlotElement.ts +4 -0
  104. package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +6 -1
  105. package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +5 -0
  106. package/src/nodes/node/Node.ts +12 -0
  107. package/src/nodes/shadow-root/IShadowRoot.ts +4 -0
  108. package/src/nodes/shadow-root/ShadowRoot.ts +4 -0
  109. package/src/nodes/svg-element/ISVGElement.ts +9 -0
  110. package/src/nodes/svg-element/ISVGSVGElement.ts +21 -0
  111. package/src/nodes/svg-element/SVGElement.ts +9 -0
  112. package/src/nodes/svg-element/SVGSVGElement.ts +21 -0
  113. package/src/query-selector/QuerySelector.ts +66 -5
  114. package/src/query-selector/SelectorItem.ts +66 -37
@@ -51,7 +51,6 @@ const PROCESSING_INSTRUCTION_TARGET_REGEXP = /^[a-z][a-z0-9-]+$/;
51
51
  */
52
52
  export default class Document extends Node implements IDocument {
53
53
  public static _defaultView: IWindow = null;
54
- public onreadystatechange: (event: Event) => void = null;
55
54
  public nodeType = Node.DOCUMENT_NODE;
56
55
  public adoptedStyleSheets: CSSStyleSheet[] = [];
57
56
  public implementation: DOMImplementation;
@@ -61,11 +60,126 @@ export default class Document extends Node implements IDocument {
61
60
  public readonly defaultView: IWindow;
62
61
  public readonly _readyStateManager: DocumentReadyStateManager;
63
62
  public _activeElement: IHTMLElement = null;
63
+
64
+ // Used as an unique identifier which is updated whenever the DOM gets modified.
65
+ public _cacheID = 0;
66
+
64
67
  protected _isFirstWrite = true;
65
68
  protected _isFirstWriteAfterOpen = false;
66
69
  private _cookie = '';
67
70
  private _selection: Selection = null;
68
71
 
72
+ // Events
73
+ public onreadystatechange: (event: Event) => void = null;
74
+ public onpointerlockchange: (event: Event) => void = null;
75
+ public onpointerlockerror: (event: Event) => void = null;
76
+ public onbeforecopy: (event: Event) => void = null;
77
+ public onbeforecut: (event: Event) => void = null;
78
+ public onbeforepaste: (event: Event) => void = null;
79
+ public onfreeze: (event: Event) => void = null;
80
+ public onresume: (event: Event) => void = null;
81
+ public onsearch: (event: Event) => void = null;
82
+ public onvisibilitychange: (event: Event) => void = null;
83
+ public onfullscreenchange: (event: Event) => void = null;
84
+ public onfullscreenerror: (event: Event) => void = null;
85
+ public onwebkitfullscreenchange: (event: Event) => void = null;
86
+ public onwebkitfullscreenerror: (event: Event) => void = null;
87
+ public onbeforexrselect: (event: Event) => void = null;
88
+ public onabort: (event: Event) => void = null;
89
+ public onbeforeinput: (event: Event) => void = null;
90
+ public onblur: (event: Event) => void = null;
91
+ public oncancel: (event: Event) => void = null;
92
+ public oncanplay: (event: Event) => void = null;
93
+ public oncanplaythrough: (event: Event) => void = null;
94
+ public onchange: (event: Event) => void = null;
95
+ public onclick: (event: Event) => void = null;
96
+ public onclose: (event: Event) => void = null;
97
+ public oncontextlost: (event: Event) => void = null;
98
+ public oncontextmenu: (event: Event) => void = null;
99
+ public oncontextrestored: (event: Event) => void = null;
100
+ public oncuechange: (event: Event) => void = null;
101
+ public ondblclick: (event: Event) => void = null;
102
+ public ondrag: (event: Event) => void = null;
103
+ public ondragend: (event: Event) => void = null;
104
+ public ondragenter: (event: Event) => void = null;
105
+ public ondragleave: (event: Event) => void = null;
106
+ public ondragover: (event: Event) => void = null;
107
+ public ondragstart: (event: Event) => void = null;
108
+ public ondrop: (event: Event) => void = null;
109
+ public ondurationchange: (event: Event) => void = null;
110
+ public onemptied: (event: Event) => void = null;
111
+ public onended: (event: Event) => void = null;
112
+ public onerror: (event: Event) => void = null;
113
+ public onfocus: (event: Event) => void = null;
114
+ public onformdata: (event: Event) => void = null;
115
+ public oninput: (event: Event) => void = null;
116
+ public oninvalid: (event: Event) => void = null;
117
+ public onkeydown: (event: Event) => void = null;
118
+ public onkeypress: (event: Event) => void = null;
119
+ public onkeyup: (event: Event) => void = null;
120
+ public onload: (event: Event) => void = null;
121
+ public onloadeddata: (event: Event) => void = null;
122
+ public onloadedmetadata: (event: Event) => void = null;
123
+ public onloadstart: (event: Event) => void = null;
124
+ public onmousedown: (event: Event) => void = null;
125
+ public onmouseenter: (event: Event) => void = null;
126
+ public onmouseleave: (event: Event) => void = null;
127
+ public onmousemove: (event: Event) => void = null;
128
+ public onmouseout: (event: Event) => void = null;
129
+ public onmouseover: (event: Event) => void = null;
130
+ public onmouseup: (event: Event) => void = null;
131
+ public onmousewheel: (event: Event) => void = null;
132
+ public onpause: (event: Event) => void = null;
133
+ public onplay: (event: Event) => void = null;
134
+ public onplaying: (event: Event) => void = null;
135
+ public onprogress: (event: Event) => void = null;
136
+ public onratechange: (event: Event) => void = null;
137
+ public onreset: (event: Event) => void = null;
138
+ public onresize: (event: Event) => void = null;
139
+ public onscroll: (event: Event) => void = null;
140
+ public onsecuritypolicyviolation: (event: Event) => void = null;
141
+ public onseeked: (event: Event) => void = null;
142
+ public onseeking: (event: Event) => void = null;
143
+ public onselect: (event: Event) => void = null;
144
+ public onslotchange: (event: Event) => void = null;
145
+ public onstalled: (event: Event) => void = null;
146
+ public onsubmit: (event: Event) => void = null;
147
+ public onsuspend: (event: Event) => void = null;
148
+ public ontimeupdate: (event: Event) => void = null;
149
+ public ontoggle: (event: Event) => void = null;
150
+ public onvolumechange: (event: Event) => void = null;
151
+ public onwaiting: (event: Event) => void = null;
152
+ public onwebkitanimationend: (event: Event) => void = null;
153
+ public onwebkitanimationiteration: (event: Event) => void = null;
154
+ public onwebkitanimationstart: (event: Event) => void = null;
155
+ public onwebkittransitionend: (event: Event) => void = null;
156
+ public onwheel: (event: Event) => void = null;
157
+ public onauxclick: (event: Event) => void = null;
158
+ public ongotpointercapture: (event: Event) => void = null;
159
+ public onlostpointercapture: (event: Event) => void = null;
160
+ public onpointerdown: (event: Event) => void = null;
161
+ public onpointermove: (event: Event) => void = null;
162
+ public onpointerrawupdate: (event: Event) => void = null;
163
+ public onpointerup: (event: Event) => void = null;
164
+ public onpointercancel: (event: Event) => void = null;
165
+ public onpointerover: (event: Event) => void = null;
166
+ public onpointerout: (event: Event) => void = null;
167
+ public onpointerenter: (event: Event) => void = null;
168
+ public onpointerleave: (event: Event) => void = null;
169
+ public onselectstart: (event: Event) => void = null;
170
+ public onselectionchange: (event: Event) => void = null;
171
+ public onanimationend: (event: Event) => void = null;
172
+ public onanimationiteration: (event: Event) => void = null;
173
+ public onanimationstart: (event: Event) => void = null;
174
+ public ontransitionrun: (event: Event) => void = null;
175
+ public ontransitionstart: (event: Event) => void = null;
176
+ public ontransitionend: (event: Event) => void = null;
177
+ public ontransitioncancel: (event: Event) => void = null;
178
+ public oncopy: (event: Event) => void = null;
179
+ public oncut: (event: Event) => void = null;
180
+ public onpaste: (event: Event) => void = null;
181
+ public onbeforematch: (event: Event) => void = null;
182
+
69
183
  /**
70
184
  * Creates an instance of Document.
71
185
  *
@@ -25,7 +25,6 @@ import IProcessingInstruction from '../processing-instruction/IProcessingInstruc
25
25
  * Document.
26
26
  */
27
27
  export default interface IDocument extends IParentNode {
28
- onreadystatechange: (event: Event) => void;
29
28
  readonly defaultView: IWindow;
30
29
  readonly implementation: DOMImplementation;
31
30
  readonly documentElement: IHTMLElement;
@@ -42,6 +41,117 @@ export default interface IDocument extends IParentNode {
42
41
  readonly characterSet: string;
43
42
  cookie: string;
44
43
 
44
+ // Events
45
+ onreadystatechange: (event: Event) => void;
46
+ onpointerlockchange: (event: Event) => void;
47
+ onpointerlockerror: (event: Event) => void;
48
+ onbeforecopy: (event: Event) => void;
49
+ onbeforecut: (event: Event) => void;
50
+ onbeforepaste: (event: Event) => void;
51
+ onfreeze: (event: Event) => void;
52
+ onresume: (event: Event) => void;
53
+ onsearch: (event: Event) => void;
54
+ onvisibilitychange: (event: Event) => void;
55
+ onfullscreenchange: (event: Event) => void;
56
+ onfullscreenerror: (event: Event) => void;
57
+ onwebkitfullscreenchange: (event: Event) => void;
58
+ onwebkitfullscreenerror: (event: Event) => void;
59
+ onbeforexrselect: (event: Event) => void;
60
+ onabort: (event: Event) => void;
61
+ onbeforeinput: (event: Event) => void;
62
+ onblur: (event: Event) => void;
63
+ oncancel: (event: Event) => void;
64
+ oncanplay: (event: Event) => void;
65
+ oncanplaythrough: (event: Event) => void;
66
+ onchange: (event: Event) => void;
67
+ onclick: (event: Event) => void;
68
+ onclose: (event: Event) => void;
69
+ oncontextlost: (event: Event) => void;
70
+ oncontextmenu: (event: Event) => void;
71
+ oncontextrestored: (event: Event) => void;
72
+ oncuechange: (event: Event) => void;
73
+ ondblclick: (event: Event) => void;
74
+ ondrag: (event: Event) => void;
75
+ ondragend: (event: Event) => void;
76
+ ondragenter: (event: Event) => void;
77
+ ondragleave: (event: Event) => void;
78
+ ondragover: (event: Event) => void;
79
+ ondragstart: (event: Event) => void;
80
+ ondrop: (event: Event) => void;
81
+ ondurationchange: (event: Event) => void;
82
+ onemptied: (event: Event) => void;
83
+ onended: (event: Event) => void;
84
+ onerror: (event: Event) => void;
85
+ onfocus: (event: Event) => void;
86
+ onformdata: (event: Event) => void;
87
+ oninput: (event: Event) => void;
88
+ oninvalid: (event: Event) => void;
89
+ onkeydown: (event: Event) => void;
90
+ onkeypress: (event: Event) => void;
91
+ onkeyup: (event: Event) => void;
92
+ onload: (event: Event) => void;
93
+ onloadeddata: (event: Event) => void;
94
+ onloadedmetadata: (event: Event) => void;
95
+ onloadstart: (event: Event) => void;
96
+ onmousedown: (event: Event) => void;
97
+ onmouseenter: (event: Event) => void;
98
+ onmouseleave: (event: Event) => void;
99
+ onmousemove: (event: Event) => void;
100
+ onmouseout: (event: Event) => void;
101
+ onmouseover: (event: Event) => void;
102
+ onmouseup: (event: Event) => void;
103
+ onmousewheel: (event: Event) => void;
104
+ onpause: (event: Event) => void;
105
+ onplay: (event: Event) => void;
106
+ onplaying: (event: Event) => void;
107
+ onprogress: (event: Event) => void;
108
+ onratechange: (event: Event) => void;
109
+ onreset: (event: Event) => void;
110
+ onresize: (event: Event) => void;
111
+ onscroll: (event: Event) => void;
112
+ onsecuritypolicyviolation: (event: Event) => void;
113
+ onseeked: (event: Event) => void;
114
+ onseeking: (event: Event) => void;
115
+ onselect: (event: Event) => void;
116
+ onslotchange: (event: Event) => void;
117
+ onstalled: (event: Event) => void;
118
+ onsubmit: (event: Event) => void;
119
+ onsuspend: (event: Event) => void;
120
+ ontimeupdate: (event: Event) => void;
121
+ ontoggle: (event: Event) => void;
122
+ onvolumechange: (event: Event) => void;
123
+ onwaiting: (event: Event) => void;
124
+ onwebkitanimationend: (event: Event) => void;
125
+ onwebkitanimationiteration: (event: Event) => void;
126
+ onwebkitanimationstart: (event: Event) => void;
127
+ onwebkittransitionend: (event: Event) => void;
128
+ onwheel: (event: Event) => void;
129
+ onauxclick: (event: Event) => void;
130
+ ongotpointercapture: (event: Event) => void;
131
+ onlostpointercapture: (event: Event) => void;
132
+ onpointerdown: (event: Event) => void;
133
+ onpointermove: (event: Event) => void;
134
+ onpointerrawupdate: (event: Event) => void;
135
+ onpointerup: (event: Event) => void;
136
+ onpointercancel: (event: Event) => void;
137
+ onpointerover: (event: Event) => void;
138
+ onpointerout: (event: Event) => void;
139
+ onpointerenter: (event: Event) => void;
140
+ onpointerleave: (event: Event) => void;
141
+ onselectstart: (event: Event) => void;
142
+ onselectionchange: (event: Event) => void;
143
+ onanimationend: (event: Event) => void;
144
+ onanimationiteration: (event: Event) => void;
145
+ onanimationstart: (event: Event) => void;
146
+ ontransitionrun: (event: Event) => void;
147
+ ontransitionstart: (event: Event) => void;
148
+ ontransitionend: (event: Event) => void;
149
+ ontransitioncancel: (event: Event) => void;
150
+ oncopy: (event: Event) => void;
151
+ oncut: (event: Event) => void;
152
+ onpaste: (event: Event) => void;
153
+ onbeforematch: (event: Event) => void;
154
+
45
155
  /**
46
156
  * Replaces the document HTML with new HTML.
47
157
  *
@@ -5,7 +5,6 @@ import DOMRect from './DOMRect';
5
5
  import DOMTokenList from '../../dom-token-list/DOMTokenList';
6
6
  import IDOMTokenList from '../../dom-token-list/IDOMTokenList';
7
7
  import QuerySelector from '../../query-selector/QuerySelector';
8
- import SelectorItem from '../../query-selector/SelectorItem';
9
8
  import MutationRecord from '../../mutation-observer/MutationRecord';
10
9
  import MutationTypeEnum from '../../mutation-observer/MutationTypeEnum';
11
10
  import NamespaceURI from '../../config/NamespaceURI';
@@ -27,6 +26,7 @@ import IText from '../text/IText';
27
26
  import IDOMRectList from './IDOMRectList';
28
27
  import DOMRectListFactory from './DOMRectListFactory';
29
28
  import IAttr from '../attr/IAttr';
29
+ import Event from '../../event/Event';
30
30
 
31
31
  /**
32
32
  * Element.
@@ -46,6 +46,42 @@ export default class Element extends Node implements IElement {
46
46
  public children: IHTMLCollection<IElement> = HTMLCollectionFactory.create();
47
47
  public readonly namespaceURI: string = null;
48
48
 
49
+ // Events
50
+ public oncancel: (event: Event) => void | null = null;
51
+ public onerror: (event: Event) => void | null = null;
52
+ public onscroll: (event: Event) => void | null = null;
53
+ public onselect: (event: Event) => void | null = null;
54
+ public onwheel: (event: Event) => void | null = null;
55
+ public oncopy: (event: Event) => void | null = null;
56
+ public oncut: (event: Event) => void | null = null;
57
+ public onpaste: (event: Event) => void | null = null;
58
+ public oncompositionend: (event: Event) => void | null = null;
59
+ public oncompositionstart: (event: Event) => void | null = null;
60
+ public oncompositionupdate: (event: Event) => void | null = null;
61
+ public onblur: (event: Event) => void | null = null;
62
+ public onfocus: (event: Event) => void | null = null;
63
+ public onfocusin: (event: Event) => void | null = null;
64
+ public onfocusout: (event: Event) => void | null = null;
65
+ public onfullscreenchange: (event: Event) => void | null = null;
66
+ public onfullscreenerror: (event: Event) => void | null = null;
67
+ public onkeydown: (event: Event) => void | null = null;
68
+ public onkeyup: (event: Event) => void | null = null;
69
+ public onauxclick: (event: Event) => void | null = null;
70
+ public onclick: (event: Event) => void | null = null;
71
+ public oncontextmenu: (event: Event) => void | null = null;
72
+ public ondblclick: (event: Event) => void | null = null;
73
+ public onmousedown: (event: Event) => void | null = null;
74
+ public onmouseenter: (event: Event) => void | null = null;
75
+ public onmouseleave: (event: Event) => void | null = null;
76
+ public onmousemove: (event: Event) => void | null = null;
77
+ public onmouseout: (event: Event) => void | null = null;
78
+ public onmouseover: (event: Event) => void | null = null;
79
+ public onmouseup: (event: Event) => void | null = null;
80
+ public ontouchcancel: (event: Event) => void | null = null;
81
+ public ontouchend: (event: Event) => void | null = null;
82
+ public ontouchmove: (event: Event) => void | null = null;
83
+ public ontouchstart: (event: Event) => void | null = null;
84
+
49
85
  // Used for being able to access closed shadow roots
50
86
  public _shadowRoot: IShadowRoot = null;
51
87
  public _attributes: { [k: string]: IAttr } = {};
@@ -707,12 +743,7 @@ export default class Element extends Node implements IElement {
707
743
  * @returns "true" if matching.
708
744
  */
709
745
  public matches(selector: string): boolean {
710
- for (const part of selector.split(',')) {
711
- if (new SelectorItem(part.trim()).match(this)) {
712
- return true;
713
- }
714
- }
715
- return false;
746
+ return QuerySelector.match(this, selector).matches;
716
747
  }
717
748
 
718
749
  /**
@@ -815,6 +846,10 @@ export default class Element extends Node implements IElement {
815
846
  (<IElement>attribute.ownerElement) = <IElement>this;
816
847
  (<IDocument>attribute.ownerDocument) = this.ownerDocument;
817
848
 
849
+ if (this.isConnected) {
850
+ this.ownerDocument['_cacheID']++;
851
+ }
852
+
818
853
  this._attributes[name] = attribute;
819
854
 
820
855
  this._updateDomListIndices();
@@ -900,6 +935,10 @@ export default class Element extends Node implements IElement {
900
935
  public removeAttributeNode(attribute: IAttr): void {
901
936
  delete this._attributes[attribute.name];
902
937
 
938
+ if (this.isConnected) {
939
+ this.ownerDocument['_cacheID']++;
940
+ }
941
+
903
942
  this._updateDomListIndices();
904
943
 
905
944
  if (
@@ -7,6 +7,7 @@ import IChildNode from '../child-node/IChildNode';
7
7
  import IParentNode from '../parent-node/IParentNode';
8
8
  import INonDocumentTypeChildNode from '../child-node/INonDocumentTypeChildNode';
9
9
  import IDOMRectList from './IDOMRectList';
10
+ import Event from '../../event/Event';
10
11
 
11
12
  export type TInsertAdjacentPositions = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
12
13
 
@@ -30,6 +31,42 @@ export default interface IElement extends IChildNode, INonDocumentTypeChildNode,
30
31
  readonly localName: string;
31
32
  readonly attributes: { [k: string | number]: IAttr } & { length: number };
32
33
 
34
+ // Events
35
+ oncancel: (event: Event) => void | null;
36
+ onerror: (event: Event) => void | null;
37
+ onscroll: (event: Event) => void | null;
38
+ onselect: (event: Event) => void | null;
39
+ onwheel: (event: Event) => void | null;
40
+ oncopy: (event: Event) => void | null;
41
+ oncut: (event: Event) => void | null;
42
+ onpaste: (event: Event) => void | null;
43
+ oncompositionend: (event: Event) => void | null;
44
+ oncompositionstart: (event: Event) => void | null;
45
+ oncompositionupdate: (event: Event) => void | null;
46
+ onblur: (event: Event) => void | null;
47
+ onfocus: (event: Event) => void | null;
48
+ onfocusin: (event: Event) => void | null;
49
+ onfocusout: (event: Event) => void | null;
50
+ onfullscreenchange: (event: Event) => void | null;
51
+ onfullscreenerror: (event: Event) => void | null;
52
+ onkeydown: (event: Event) => void | null;
53
+ onkeyup: (event: Event) => void | null;
54
+ onauxclick: (event: Event) => void | null;
55
+ onclick: (event: Event) => void | null;
56
+ oncontextmenu: (event: Event) => void | null;
57
+ ondblclick: (event: Event) => void | null;
58
+ onmousedown: (event: Event) => void | null;
59
+ onmouseenter: (event: Event) => void | null;
60
+ onmouseleave: (event: Event) => void | null;
61
+ onmousemove: (event: Event) => void | null;
62
+ onmouseout: (event: Event) => void | null;
63
+ onmouseover: (event: Event) => void | null;
64
+ onmouseup: (event: Event) => void | null;
65
+ ontouchcancel: (event: Event) => void | null;
66
+ ontouchend: (event: Event) => void | null;
67
+ ontouchmove: (event: Event) => void | null;
68
+ ontouchstart: (event: Event) => void | null;
69
+
33
70
  /**
34
71
  * Attribute changed callback.
35
72
  *
@@ -11,6 +11,10 @@ import IHTMLDialogElement from './IHTMLDialogElement';
11
11
  export default class HTMLDialogElement extends HTMLElement implements IHTMLDialogElement {
12
12
  public returnValue = '';
13
13
 
14
+ // Events
15
+ public oncancel: (event: Event) => void | null = null;
16
+ public onclose: (event: Event) => void | null = null;
17
+
14
18
  /**
15
19
  * Returns open.
16
20
  *
@@ -1,3 +1,4 @@
1
+ import Event from '../../event/Event';
1
2
  import IHTMLElement from '../html-element/IHTMLElement';
2
3
 
3
4
  /**
@@ -10,6 +11,10 @@ export default interface IHTMLDialogElement extends IHTMLElement {
10
11
  open: boolean;
11
12
  returnValue: string;
12
13
 
14
+ // Events
15
+ oncancel: (event: Event) => void | null;
16
+ onclose: (event: Event) => void | null;
17
+
13
18
  /**
14
19
  * Closes the dialog.
15
20
  *
@@ -7,6 +7,7 @@ import PointerEvent from '../../event/events/PointerEvent';
7
7
  import DatasetUtility from './DatasetUtility';
8
8
  import NodeTypeEnum from '../node/NodeTypeEnum';
9
9
  import DOMException from '../../exception/DOMException';
10
+ import Event from '../../event/Event';
10
11
 
11
12
  /**
12
13
  * HTML Element.
@@ -29,6 +30,33 @@ export default class HTMLElement extends Element implements IHTMLElement {
29
30
  private _style: CSSStyleDeclaration = null;
30
31
  private _dataset: { [key: string]: string } = null;
31
32
 
33
+ // Events
34
+ public oncopy: (event: Event) => void | null = null;
35
+ public oncut: (event: Event) => void | null = null;
36
+ public onpaste: (event: Event) => void | null = null;
37
+ public oninvalid: (event: Event) => void | null = null;
38
+ public onanimationcancel: (event: Event) => void | null = null;
39
+ public onanimationend: (event: Event) => void | null = null;
40
+ public onanimationiteration: (event: Event) => void | null = null;
41
+ public onanimationstart: (event: Event) => void | null = null;
42
+ public onbeforeinput: (event: Event) => void | null = null;
43
+ public oninput: (event: Event) => void | null = null;
44
+ public onchange: (event: Event) => void | null = null;
45
+ public ongotpointercapture: (event: Event) => void | null = null;
46
+ public onlostpointercapture: (event: Event) => void | null = null;
47
+ public onpointercancel: (event: Event) => void | null = null;
48
+ public onpointerdown: (event: Event) => void | null = null;
49
+ public onpointerenter: (event: Event) => void | null = null;
50
+ public onpointerleave: (event: Event) => void | null = null;
51
+ public onpointermove: (event: Event) => void | null = null;
52
+ public onpointerout: (event: Event) => void | null = null;
53
+ public onpointerover: (event: Event) => void | null = null;
54
+ public onpointerup: (event: Event) => void | null = null;
55
+ public ontransitioncancel: (event: Event) => void | null = null;
56
+ public ontransitionend: (event: Event) => void | null = null;
57
+ public ontransitionrun: (event: Event) => void | null = null;
58
+ public ontransitionstart: (event: Event) => void | null = null;
59
+
32
60
  /**
33
61
  * Returns tab index.
34
62
  *
@@ -1,3 +1,4 @@
1
+ import Event from '../../event/Event';
1
2
  import CSSStyleDeclaration from '../../css/declaration/CSSStyleDeclaration';
2
3
  import IElement from '../element/IElement';
3
4
 
@@ -20,6 +21,33 @@ export default interface IHTMLElement extends IElement {
20
21
  innerText: string;
21
22
  outerText: string;
22
23
 
24
+ // Events
25
+ oncopy: (event: Event) => void | null;
26
+ oncut: (event: Event) => void | null;
27
+ onpaste: (event: Event) => void | null;
28
+ oninvalid: (event: Event) => void | null;
29
+ onanimationcancel: (event: Event) => void | null;
30
+ onanimationend: (event: Event) => void | null;
31
+ onanimationiteration: (event: Event) => void | null;
32
+ onanimationstart: (event: Event) => void | null;
33
+ onbeforeinput: (event: Event) => void | null;
34
+ oninput: (event: Event) => void | null;
35
+ onchange: (event: Event) => void | null;
36
+ ongotpointercapture: (event: Event) => void | null;
37
+ onlostpointercapture: (event: Event) => void | null;
38
+ onpointercancel: (event: Event) => void | null;
39
+ onpointerdown: (event: Event) => void | null;
40
+ onpointerenter: (event: Event) => void | null;
41
+ onpointerleave: (event: Event) => void | null;
42
+ onpointermove: (event: Event) => void | null;
43
+ onpointerout: (event: Event) => void | null;
44
+ onpointerover: (event: Event) => void | null;
45
+ onpointerup: (event: Event) => void | null;
46
+ ontransitioncancel: (event: Event) => void | null;
47
+ ontransitionend: (event: Event) => void | null;
48
+ ontransitionrun: (event: Event) => void | null;
49
+ ontransitionstart: (event: Event) => void | null;
50
+
23
51
  /**
24
52
  * Triggers a click event.
25
53
  */
@@ -1,6 +1,7 @@
1
1
  import HTMLElement from '../html-element/HTMLElement';
2
2
  import IElement from '../element/IElement';
3
3
  import IHTMLFormElement from './IHTMLFormElement';
4
+ import Event from '../../event/Event';
4
5
 
5
6
  /**
6
7
  * HTML Form Element.
@@ -9,6 +10,11 @@ import IHTMLFormElement from './IHTMLFormElement';
9
10
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement.
10
11
  */
11
12
  export default class HTMLFormElement extends HTMLElement implements IHTMLFormElement {
13
+ // Events
14
+ public onformdata: (event: Event) => void | null = null;
15
+ public onreset: (event: Event) => void | null = null;
16
+ public onsubmit: (event: Event) => void | null = null;
17
+
12
18
  /**
13
19
  * Returns name.
14
20
  *
@@ -1,3 +1,4 @@
1
+ import Event from '../../event/Event';
1
2
  import IElement from '../element/IElement';
2
3
  import IHTMLElement from '../html-element/IHTMLElement';
3
4
 
@@ -20,6 +21,11 @@ export default interface IHTMLFormElement extends IHTMLElement {
20
21
  elements: IElement[];
21
22
  length: number;
22
23
 
24
+ // Events
25
+ onformdata: (event: Event) => void | null;
26
+ onreset: (event: Event) => void | null;
27
+ onsubmit: (event: Event) => void | null;
28
+
23
29
  /**
24
30
  * Submits form.
25
31
  */
@@ -38,6 +38,11 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
38
38
  // Type specific: file
39
39
  public files: File[] = [];
40
40
 
41
+ // Events
42
+ public oninput: (event: Event) => void | null = null;
43
+ public oninvalid: (event: Event) => void | null = null;
44
+ public onselectionchange: (event: Event) => void | null = null;
45
+
41
46
  // Type specific: text/password/search/tel/url/week/month
42
47
  private _selectionStart: number = null;
43
48
  private _selectionEnd: number = null;
@@ -3,6 +3,7 @@ import IHTMLElement from '../html-element/IHTMLElement';
3
3
  import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
4
4
  import HTMLInputElementSelectionModeEnum from './HTMLInputElementSelectionModeEnum';
5
5
  import ValidityState from '../validity-state/ValidityState';
6
+ import Event from '../../event/Event';
6
7
 
7
8
  /**
8
9
  * HTML Input Element.
@@ -53,6 +54,11 @@ export default interface IHTMLInputElement extends IHTMLElement {
53
54
  valueAsNumber: number;
54
55
  validationMessage: string;
55
56
 
57
+ // Events
58
+ oninput: (event: Event) => void | null;
59
+ oninvalid: (event: Event) => void | null;
60
+ onselectionchange: (event: Event) => void | null;
61
+
56
62
  /**
57
63
  * Sets validation message.
58
64
  *
@@ -44,14 +44,29 @@ export default class HTMLMediaElement extends HTMLElement implements IHTMLMediaE
44
44
  public readonly played = getTimeRangeDummy();
45
45
 
46
46
  // Events
47
- public onabort: (event: Event) => void = null;
48
- public oncanplay: (event: Event) => void = null;
49
- public oncanplaythrough: (event: Event) => void = null;
50
- public ondurationchange: (event: Event) => void = null;
51
- public onemptied: (event: Event) => void = null;
52
- public onended: (event: Event) => void = null;
53
- public onerror: (event: ErrorEvent) => void = null;
54
- public onloadeddata: (event: Event) => void = null;
47
+ public onabort: (event: Event) => void | null = null;
48
+ public oncanplay: (event: Event) => void | null = null;
49
+ public oncanplaythrough: (event: Event) => void | null = null;
50
+ public ondurationchange: (event: Event) => void | null = null;
51
+ public onemptied: (event: Event) => void | null = null;
52
+ public onended: (event: Event) => void | null = null;
53
+ public onerror: (event: ErrorEvent) => void | null = null;
54
+ public onloadeddata: (event: Event) => void | null = null;
55
+ public onloadedmetadata: (event: Event) => void | null = null;
56
+ public onloadstart: (event: Event) => void | null = null;
57
+ public onpause: (event: Event) => void | null = null;
58
+ public onplay: (event: Event) => void | null = null;
59
+ public onplaying: (event: Event) => void | null = null;
60
+ public onprogress: (event: Event) => void | null = null;
61
+ public onratechange: (event: Event) => void | null = null;
62
+ public onresize: (event: Event) => void | null = null;
63
+ public onseeked: (event: Event) => void | null = null;
64
+ public onseeking: (event: Event) => void | null = null;
65
+ public onstalled: (event: Event) => void | null = null;
66
+ public onsuspend: (event: Event) => void | null = null;
67
+ public ontimeupdate: (event: Event) => void | null = null;
68
+ public onvolumechange: (event: Event) => void | null = null;
69
+ public onwaiting: (event: Event) => void | null = null;
55
70
 
56
71
  #volume = 1;
57
72
  #paused = true;
@@ -1,3 +1,4 @@
1
+ import Event from '../../event/Event';
1
2
  import IHTMLElement from '../html-element/IHTMLElement';
2
3
 
3
4
  /**
@@ -39,6 +40,31 @@ export default interface IHTMLMediaElement extends IHTMLElement {
39
40
  src: string;
40
41
  volume: number | string;
41
42
 
43
+ // Events
44
+ onabort: (event: Event) => void | null;
45
+ oncanplay: (event: Event) => void | null;
46
+ oncanplaythrough: (event: Event) => void | null;
47
+ ondurationchange: (event: Event) => void | null;
48
+ onemptied: (event: Event) => void | null;
49
+ onended: (event: Event) => void | null;
50
+ onerror: (event: Event) => void | null;
51
+ onloadeddata: (event: Event) => void | null;
52
+ onloadedmetadata: (event: Event) => void | null;
53
+ onloadstart: (event: Event) => void | null;
54
+ onpause: (event: Event) => void | null;
55
+ onplay: (event: Event) => void | null;
56
+ onplaying: (event: Event) => void | null;
57
+ onprogress: (event: Event) => void | null;
58
+ onratechange: (event: Event) => void | null;
59
+ onresize: (event: Event) => void | null;
60
+ onseeked: (event: Event) => void | null;
61
+ onseeking: (event: Event) => void | null;
62
+ onstalled: (event: Event) => void | null;
63
+ onsuspend: (event: Event) => void | null;
64
+ ontimeupdate: (event: Event) => void | null;
65
+ onvolumechange: (event: Event) => void | null;
66
+ onwaiting: (event: Event) => void | null;
67
+
42
68
  /**
43
69
  * A MediaStream object which can be used as a source for audio and/or video data by other media processing code,
44
70
  * or as a source for WebRTC.