@remote-dom/polyfill 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +51 -3
- package/build/cjs/Attr.cjs +33 -4
- package/build/cjs/CharacterData.cjs +10 -0
- package/build/cjs/ChildNode.cjs +79 -13
- package/build/cjs/Comment.cjs +1 -1
- package/build/cjs/CustomElementRegistry.cjs +27 -2
- package/build/cjs/CustomEvent.cjs +2 -2
- package/build/cjs/Document.cjs +56 -32
- package/build/cjs/DocumentFragment.cjs +6 -2
- package/build/cjs/Element.cjs +68 -8
- package/build/cjs/Event.cjs +29 -27
- package/build/cjs/EventTarget.cjs +128 -58
- package/build/cjs/HTMLTemplateElement.cjs +1 -0
- package/build/cjs/MutationObserver.cjs +167 -1
- package/build/cjs/NamedNodeMap.cjs +82 -45
- package/build/cjs/Node.cjs +47 -11
- package/build/cjs/NodeList.cjs +9 -1
- package/build/cjs/ParentNode.cjs +319 -77
- package/build/cjs/SVGElement.cjs +1 -1
- package/build/cjs/Text.cjs +1 -1
- package/build/cjs/Window.cjs +131 -38
- package/build/cjs/attribute-reactions.cjs +20 -0
- package/build/cjs/constants.cjs +48 -24
- package/build/cjs/custom-element-reactions.cjs +52 -0
- package/build/cjs/dom-exception.cjs +15 -0
- package/build/cjs/hook-effects.cjs +51 -0
- package/build/cjs/names.cjs +61 -0
- package/build/cjs/selectors.cjs +213 -122
- package/build/cjs/serialization.cjs +168 -65
- package/build/cjs/shared.cjs +177 -28
- package/build/esm/Attr.mjs +34 -5
- package/build/esm/CharacterData.mjs +10 -0
- package/build/esm/ChildNode.mjs +76 -15
- package/build/esm/Comment.mjs +2 -2
- package/build/esm/CustomElementRegistry.mjs +27 -2
- package/build/esm/CustomEvent.mjs +2 -2
- package/build/esm/Document.mjs +60 -35
- package/build/esm/DocumentFragment.mjs +7 -3
- package/build/esm/Element.mjs +69 -9
- package/build/esm/Event.mjs +27 -27
- package/build/esm/EventTarget.mjs +130 -60
- package/build/esm/HTMLTemplateElement.mjs +2 -1
- package/build/esm/MutationObserver.mjs +166 -2
- package/build/esm/NamedNodeMap.mjs +83 -46
- package/build/esm/Node.mjs +48 -12
- package/build/esm/NodeList.mjs +9 -1
- package/build/esm/ParentNode.mjs +322 -81
- package/build/esm/SVGElement.mjs +2 -2
- package/build/esm/Text.mjs +2 -2
- package/build/esm/Window.mjs +132 -39
- package/build/esm/attribute-reactions.mjs +16 -0
- package/build/esm/constants.mjs +28 -23
- package/build/esm/custom-element-reactions.mjs +47 -0
- package/build/esm/dom-exception.mjs +11 -0
- package/build/esm/hook-effects.mjs +46 -0
- package/build/esm/names.mjs +54 -0
- package/build/esm/selectors.mjs +202 -124
- package/build/esm/serialization.mjs +169 -66
- package/build/esm/shared.mjs +173 -30
- package/build/esnext/Attr.esnext +45 -5
- package/build/esnext/CharacterData.esnext +10 -0
- package/build/esnext/ChildNode.esnext +84 -15
- package/build/esnext/Comment.esnext +2 -2
- package/build/esnext/CustomElementRegistry.esnext +42 -0
- package/build/esnext/CustomEvent.esnext +2 -2
- package/build/esnext/Document.esnext +69 -32
- package/build/esnext/DocumentFragment.esnext +6 -2
- package/build/esnext/Element.esnext +78 -9
- package/build/esnext/Event.esnext +36 -37
- package/build/esnext/EventTarget.esnext +133 -61
- package/build/esnext/HTMLTemplateElement.esnext +3 -1
- package/build/esnext/MutationObserver.esnext +163 -2
- package/build/esnext/NamedNodeMap.esnext +110 -42
- package/build/esnext/Node.esnext +50 -12
- package/build/esnext/NodeList.esnext +1 -1
- package/build/esnext/ParentNode.esnext +352 -79
- package/build/esnext/SVGElement.esnext +2 -2
- package/build/esnext/Text.esnext +2 -2
- package/build/esnext/Window.esnext +120 -16
- package/build/esnext/attribute-reactions.esnext +21 -0
- package/build/esnext/constants.esnext +34 -21
- package/build/esnext/custom-element-reactions.esnext +49 -0
- package/build/esnext/dom-exception.esnext +11 -0
- package/build/esnext/hook-effects.esnext +46 -0
- package/build/esnext/names.esnext +61 -0
- package/build/esnext/selectors.esnext +202 -100
- package/build/esnext/serialization.esnext +171 -48
- package/build/esnext/shared.esnext +181 -34
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/Attr.d.ts +6 -4
- package/build/typescript/Attr.d.ts.map +1 -1
- package/build/typescript/CharacterData.d.ts.map +1 -1
- package/build/typescript/ChildNode.d.ts +5 -0
- package/build/typescript/ChildNode.d.ts.map +1 -1
- package/build/typescript/ClipboardEvent.d.ts.map +1 -1
- package/build/typescript/Comment.d.ts +2 -2
- package/build/typescript/Comment.d.ts.map +1 -1
- package/build/typescript/CustomElementRegistry.d.ts +1 -0
- package/build/typescript/CustomElementRegistry.d.ts.map +1 -1
- package/build/typescript/CustomEvent.d.ts.map +1 -1
- package/build/typescript/Document.d.ts +10 -5
- package/build/typescript/Document.d.ts.map +1 -1
- package/build/typescript/DocumentFragment.d.ts +2 -1
- package/build/typescript/DocumentFragment.d.ts.map +1 -1
- package/build/typescript/Element.d.ts +16 -7
- package/build/typescript/Element.d.ts.map +1 -1
- package/build/typescript/ErrorEvent.d.ts.map +1 -1
- package/build/typescript/Event.d.ts +9 -10
- package/build/typescript/Event.d.ts.map +1 -1
- package/build/typescript/EventTarget.d.ts +20 -3
- package/build/typescript/EventTarget.d.ts.map +1 -1
- package/build/typescript/FocusEvent.d.ts.map +1 -1
- package/build/typescript/HTMLTemplateElement.d.ts.map +1 -1
- package/build/typescript/MutationObserver.d.ts +42 -0
- package/build/typescript/MutationObserver.d.ts.map +1 -1
- package/build/typescript/NamedNodeMap.d.ts +5 -3
- package/build/typescript/NamedNodeMap.d.ts.map +1 -1
- package/build/typescript/Node.d.ts +4 -3
- package/build/typescript/Node.d.ts.map +1 -1
- package/build/typescript/NodeList.d.ts +3 -2
- package/build/typescript/NodeList.d.ts.map +1 -1
- package/build/typescript/ParentNode.d.ts +29 -10
- package/build/typescript/ParentNode.d.ts.map +1 -1
- package/build/typescript/PromiseRejectionEvent.d.ts.map +1 -1
- package/build/typescript/SVGElement.d.ts +1 -1
- package/build/typescript/SVGElement.d.ts.map +1 -1
- package/build/typescript/Text.d.ts +1 -1
- package/build/typescript/Text.d.ts.map +1 -1
- package/build/typescript/ToggleEvent.d.ts.map +1 -1
- package/build/typescript/Window.d.ts +5 -1
- package/build/typescript/Window.d.ts.map +1 -1
- package/build/typescript/attribute-reactions.d.ts +4 -0
- package/build/typescript/attribute-reactions.d.ts.map +1 -0
- package/build/typescript/constants.d.ts +27 -18
- package/build/typescript/constants.d.ts.map +1 -1
- package/build/typescript/custom-element-reactions.d.ts +6 -0
- package/build/typescript/custom-element-reactions.d.ts.map +1 -0
- package/build/typescript/dom-exception.d.ts +2 -0
- package/build/typescript/dom-exception.d.ts.map +1 -0
- package/build/typescript/extensions.d.ts +4 -0
- package/build/typescript/extensions.d.ts.map +1 -0
- package/build/typescript/hook-effects.d.ts +6 -0
- package/build/typescript/hook-effects.d.ts.map +1 -0
- package/build/typescript/hooks.d.ts +3 -3
- package/build/typescript/hooks.d.ts.map +1 -1
- package/build/typescript/index.d.ts +1 -0
- package/build/typescript/index.d.ts.map +1 -1
- package/build/typescript/names.d.ts +11 -0
- package/build/typescript/names.d.ts.map +1 -0
- package/build/typescript/selectors.d.ts +21 -22
- package/build/typescript/selectors.d.ts.map +1 -1
- package/build/typescript/serialization.d.ts.map +1 -1
- package/build/typescript/shared.d.ts +10 -0
- package/build/typescript/shared.d.ts.map +1 -1
- package/build/typescript/tests/ChildNode.test.d.ts +2 -0
- package/build/typescript/tests/ChildNode.test.d.ts.map +1 -0
- package/build/typescript/tests/MutationObserver.test.d.ts +2 -0
- package/build/typescript/tests/MutationObserver.test.d.ts.map +1 -0
- package/build/typescript/tests/adopt-inserted-subtrees.test.d.ts +2 -0
- package/build/typescript/tests/adopt-inserted-subtrees.test.d.ts.map +1 -0
- package/build/typescript/tests/attr-mutation.test.d.ts +2 -0
- package/build/typescript/tests/attr-mutation.test.d.ts.map +1 -0
- package/build/typescript/tests/child-node-before-after.test.d.ts +2 -0
- package/build/typescript/tests/child-node-before-after.test.d.ts.map +1 -0
- package/build/typescript/tests/child-node-replace-with.test.d.ts +2 -0
- package/build/typescript/tests/child-node-replace-with.test.d.ts.map +1 -0
- package/build/typescript/tests/clone-import-namespaces.test.d.ts +2 -0
- package/build/typescript/tests/clone-import-namespaces.test.d.ts.map +1 -0
- package/build/typescript/tests/constants.test.d.ts +2 -0
- package/build/typescript/tests/constants.test.d.ts.map +1 -0
- package/build/typescript/tests/create-element-namespaces.test.d.ts +2 -0
- package/build/typescript/tests/create-element-namespaces.test.d.ts.map +1 -0
- package/build/typescript/tests/create-text-node.test.d.ts +2 -0
- package/build/typescript/tests/create-text-node.test.d.ts.map +1 -0
- package/build/typescript/tests/custom-element-reactions.test.d.ts +2 -0
- package/build/typescript/tests/custom-element-reactions.test.d.ts.map +1 -0
- package/build/typescript/tests/custom-element-registry.test.d.ts +2 -0
- package/build/typescript/tests/custom-element-registry.test.d.ts.map +1 -0
- package/build/typescript/tests/custom-event.test.d.ts +2 -0
- package/build/typescript/tests/custom-event.test.d.ts.map +1 -0
- package/build/typescript/tests/document-clone-import-contract.test.d.ts +2 -0
- package/build/typescript/tests/document-clone-import-contract.test.d.ts.map +1 -0
- package/build/typescript/tests/document.test.d.ts +2 -0
- package/build/typescript/tests/document.test.d.ts.map +1 -0
- package/build/typescript/tests/dom-mutation-selector-errors.test.d.ts +2 -0
- package/build/typescript/tests/dom-mutation-selector-errors.test.d.ts.map +1 -0
- package/build/typescript/tests/event-dispatch.test.d.ts +2 -0
- package/build/typescript/tests/event-dispatch.test.d.ts.map +1 -0
- package/build/typescript/tests/event-target.test.d.ts +2 -0
- package/build/typescript/tests/event-target.test.d.ts.map +1 -0
- package/build/typescript/tests/event.test.d.ts +2 -0
- package/build/typescript/tests/event.test.d.ts.map +1 -0
- package/build/typescript/tests/extensions.test.d.ts +2 -0
- package/build/typescript/tests/extensions.test.d.ts.map +1 -0
- package/build/typescript/tests/get-elements-by-tag-name.test.d.ts +2 -0
- package/build/typescript/tests/get-elements-by-tag-name.test.d.ts.map +1 -0
- package/build/typescript/tests/getElementsByClassName.test.d.ts +2 -0
- package/build/typescript/tests/getElementsByClassName.test.d.ts.map +1 -0
- package/build/typescript/tests/hooks.test.d.ts +2 -0
- package/build/typescript/tests/hooks.test.d.ts.map +1 -0
- package/build/typescript/tests/inner-html-parsing.test.d.ts +2 -0
- package/build/typescript/tests/inner-html-parsing.test.d.ts.map +1 -0
- package/build/typescript/tests/is-default-namespace.test.d.ts +2 -0
- package/build/typescript/tests/is-default-namespace.test.d.ts.map +1 -0
- package/build/typescript/tests/name-and-namespace-normalization.test.d.ts +2 -0
- package/build/typescript/tests/name-and-namespace-normalization.test.d.ts.map +1 -0
- package/build/typescript/tests/named-node-map.test.d.ts +2 -0
- package/build/typescript/tests/named-node-map.test.d.ts.map +1 -0
- package/build/typescript/tests/namespaced-attribute-reactions.test.d.ts +2 -0
- package/build/typescript/tests/namespaced-attribute-reactions.test.d.ts.map +1 -0
- package/build/typescript/tests/node.test.d.ts +2 -0
- package/build/typescript/tests/node.test.d.ts.map +1 -0
- package/build/typescript/tests/parent-node-mutation-return-values.test.d.ts +2 -0
- package/build/typescript/tests/parent-node-mutation-return-values.test.d.ts.map +1 -0
- package/build/typescript/tests/parent-node-mutation-validation.test.d.ts +2 -0
- package/build/typescript/tests/parent-node-mutation-validation.test.d.ts.map +1 -0
- package/build/typescript/tests/parent-node.test.d.ts +2 -0
- package/build/typescript/tests/parent-node.test.d.ts.map +1 -0
- package/build/typescript/tests/serialization-template.test.d.ts +2 -0
- package/build/typescript/tests/serialization-template.test.d.ts.map +1 -0
- package/build/typescript/tests/slot-attribute.test.d.ts +2 -0
- package/build/typescript/tests/slot-attribute.test.d.ts.map +1 -0
- package/build/typescript/tests/text-content.test.d.ts +2 -0
- package/build/typescript/tests/text-content.test.d.ts.map +1 -0
- package/build/typescript/tests/toggle-attribute.test.d.ts +2 -0
- package/build/typescript/tests/toggle-attribute.test.d.ts.map +1 -0
- package/build/typescript/tests/wide-tree-traversal.test.d.ts +2 -0
- package/build/typescript/tests/wide-tree-traversal.test.d.ts.map +1 -0
- package/build/typescript/tests/window-set-global.test.d.ts +2 -0
- package/build/typescript/tests/window-set-global.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/source/Attr.ts +60 -8
- package/source/CharacterData.ts +13 -0
- package/source/ChildNode.ts +107 -14
- package/source/Comment.ts +2 -2
- package/source/CustomElementRegistry.ts +56 -0
- package/source/CustomEvent.ts +2 -2
- package/source/Document.ts +104 -38
- package/source/DocumentFragment.ts +12 -2
- package/source/Element.ts +129 -14
- package/source/Event.ts +34 -32
- package/source/EventTarget.ts +203 -79
- package/source/HTMLTemplateElement.ts +2 -1
- package/source/MutationObserver.ts +279 -1
- package/source/NamedNodeMap.ts +141 -60
- package/source/Node.ts +70 -14
- package/source/NodeList.ts +13 -3
- package/source/ParentNode.ts +500 -88
- package/source/SVGElement.ts +2 -2
- package/source/Text.ts +2 -2
- package/source/Window.ts +156 -17
- package/source/attribute-reactions.ts +32 -0
- package/source/constants.ts +40 -17
- package/source/custom-element-reactions.ts +64 -0
- package/source/dom-exception.ts +14 -0
- package/source/extensions.ts +4 -0
- package/source/hook-effects.ts +56 -0
- package/source/hooks.ts +11 -3
- package/source/index.ts +1 -0
- package/source/names.ts +94 -0
- package/source/selectors.ts +301 -138
- package/source/serialization.ts +224 -66
- package/source/shared.ts +269 -40
- package/source/tests/ChildNode.test.ts +178 -0
- package/source/tests/MutationObserver.test.ts +303 -0
- package/source/tests/adopt-inserted-subtrees.test.ts +584 -0
- package/source/tests/attr-mutation.test.ts +112 -0
- package/source/tests/child-node-before-after.test.ts +421 -0
- package/source/tests/child-node-replace-with.test.ts +251 -0
- package/source/tests/clone-import-namespaces.test.ts +365 -0
- package/source/tests/constants.test.ts +46 -0
- package/source/tests/create-element-namespaces.test.ts +142 -0
- package/source/tests/create-text-node.test.ts +38 -0
- package/source/tests/custom-element-reactions.test.ts +600 -0
- package/source/tests/custom-element-registry.test.ts +137 -0
- package/source/tests/custom-event.test.ts +26 -0
- package/source/tests/document-clone-import-contract.test.ts +77 -0
- package/source/tests/document.test.ts +122 -0
- package/source/tests/dom-mutation-selector-errors.test.ts +484 -0
- package/source/tests/event-dispatch.test.ts +270 -0
- package/source/tests/event-target.test.ts +208 -0
- package/source/tests/event.test.ts +98 -0
- package/source/tests/extensions.test.ts +159 -0
- package/source/tests/get-elements-by-tag-name.test.ts +79 -0
- package/source/tests/getElementsByClassName.test.ts +109 -0
- package/source/tests/hooks.test.ts +43 -0
- package/source/tests/inner-html-parsing.test.ts +461 -0
- package/source/tests/is-default-namespace.test.ts +111 -0
- package/source/tests/name-and-namespace-normalization.test.ts +319 -0
- package/source/tests/named-node-map.test.ts +122 -0
- package/source/tests/namespaced-attribute-reactions.test.ts +141 -0
- package/source/tests/node.test.ts +56 -0
- package/source/tests/parent-node-mutation-return-values.test.ts +63 -0
- package/source/tests/parent-node-mutation-validation.test.ts +362 -0
- package/source/tests/parent-node.test.ts +169 -0
- package/source/tests/selectors.test.ts +533 -22
- package/source/tests/serialization-template.test.ts +232 -0
- package/source/tests/slot-attribute.test.ts +133 -0
- package/source/tests/text-content.test.ts +440 -0
- package/source/tests/toggle-attribute.test.ts +113 -0
- package/source/tests/wide-tree-traversal.test.ts +699 -0
- package/source/tests/window-set-global.test.ts +321 -0
- package/tsconfig.json +1 -1
package/build/cjs/Window.cjs
CHANGED
|
@@ -26,41 +26,112 @@ const CustomElementRegistry = require('./CustomElementRegistry.cjs');
|
|
|
26
26
|
const MutationObserver = require('./MutationObserver.cjs');
|
|
27
27
|
const constants = require('./constants.cjs');
|
|
28
28
|
|
|
29
|
+
const EVENT_HANDLER_PROPERTIES = ['onerror', 'onunhandledrejection'];
|
|
30
|
+
const POLYFILL_GLOBAL_PROPERTY = Symbol.for('@remote-dom/polyfill/global-property');
|
|
31
|
+
function windowPropertyDescriptors(window) {
|
|
32
|
+
return Object.getOwnPropertyDescriptors(window);
|
|
33
|
+
}
|
|
34
|
+
function eventTargetPropertyDescriptors(window) {
|
|
35
|
+
const properties = {};
|
|
36
|
+
for (const [property, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(EventTarget.EventTarget.prototype))) {
|
|
37
|
+
if (property !== 'constructor' && typeof descriptor.value === 'function') {
|
|
38
|
+
descriptor.value = markPolyfillGlobalProperty(descriptor.value.bind(window));
|
|
39
|
+
properties[property] = descriptor;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return properties;
|
|
43
|
+
}
|
|
44
|
+
function eventHandlerPropertyDescriptors(window) {
|
|
45
|
+
const properties = {};
|
|
46
|
+
for (const property of EVENT_HANDLER_PROPERTIES) {
|
|
47
|
+
properties[property] = {
|
|
48
|
+
configurable: true,
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: markPolyfillGlobalProperty(() => window[property]),
|
|
51
|
+
set: markPolyfillGlobalProperty(handler => {
|
|
52
|
+
window[property] = handler;
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return properties;
|
|
57
|
+
}
|
|
58
|
+
function globalPropertyDescriptors(window) {
|
|
59
|
+
return Object.assign(windowPropertyDescriptors(window), eventTargetPropertyDescriptors(window), eventHandlerPropertyDescriptors(window));
|
|
60
|
+
}
|
|
61
|
+
function markPolyfillGlobalProperty(value) {
|
|
62
|
+
Object.defineProperty(value, POLYFILL_GLOBAL_PROPERTY, {
|
|
63
|
+
value: true
|
|
64
|
+
});
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
function installMissingGlobalProperties(target, properties) {
|
|
68
|
+
for (const property of Reflect.ownKeys(properties)) {
|
|
69
|
+
const currentDescriptor = findPropertyDescriptor(target, property);
|
|
70
|
+
if (currentDescriptor == null || isPolyfillGlobalProperty(currentDescriptor)) {
|
|
71
|
+
Object.defineProperty(target, property, properties[property]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function findPropertyDescriptor(target, property) {
|
|
76
|
+
let currentTarget = target;
|
|
77
|
+
while (currentTarget) {
|
|
78
|
+
const descriptor = Object.getOwnPropertyDescriptor(currentTarget, property);
|
|
79
|
+
if (descriptor) return descriptor;
|
|
80
|
+
currentTarget = Object.getPrototypeOf(currentTarget);
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
function isPolyfillGlobalProperty(descriptor) {
|
|
85
|
+
return [descriptor.value, descriptor.get, descriptor.set].some(value => typeof value === 'function' && value[POLYFILL_GLOBAL_PROPERTY] === true);
|
|
86
|
+
}
|
|
29
87
|
class Window extends EventTarget.EventTarget {
|
|
30
88
|
[constants.HOOKS] = {};
|
|
89
|
+
[constants.EXTENSIONS] = [];
|
|
90
|
+
[constants.HOOKS_DISPATCH] = createHooksDispatcher(this);
|
|
31
91
|
name = '';
|
|
32
92
|
window = this;
|
|
33
93
|
parent = this;
|
|
34
94
|
self = this;
|
|
35
95
|
top = this;
|
|
36
|
-
document =
|
|
37
|
-
customElements =
|
|
38
|
-
location =
|
|
39
|
-
navigator =
|
|
40
|
-
Event =
|
|
41
|
-
ErrorEvent =
|
|
42
|
-
PromiseRejectionEvent =
|
|
43
|
-
ToggleEvent =
|
|
44
|
-
FocusEvent =
|
|
45
|
-
ClipboardEvent =
|
|
46
|
-
EventTarget =
|
|
47
|
-
CustomEvent =
|
|
48
|
-
Node =
|
|
49
|
-
ParentNode =
|
|
50
|
-
ChildNode =
|
|
51
|
-
DocumentFragment =
|
|
52
|
-
Document =
|
|
53
|
-
CharacterData =
|
|
54
|
-
Comment =
|
|
55
|
-
Text =
|
|
56
|
-
Element =
|
|
57
|
-
HTMLElement =
|
|
58
|
-
SVGElement =
|
|
59
|
-
HTMLTemplateElement =
|
|
60
|
-
MutationObserver =
|
|
96
|
+
document = new Document.Document(this);
|
|
97
|
+
customElements = new CustomElementRegistry.CustomElementRegistryImplementation();
|
|
98
|
+
location = globalThis.location;
|
|
99
|
+
navigator = globalThis.navigator;
|
|
100
|
+
Event = Event.Event;
|
|
101
|
+
ErrorEvent = ErrorEvent.ErrorEvent;
|
|
102
|
+
PromiseRejectionEvent = PromiseRejectionEvent.PromiseRejectionEvent;
|
|
103
|
+
ToggleEvent = ToggleEvent.ToggleEvent;
|
|
104
|
+
FocusEvent = FocusEvent.FocusEvent;
|
|
105
|
+
ClipboardEvent = ClipboardEvent.ClipboardEvent;
|
|
106
|
+
EventTarget = EventTarget.EventTarget;
|
|
107
|
+
CustomEvent = CustomEvent.CustomEvent;
|
|
108
|
+
Node = Node.Node;
|
|
109
|
+
ParentNode = ParentNode.ParentNode;
|
|
110
|
+
ChildNode = ChildNode.ChildNode;
|
|
111
|
+
DocumentFragment = DocumentFragment.DocumentFragment;
|
|
112
|
+
Document = Document.Document;
|
|
113
|
+
CharacterData = CharacterData.CharacterData;
|
|
114
|
+
Comment = Comment.Comment;
|
|
115
|
+
Text = Text.Text;
|
|
116
|
+
Element = Element.Element;
|
|
117
|
+
HTMLElement = HTMLElement.HTMLElement;
|
|
118
|
+
SVGElement = SVGElement.SVGElement;
|
|
119
|
+
HTMLTemplateElement = HTMLTemplateElement.HTMLTemplateElement;
|
|
120
|
+
MutationObserver = MutationObserver.MutationObserver;
|
|
61
121
|
#currentOnErrorHandler = null;
|
|
62
122
|
#currentOriginalOnErrorHandler = null;
|
|
63
123
|
#currentOnUnhandledRejectionHandler = null;
|
|
124
|
+
static with(...extensions) {
|
|
125
|
+
const BaseWindow = this;
|
|
126
|
+
return class ExtendedWindow extends BaseWindow {
|
|
127
|
+
constructor() {
|
|
128
|
+
super();
|
|
129
|
+
for (const extension of extensions) {
|
|
130
|
+
installExtension(this, extension);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
64
135
|
get onerror() {
|
|
65
136
|
return this.#currentOriginalOnErrorHandler;
|
|
66
137
|
}
|
|
@@ -99,21 +170,26 @@ class Window extends EventTarget.EventTarget {
|
|
|
99
170
|
}
|
|
100
171
|
}
|
|
101
172
|
static setGlobal(window) {
|
|
102
|
-
const
|
|
173
|
+
const currentSelf = globalThis.self;
|
|
174
|
+
const currentWindow = globalThis.window;
|
|
175
|
+
const properties = windowPropertyDescriptors(window);
|
|
176
|
+
const missingProperties = Object.assign(eventTargetPropertyDescriptors(window), eventHandlerPropertyDescriptors(window));
|
|
103
177
|
delete properties.self;
|
|
104
178
|
Object.defineProperties(globalThis, properties);
|
|
105
|
-
|
|
179
|
+
installMissingGlobalProperties(globalThis, missingProperties);
|
|
180
|
+
if (typeof currentSelf === 'undefined' || currentSelf === currentWindow && currentSelf !== globalThis) {
|
|
106
181
|
Object.defineProperty(globalThis, 'self', {
|
|
107
182
|
value: window,
|
|
108
183
|
configurable: true,
|
|
109
184
|
writable: true,
|
|
110
185
|
enumerable: true
|
|
111
186
|
});
|
|
112
|
-
} else {
|
|
187
|
+
} else if (currentSelf !== globalThis) {
|
|
113
188
|
// There can already be a `self`, like when polyfilling the DOM
|
|
114
189
|
// in a Web Worker. In those cases, just mirror all the `Window`
|
|
115
190
|
// properties onto `self`, rather than wholly redefining it.
|
|
116
|
-
Object.defineProperties(
|
|
191
|
+
Object.defineProperties(currentSelf, properties);
|
|
192
|
+
installMissingGlobalProperties(currentSelf, missingProperties);
|
|
117
193
|
}
|
|
118
194
|
}
|
|
119
195
|
static setGlobalThis(window) {
|
|
@@ -122,16 +198,33 @@ class Window extends EventTarget.EventTarget {
|
|
|
122
198
|
window[property] = globalThis;
|
|
123
199
|
}
|
|
124
200
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
201
|
+
Object.defineProperties(globalThis, globalPropertyDescriptors(window));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function installExtension(window, extension) {
|
|
205
|
+
window[constants.EXTENSIONS].push(extension(window) ?? {});
|
|
206
|
+
}
|
|
207
|
+
function createHooksDispatcher(window) {
|
|
208
|
+
return {
|
|
209
|
+
createElement: dispatchHook.bind(null, window, 'createElement'),
|
|
210
|
+
setAttribute: dispatchHook.bind(null, window, 'setAttribute'),
|
|
211
|
+
removeAttribute: dispatchHook.bind(null, window, 'removeAttribute'),
|
|
212
|
+
createText: dispatchHook.bind(null, window, 'createText'),
|
|
213
|
+
setText: dispatchHook.bind(null, window, 'setText'),
|
|
214
|
+
insertChild: dispatchHook.bind(null, window, 'insertChild'),
|
|
215
|
+
removeChild: dispatchHook.bind(null, window, 'removeChild'),
|
|
216
|
+
addEventListener: dispatchHook.bind(null, window, 'addEventListener'),
|
|
217
|
+
removeEventListener: dispatchHook.bind(null, window, 'removeEventListener')
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function dispatchHook(window, name, ...args) {
|
|
221
|
+
for (const hooks of window[constants.EXTENSIONS]) {
|
|
222
|
+
const hook = hooks[name];
|
|
223
|
+
hook?.apply(hooks, args);
|
|
134
224
|
}
|
|
225
|
+
const hooks = window[constants.HOOKS];
|
|
226
|
+
const legacyHook = hooks[name];
|
|
227
|
+
legacyHook?.apply(hooks, args);
|
|
135
228
|
}
|
|
136
229
|
|
|
137
230
|
exports.Window = Window;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const customElementReactions = require('./custom-element-reactions.cjs');
|
|
6
|
+
|
|
7
|
+
function enqueueAttributeReaction(element, localName, oldValue, newValue, namespace) {
|
|
8
|
+
const {
|
|
9
|
+
observedAttributes
|
|
10
|
+
} = element.constructor;
|
|
11
|
+
const {
|
|
12
|
+
attributeChangedCallback
|
|
13
|
+
} = element;
|
|
14
|
+
if (attributeChangedCallback == null || observedAttributes == null || !observedAttributes.includes(localName)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
customElementReactions.enqueueCustomElementReaction(element, () => attributeChangedCallback.call(element, localName, oldValue, newValue, namespace));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.enqueueAttributeReaction = enqueueAttributeReaction;
|
package/build/cjs/constants.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const NAME = Symbol('name');
|
|
6
|
+
const PREFIX = Symbol('prefix');
|
|
6
7
|
const VALUE = Symbol('value');
|
|
7
8
|
const NS = Symbol('ns');
|
|
8
9
|
const OWNER_ELEMENT = Symbol('owner');
|
|
@@ -12,54 +13,77 @@ const PREV = Symbol('prev');
|
|
|
12
13
|
const NEXT = Symbol('next');
|
|
13
14
|
const CHILD = Symbol('child');
|
|
14
15
|
const PARENT = Symbol('parent');
|
|
16
|
+
const HOST = Symbol('host');
|
|
15
17
|
const DATA = Symbol('data');
|
|
16
18
|
const LISTENERS = Symbol('listeners');
|
|
17
19
|
const IS_TRUSTED = Symbol('isTrusted');
|
|
18
20
|
const PATH = Symbol('path');
|
|
19
21
|
const STOP_IMMEDIATE_PROPAGATION = Symbol('stop_immediate_propagation');
|
|
22
|
+
const DISPATCHING = Symbol('dispatching');
|
|
20
23
|
const CONTENT = Symbol('content');
|
|
21
24
|
const HOOKS = Symbol('hooks');
|
|
25
|
+
const EXTENSIONS = Symbol('extensions');
|
|
26
|
+
const HOOKS_DISPATCH = Symbol('hooks_dispatch');
|
|
22
27
|
const IS_CONNECTED = Symbol('is_connected');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
}
|
|
28
|
+
const CREATE_ELEMENT = Symbol('create_element');
|
|
29
|
+
const NODE_TYPE_NODE = 0;
|
|
30
|
+
const NODE_TYPE_ELEMENT = 1;
|
|
31
|
+
const NODE_TYPE_ATTRIBUTE = 2;
|
|
32
|
+
const NODE_TYPE_TEXT = 3;
|
|
33
|
+
const NODE_TYPE_COMMENT = 8;
|
|
34
|
+
const NODE_TYPE_DOCUMENT = 9;
|
|
35
|
+
const NODE_TYPE_DOCUMENT_TYPE = 10;
|
|
36
|
+
const NODE_TYPE_DOCUMENT_FRAGMENT = 11;
|
|
37
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
38
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
39
|
+
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
40
|
+
const XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/';
|
|
41
|
+
function splitOnASCIIWhitespace(value) {
|
|
42
|
+
return value.split(/[\t\n\f\r ]+/).filter(Boolean);
|
|
43
|
+
}
|
|
44
|
+
function asciiLowercase(value) {
|
|
45
|
+
return value.replace(/[A-Z]/g, character => String.fromCharCode(character.charCodeAt(0) + 0x20));
|
|
46
|
+
}
|
|
47
|
+
function asciiUppercase(value) {
|
|
48
|
+
return value.replace(/[a-z]/g, character => String.fromCharCode(character.charCodeAt(0) - 0x20));
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
exports.ATTRIBUTES = ATTRIBUTES;
|
|
47
52
|
exports.CHILD = CHILD;
|
|
48
53
|
exports.CONTENT = CONTENT;
|
|
54
|
+
exports.CREATE_ELEMENT = CREATE_ELEMENT;
|
|
49
55
|
exports.DATA = DATA;
|
|
56
|
+
exports.DISPATCHING = DISPATCHING;
|
|
57
|
+
exports.EXTENSIONS = EXTENSIONS;
|
|
50
58
|
exports.HOOKS = HOOKS;
|
|
59
|
+
exports.HOOKS_DISPATCH = HOOKS_DISPATCH;
|
|
60
|
+
exports.HOST = HOST;
|
|
61
|
+
exports.HTML_NAMESPACE = HTML_NAMESPACE;
|
|
51
62
|
exports.IS_CONNECTED = IS_CONNECTED;
|
|
52
63
|
exports.IS_TRUSTED = IS_TRUSTED;
|
|
53
64
|
exports.LISTENERS = LISTENERS;
|
|
54
65
|
exports.NAME = NAME;
|
|
55
66
|
exports.NEXT = NEXT;
|
|
67
|
+
exports.NODE_TYPE_ATTRIBUTE = NODE_TYPE_ATTRIBUTE;
|
|
68
|
+
exports.NODE_TYPE_COMMENT = NODE_TYPE_COMMENT;
|
|
69
|
+
exports.NODE_TYPE_DOCUMENT = NODE_TYPE_DOCUMENT;
|
|
70
|
+
exports.NODE_TYPE_DOCUMENT_FRAGMENT = NODE_TYPE_DOCUMENT_FRAGMENT;
|
|
71
|
+
exports.NODE_TYPE_DOCUMENT_TYPE = NODE_TYPE_DOCUMENT_TYPE;
|
|
72
|
+
exports.NODE_TYPE_ELEMENT = NODE_TYPE_ELEMENT;
|
|
73
|
+
exports.NODE_TYPE_NODE = NODE_TYPE_NODE;
|
|
74
|
+
exports.NODE_TYPE_TEXT = NODE_TYPE_TEXT;
|
|
56
75
|
exports.NS = NS;
|
|
57
|
-
exports.NamespaceURI = NamespaceURI;
|
|
58
|
-
exports.NodeType = NodeType;
|
|
59
76
|
exports.OWNER_DOCUMENT = OWNER_DOCUMENT;
|
|
60
77
|
exports.OWNER_ELEMENT = OWNER_ELEMENT;
|
|
61
78
|
exports.PARENT = PARENT;
|
|
62
79
|
exports.PATH = PATH;
|
|
80
|
+
exports.PREFIX = PREFIX;
|
|
63
81
|
exports.PREV = PREV;
|
|
64
82
|
exports.STOP_IMMEDIATE_PROPAGATION = STOP_IMMEDIATE_PROPAGATION;
|
|
83
|
+
exports.SVG_NAMESPACE = SVG_NAMESPACE;
|
|
65
84
|
exports.VALUE = VALUE;
|
|
85
|
+
exports.XMLNS_NAMESPACE = XMLNS_NAMESPACE;
|
|
86
|
+
exports.XML_NAMESPACE = XML_NAMESPACE;
|
|
87
|
+
exports.asciiLowercase = asciiLowercase;
|
|
88
|
+
exports.asciiUppercase = asciiUppercase;
|
|
89
|
+
exports.splitOnASCIIWhitespace = splitOnASCIIWhitespace;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const scopes = [];
|
|
6
|
+
const reactionsByTarget = new WeakMap();
|
|
7
|
+
function enqueueCustomElementReaction(target, reaction) {
|
|
8
|
+
const reactions = reactionsByTarget.get(target);
|
|
9
|
+
if (reactions) reactions.push(reaction);else reactionsByTarget.set(target, [reaction]);
|
|
10
|
+
scopes[scopes.length - 1].push(target);
|
|
11
|
+
}
|
|
12
|
+
function performWithCustomElementReactions(mutation) {
|
|
13
|
+
const scope = [];
|
|
14
|
+
scopes.push(scope);
|
|
15
|
+
let result;
|
|
16
|
+
try {
|
|
17
|
+
result = mutation();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
scopes.pop();
|
|
20
|
+
try {
|
|
21
|
+
flushCustomElementReactions(scope);
|
|
22
|
+
} catch {}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
scopes.pop();
|
|
26
|
+
flushCustomElementReactions(scope);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
function flushCustomElementReactions(scope) {
|
|
30
|
+
let firstError;
|
|
31
|
+
let didThrow = false;
|
|
32
|
+
for (const target of scope) {
|
|
33
|
+
const reactions = reactionsByTarget.get(target);
|
|
34
|
+
if (!reactions) continue;
|
|
35
|
+
while (reactions.length > 0) {
|
|
36
|
+
const reaction = reactions.shift();
|
|
37
|
+
try {
|
|
38
|
+
reaction();
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (!didThrow) {
|
|
41
|
+
firstError = error;
|
|
42
|
+
didThrow = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
reactionsByTarget.delete(target);
|
|
47
|
+
}
|
|
48
|
+
if (didThrow) throw firstError;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.enqueueCustomElementReaction = enqueueCustomElementReaction;
|
|
52
|
+
exports.performWithCustomElementReactions = performWithCustomElementReactions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
function createDOMException(message, name) {
|
|
6
|
+
const DOMExceptionConstructor = globalThis.DOMException;
|
|
7
|
+
if (typeof DOMExceptionConstructor === 'function') {
|
|
8
|
+
return new DOMExceptionConstructor(message, name);
|
|
9
|
+
}
|
|
10
|
+
const error = new Error(message);
|
|
11
|
+
error.name = name;
|
|
12
|
+
return error;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.createDOMException = createDOMException;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const constants = require('./constants.cjs');
|
|
6
|
+
|
|
7
|
+
const hookEffects = [];
|
|
8
|
+
const pendingPublications = [];
|
|
9
|
+
let isDispatchingHookEffects = false;
|
|
10
|
+
function performHookEffects(effects) {
|
|
11
|
+
for (const effect of effects) {
|
|
12
|
+
hookEffects.push(effect);
|
|
13
|
+
if (effect[1]) pendingPublications.push(effect[1]);
|
|
14
|
+
}
|
|
15
|
+
if (isDispatchingHookEffects) return;
|
|
16
|
+
isDispatchingHookEffects = true;
|
|
17
|
+
try {
|
|
18
|
+
let firstError;
|
|
19
|
+
let didThrow = false;
|
|
20
|
+
for (let index = 0; index < hookEffects.length; index++) {
|
|
21
|
+
const [run, publication] = hookEffects[index];
|
|
22
|
+
if (publication) {
|
|
23
|
+
pendingPublications.splice(pendingPublications.indexOf(publication), 1);
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
run();
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (!didThrow) {
|
|
29
|
+
firstError = error;
|
|
30
|
+
didThrow = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (didThrow) throw firstError;
|
|
35
|
+
} finally {
|
|
36
|
+
hookEffects.length = 0;
|
|
37
|
+
pendingPublications.length = 0;
|
|
38
|
+
isDispatchingHookEffects = false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isCoveredByPendingPublication(node) {
|
|
42
|
+
let current = node;
|
|
43
|
+
while (current) {
|
|
44
|
+
if (pendingPublications.includes(current)) return true;
|
|
45
|
+
current = current[constants.PARENT] ?? current[constants.HOST];
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.isCoveredByPendingPublication = isCoveredByPendingPublication;
|
|
51
|
+
exports.performHookEffects = performHookEffects;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const constants = require('./constants.cjs');
|
|
6
|
+
const domException = require('./dom-exception.cjs');
|
|
7
|
+
|
|
8
|
+
const VALID_ELEMENT_LOCAL_NAME = /^(?:[A-Za-z][^\0\t\n\f\r\u0020/>]*|[:_\u0080-\u{10FFFF}][A-Za-z0-9-.:_\u0080-\u{10FFFF}]*)$/u;
|
|
9
|
+
const INVALID_ATTRIBUTE_LOCAL_NAME = /[\0\t\n\f\r />=]/u;
|
|
10
|
+
const INVALID_NAMESPACE_PREFIX = /[\0\t\n\f\r />]/u;
|
|
11
|
+
function normalizeNamespace(namespace) {
|
|
12
|
+
if (namespace == null) return null;
|
|
13
|
+
const normalized = String(namespace);
|
|
14
|
+
return normalized === '' ? null : normalized;
|
|
15
|
+
}
|
|
16
|
+
function validateElementLocalName(name) {
|
|
17
|
+
if (!VALID_ELEMENT_LOCAL_NAME.test(name)) {
|
|
18
|
+
throwInvalidCharacterError(name);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function validateAttributeLocalName(name) {
|
|
22
|
+
if (name === '' || INVALID_ATTRIBUTE_LOCAL_NAME.test(name)) {
|
|
23
|
+
throwInvalidCharacterError(name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function validateAndExtractQualifiedName(namespaceValue, qualifiedNameValue, kind) {
|
|
27
|
+
const namespace = normalizeNamespace(namespaceValue);
|
|
28
|
+
const qualifiedName = String(qualifiedNameValue);
|
|
29
|
+
const separator = qualifiedName.indexOf(':');
|
|
30
|
+
const prefix = separator < 0 ? null : qualifiedName.slice(0, separator);
|
|
31
|
+
const localName = separator < 0 ? qualifiedName : qualifiedName.slice(separator + 1);
|
|
32
|
+
if (prefix != null && (prefix === '' || INVALID_NAMESPACE_PREFIX.test(prefix)) || (kind === 'element' ? !VALID_ELEMENT_LOCAL_NAME.test(localName) : localName === '' || INVALID_ATTRIBUTE_LOCAL_NAME.test(localName))) {
|
|
33
|
+
throwInvalidCharacterError(qualifiedName);
|
|
34
|
+
}
|
|
35
|
+
if (prefix != null && namespace == null) {
|
|
36
|
+
throw domException.createDOMException(`A namespace is required for the prefix in "${qualifiedName}"`, 'NamespaceError');
|
|
37
|
+
}
|
|
38
|
+
if (prefix === 'xml' && namespace !== constants.XML_NAMESPACE) {
|
|
39
|
+
throw domException.createDOMException(`The xml prefix requires the XML namespace`, 'NamespaceError');
|
|
40
|
+
}
|
|
41
|
+
if ((qualifiedName === 'xmlns' || prefix === 'xmlns') && namespace !== constants.XMLNS_NAMESPACE) {
|
|
42
|
+
throw domException.createDOMException(`The xmlns name requires the XMLNS namespace`, 'NamespaceError');
|
|
43
|
+
}
|
|
44
|
+
if (namespace === constants.XMLNS_NAMESPACE && qualifiedName !== 'xmlns' && prefix !== 'xmlns') {
|
|
45
|
+
throw domException.createDOMException(`The XMLNS namespace requires the xmlns name or prefix`, 'NamespaceError');
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
namespace,
|
|
49
|
+
qualifiedName,
|
|
50
|
+
prefix,
|
|
51
|
+
localName
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function throwInvalidCharacterError(name) {
|
|
55
|
+
throw domException.createDOMException(`Invalid name: "${name}"`, 'InvalidCharacterError');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.normalizeNamespace = normalizeNamespace;
|
|
59
|
+
exports.validateAndExtractQualifiedName = validateAndExtractQualifiedName;
|
|
60
|
+
exports.validateAttributeLocalName = validateAttributeLocalName;
|
|
61
|
+
exports.validateElementLocalName = validateElementLocalName;
|