defuddle-cli 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom/document.d.ts +3 -0
- package/dist/dom/document.js +49 -0
- package/dist/dom/elements.d.ts +2 -0
- package/dist/dom/elements.js +478 -0
- package/dist/dom/interfaces/elements/base.d.ts +14 -0
- package/dist/dom/interfaces/elements/base.js +46 -0
- package/dist/dom/interfaces/elements/form.d.ts +2 -0
- package/dist/dom/interfaces/elements/form.js +123 -0
- package/dist/dom/interfaces/elements/index.d.ts +2 -0
- package/dist/dom/interfaces/elements/index.js +22 -0
- package/dist/dom/interfaces/elements/interactive.d.ts +2 -0
- package/dist/dom/interfaces/elements/interactive.js +83 -0
- package/dist/dom/interfaces/elements/media.d.ts +2 -0
- package/dist/dom/interfaces/elements/media.js +43 -0
- package/dist/dom/interfaces/elements/table.d.ts +2 -0
- package/dist/dom/interfaces/elements/table.js +155 -0
- package/dist/dom/interfaces/elements/text.d.ts +2 -0
- package/dist/dom/interfaces/elements/text.js +57 -0
- package/dist/dom/interfaces/elements.d.ts +2 -0
- package/dist/dom/interfaces/elements.js +478 -0
- package/dist/dom/interfaces/range.d.ts +1 -1
- package/dist/dom/range.d.ts +2 -0
- package/dist/dom/range.js +87 -0
- package/dist/dom/setup/document.d.ts +3 -0
- package/dist/dom/setup/document.js +49 -0
- package/dist/dom/setup.d.ts +12 -9
- package/dist/dom/setup.js +148 -533
- package/dist/dom/types/setup.d.ts +10 -0
- package/dist/dom/types/setup.js +1 -0
- package/dist/index.js +9 -684
- package/package.json +3 -5
- package/src/index.ts +9 -772
- package/src/dom/interfaces/document.ts +0 -53
- package/src/dom/interfaces/range.ts +0 -120
- package/src/dom/interfaces/setup.ts +0 -196
- package/src/markdown.ts +0 -592
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export function setupFormElements(window) {
|
|
2
|
+
// HTMLButtonElement
|
|
3
|
+
const HTMLButtonElementClass = class extends globalThis.HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.disabled = false;
|
|
7
|
+
this.form = null;
|
|
8
|
+
this.formAction = '';
|
|
9
|
+
this.formEnctype = '';
|
|
10
|
+
this.formMethod = '';
|
|
11
|
+
this.formNoValidate = false;
|
|
12
|
+
this.formTarget = '';
|
|
13
|
+
this.name = '';
|
|
14
|
+
this.type = 'submit';
|
|
15
|
+
this.value = '';
|
|
16
|
+
this.menu = null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
// HTMLFormElement
|
|
20
|
+
const HTMLFormElementClass = class extends globalThis.HTMLElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.acceptCharset = '';
|
|
24
|
+
this.action = '';
|
|
25
|
+
this.autocomplete = '';
|
|
26
|
+
this.enctype = '';
|
|
27
|
+
this.encoding = '';
|
|
28
|
+
this.method = '';
|
|
29
|
+
this.name = '';
|
|
30
|
+
this.noValidate = false;
|
|
31
|
+
this.target = '';
|
|
32
|
+
this.elements = {
|
|
33
|
+
length: 0,
|
|
34
|
+
item: () => null,
|
|
35
|
+
namedItem: () => null,
|
|
36
|
+
[Symbol.iterator]: function* () { yield null; return undefined; }
|
|
37
|
+
};
|
|
38
|
+
this.length = 0;
|
|
39
|
+
}
|
|
40
|
+
submit() { }
|
|
41
|
+
reset() { }
|
|
42
|
+
checkValidity() { return true; }
|
|
43
|
+
reportValidity() { return true; }
|
|
44
|
+
};
|
|
45
|
+
// HTMLInputElement
|
|
46
|
+
const HTMLInputElementClass = class extends globalThis.HTMLElement {
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
this.accept = '';
|
|
50
|
+
this.alt = '';
|
|
51
|
+
this.autocomplete = '';
|
|
52
|
+
this.autofocus = false;
|
|
53
|
+
this.defaultChecked = false;
|
|
54
|
+
this.checked = false;
|
|
55
|
+
this.dirName = '';
|
|
56
|
+
this.disabled = false;
|
|
57
|
+
this.form = null;
|
|
58
|
+
this.files = null;
|
|
59
|
+
this.formAction = '';
|
|
60
|
+
this.formEnctype = '';
|
|
61
|
+
this.formMethod = '';
|
|
62
|
+
this.formNoValidate = false;
|
|
63
|
+
this.formTarget = '';
|
|
64
|
+
this.height = 0;
|
|
65
|
+
this.indeterminate = false;
|
|
66
|
+
this.list = null;
|
|
67
|
+
this.max = '';
|
|
68
|
+
this.maxLength = -1;
|
|
69
|
+
this.min = '';
|
|
70
|
+
this.minLength = -1;
|
|
71
|
+
this.multiple = false;
|
|
72
|
+
this.name = '';
|
|
73
|
+
this.pattern = '';
|
|
74
|
+
this.placeholder = '';
|
|
75
|
+
this.readOnly = false;
|
|
76
|
+
this.required = false;
|
|
77
|
+
this.size = 0;
|
|
78
|
+
this.src = '';
|
|
79
|
+
this.step = '';
|
|
80
|
+
this.type = 'text';
|
|
81
|
+
this.defaultValue = '';
|
|
82
|
+
this.value = '';
|
|
83
|
+
this.valueAsDate = null;
|
|
84
|
+
this.valueAsNumber = 0;
|
|
85
|
+
this.width = 0;
|
|
86
|
+
this.willValidate = false;
|
|
87
|
+
this.validity = {
|
|
88
|
+
badInput: false,
|
|
89
|
+
customError: false,
|
|
90
|
+
patternMismatch: false,
|
|
91
|
+
rangeOverflow: false,
|
|
92
|
+
rangeUnderflow: false,
|
|
93
|
+
stepMismatch: false,
|
|
94
|
+
tooLong: false,
|
|
95
|
+
tooShort: false,
|
|
96
|
+
typeMismatch: false,
|
|
97
|
+
valid: true,
|
|
98
|
+
valueMissing: false
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
stepUp(n) { }
|
|
102
|
+
stepDown(n) { }
|
|
103
|
+
checkValidity() { return true; }
|
|
104
|
+
reportValidity() { return true; }
|
|
105
|
+
select() { }
|
|
106
|
+
setRangeText(replacement, start, end, selectionMode) { }
|
|
107
|
+
setCustomValidity(error) { }
|
|
108
|
+
};
|
|
109
|
+
// Define globally
|
|
110
|
+
globalThis.HTMLButtonElement = HTMLButtonElementClass;
|
|
111
|
+
globalThis.HTMLFormElement = HTMLFormElementClass;
|
|
112
|
+
globalThis.HTMLInputElement = HTMLInputElementClass;
|
|
113
|
+
// Assign to window if not already present
|
|
114
|
+
if (!window.HTMLButtonElement) {
|
|
115
|
+
window.HTMLButtonElement = HTMLButtonElementClass;
|
|
116
|
+
}
|
|
117
|
+
if (!window.HTMLFormElement) {
|
|
118
|
+
window.HTMLFormElement = HTMLFormElementClass;
|
|
119
|
+
}
|
|
120
|
+
if (!window.HTMLInputElement) {
|
|
121
|
+
window.HTMLInputElement = HTMLInputElementClass;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { setupBaseElements } from './base.js';
|
|
2
|
+
import { setupMediaElements } from './media.js';
|
|
3
|
+
import { setupTableElements } from './table.js';
|
|
4
|
+
import { setupFormElements } from './form.js';
|
|
5
|
+
import { setupTextElements } from './text.js';
|
|
6
|
+
import { setupInteractiveElements } from './interactive.js';
|
|
7
|
+
export function setupElements(window) {
|
|
8
|
+
// First set up base elements which define HTMLElement
|
|
9
|
+
setupBaseElements(window);
|
|
10
|
+
// Then set up all other elements that extend from HTMLElement
|
|
11
|
+
// We need to ensure HTMLElement is available in globalThis
|
|
12
|
+
if (!globalThis.HTMLElement) {
|
|
13
|
+
globalThis.HTMLElement = window.HTMLElement;
|
|
14
|
+
}
|
|
15
|
+
// Now we can safely set up all other elements
|
|
16
|
+
setupMediaElements(window);
|
|
17
|
+
setupTableElements(window);
|
|
18
|
+
setupFormElements(window);
|
|
19
|
+
setupTextElements(window);
|
|
20
|
+
setupInteractiveElements(window);
|
|
21
|
+
// Add other element setup functions as they are created
|
|
22
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export function setupInteractiveElements(window) {
|
|
2
|
+
// HTMLAnchorElement
|
|
3
|
+
const HTMLAnchorElementClass = class extends globalThis.HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.href = '';
|
|
7
|
+
this.target = '';
|
|
8
|
+
this.download = '';
|
|
9
|
+
this.ping = '';
|
|
10
|
+
this.rel = '';
|
|
11
|
+
this.relList = {
|
|
12
|
+
length: 0,
|
|
13
|
+
value: '',
|
|
14
|
+
add: () => { },
|
|
15
|
+
contains: () => false,
|
|
16
|
+
item: () => null,
|
|
17
|
+
remove: () => { },
|
|
18
|
+
replace: () => false,
|
|
19
|
+
supports: () => false,
|
|
20
|
+
toggle: () => false,
|
|
21
|
+
[Symbol.iterator]: function* () { yield ''; return undefined; }
|
|
22
|
+
};
|
|
23
|
+
this.hreflang = '';
|
|
24
|
+
this.type = '';
|
|
25
|
+
this.text = '';
|
|
26
|
+
this.referrerPolicy = '';
|
|
27
|
+
this.origin = '';
|
|
28
|
+
this.protocol = '';
|
|
29
|
+
this.username = '';
|
|
30
|
+
this.password = '';
|
|
31
|
+
this.host = '';
|
|
32
|
+
this.hostname = '';
|
|
33
|
+
this.port = '';
|
|
34
|
+
this.pathname = '';
|
|
35
|
+
this.search = '';
|
|
36
|
+
this.hash = '';
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// HTMLIFrameElement
|
|
40
|
+
const HTMLIFrameElementClass = class extends globalThis.HTMLElement {
|
|
41
|
+
constructor() {
|
|
42
|
+
super();
|
|
43
|
+
this.align = '';
|
|
44
|
+
this.allow = '';
|
|
45
|
+
this.allowFullscreen = false;
|
|
46
|
+
this.contentDocument = null;
|
|
47
|
+
this.contentWindow = null;
|
|
48
|
+
this.frameBorder = '';
|
|
49
|
+
this.height = '';
|
|
50
|
+
this.longDesc = '';
|
|
51
|
+
this.marginHeight = '';
|
|
52
|
+
this.marginWidth = '';
|
|
53
|
+
this.name = '';
|
|
54
|
+
this.referrerPolicy = '';
|
|
55
|
+
this.sandbox = {
|
|
56
|
+
length: 0,
|
|
57
|
+
value: '',
|
|
58
|
+
add: () => { },
|
|
59
|
+
contains: () => false,
|
|
60
|
+
item: () => null,
|
|
61
|
+
remove: () => { },
|
|
62
|
+
replace: () => false,
|
|
63
|
+
supports: () => false,
|
|
64
|
+
toggle: () => false,
|
|
65
|
+
[Symbol.iterator]: function* () { yield ''; return undefined; }
|
|
66
|
+
};
|
|
67
|
+
this.scrolling = '';
|
|
68
|
+
this.src = '';
|
|
69
|
+
this.srcdoc = '';
|
|
70
|
+
this.width = '';
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// Define globally
|
|
74
|
+
globalThis.HTMLAnchorElement = HTMLAnchorElementClass;
|
|
75
|
+
globalThis.HTMLIFrameElement = HTMLIFrameElementClass;
|
|
76
|
+
// Assign to window if not already present
|
|
77
|
+
if (!window.HTMLAnchorElement) {
|
|
78
|
+
window.HTMLAnchorElement = HTMLAnchorElementClass;
|
|
79
|
+
}
|
|
80
|
+
if (!window.HTMLIFrameElement) {
|
|
81
|
+
window.HTMLIFrameElement = HTMLIFrameElementClass;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function setupMediaElements(window) {
|
|
2
|
+
// Define HTMLImageElement globally
|
|
3
|
+
const HTMLImageElementClass = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.alt = '';
|
|
6
|
+
this.src = '';
|
|
7
|
+
this.srcset = '';
|
|
8
|
+
this.sizes = '';
|
|
9
|
+
this.crossOrigin = null;
|
|
10
|
+
this.useMap = '';
|
|
11
|
+
this.isMap = false;
|
|
12
|
+
this.width = 0;
|
|
13
|
+
this.height = 0;
|
|
14
|
+
this.naturalWidth = 0;
|
|
15
|
+
this.naturalHeight = 0;
|
|
16
|
+
this.complete = false;
|
|
17
|
+
this.name = '';
|
|
18
|
+
this.lowsrc = '';
|
|
19
|
+
this.align = '';
|
|
20
|
+
this.hspace = 0;
|
|
21
|
+
this.vspace = 0;
|
|
22
|
+
this.longDesc = '';
|
|
23
|
+
this.border = '';
|
|
24
|
+
this.x = 0;
|
|
25
|
+
this.y = 0;
|
|
26
|
+
this.currentSrc = '';
|
|
27
|
+
this.decoding = 'auto';
|
|
28
|
+
this.fetchPriority = 'auto';
|
|
29
|
+
this.loading = 'eager';
|
|
30
|
+
this.referrerPolicy = '';
|
|
31
|
+
// Initialize any required properties
|
|
32
|
+
}
|
|
33
|
+
decode() {
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// Define globally
|
|
38
|
+
globalThis.HTMLImageElement = HTMLImageElementClass;
|
|
39
|
+
// Assign to window if not already present
|
|
40
|
+
if (!window.HTMLImageElement) {
|
|
41
|
+
window.HTMLImageElement = HTMLImageElementClass;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export function setupTableElements(window) {
|
|
2
|
+
// HTMLTableElement
|
|
3
|
+
const HTMLTableElementClass = class extends globalThis.HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.caption = null;
|
|
7
|
+
this.tHead = null;
|
|
8
|
+
this.tFoot = null;
|
|
9
|
+
this.tBodies = {
|
|
10
|
+
length: 0,
|
|
11
|
+
item: () => null,
|
|
12
|
+
namedItem: () => null,
|
|
13
|
+
[Symbol.iterator]: function* () { yield null; return undefined; }
|
|
14
|
+
};
|
|
15
|
+
this.rows = {
|
|
16
|
+
length: 0,
|
|
17
|
+
item: () => null,
|
|
18
|
+
namedItem: () => null,
|
|
19
|
+
[Symbol.iterator]: function* () { yield null; return undefined; }
|
|
20
|
+
};
|
|
21
|
+
this.align = '';
|
|
22
|
+
this.bgColor = '';
|
|
23
|
+
this.border = '';
|
|
24
|
+
this.cellPadding = '';
|
|
25
|
+
this.cellSpacing = '';
|
|
26
|
+
this.frame = '';
|
|
27
|
+
this.rules = '';
|
|
28
|
+
this.summary = '';
|
|
29
|
+
this.width = '';
|
|
30
|
+
}
|
|
31
|
+
createCaption() {
|
|
32
|
+
return new globalThis.HTMLTableCaptionElement();
|
|
33
|
+
}
|
|
34
|
+
deleteCaption() { }
|
|
35
|
+
createTHead() {
|
|
36
|
+
return new globalThis.HTMLTableSectionElement();
|
|
37
|
+
}
|
|
38
|
+
deleteTHead() { }
|
|
39
|
+
createTFoot() {
|
|
40
|
+
return new globalThis.HTMLTableSectionElement();
|
|
41
|
+
}
|
|
42
|
+
deleteTFoot() { }
|
|
43
|
+
createTBody() {
|
|
44
|
+
return new globalThis.HTMLTableSectionElement();
|
|
45
|
+
}
|
|
46
|
+
insertRow(index) {
|
|
47
|
+
return new globalThis.HTMLTableRowElement();
|
|
48
|
+
}
|
|
49
|
+
deleteRow(index) { }
|
|
50
|
+
};
|
|
51
|
+
// HTMLTableRowElement
|
|
52
|
+
const HTMLTableRowElementClass = class extends globalThis.HTMLElement {
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
this.rowIndex = 0;
|
|
56
|
+
this.sectionRowIndex = 0;
|
|
57
|
+
this.cells = {
|
|
58
|
+
length: 0,
|
|
59
|
+
item: () => null,
|
|
60
|
+
namedItem: () => null,
|
|
61
|
+
[Symbol.iterator]: function* () { yield null; return undefined; }
|
|
62
|
+
};
|
|
63
|
+
this.align = '';
|
|
64
|
+
this.bgColor = '';
|
|
65
|
+
this.ch = '';
|
|
66
|
+
this.chOff = '';
|
|
67
|
+
this.vAlign = '';
|
|
68
|
+
}
|
|
69
|
+
insertCell(index) {
|
|
70
|
+
return new globalThis.HTMLTableCellElement();
|
|
71
|
+
}
|
|
72
|
+
deleteCell(index) { }
|
|
73
|
+
};
|
|
74
|
+
// HTMLTableCellElement
|
|
75
|
+
const HTMLTableCellElementClass = class extends globalThis.HTMLElement {
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
78
|
+
this.colSpan = 1;
|
|
79
|
+
this.rowSpan = 1;
|
|
80
|
+
this.headers = {
|
|
81
|
+
length: 0,
|
|
82
|
+
value: '',
|
|
83
|
+
add: () => { },
|
|
84
|
+
contains: () => false,
|
|
85
|
+
item: () => null,
|
|
86
|
+
remove: () => { },
|
|
87
|
+
replace: () => false,
|
|
88
|
+
supports: () => false,
|
|
89
|
+
toggle: () => false,
|
|
90
|
+
[Symbol.iterator]: function* () { yield ''; return undefined; }
|
|
91
|
+
};
|
|
92
|
+
this.cellIndex = 0;
|
|
93
|
+
this.scope = '';
|
|
94
|
+
this.abbr = '';
|
|
95
|
+
this.align = '';
|
|
96
|
+
this.axis = '';
|
|
97
|
+
this.bgColor = '';
|
|
98
|
+
this.ch = '';
|
|
99
|
+
this.chOff = '';
|
|
100
|
+
this.height = '';
|
|
101
|
+
this.noWrap = false;
|
|
102
|
+
this.vAlign = '';
|
|
103
|
+
this.width = '';
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
// HTMLTableSectionElement
|
|
107
|
+
const HTMLTableSectionElementClass = class extends globalThis.HTMLElement {
|
|
108
|
+
constructor() {
|
|
109
|
+
super();
|
|
110
|
+
this.rows = {
|
|
111
|
+
length: 0,
|
|
112
|
+
item: () => null,
|
|
113
|
+
namedItem: () => null,
|
|
114
|
+
[Symbol.iterator]: function* () { yield null; return undefined; }
|
|
115
|
+
};
|
|
116
|
+
this.align = '';
|
|
117
|
+
this.ch = '';
|
|
118
|
+
this.chOff = '';
|
|
119
|
+
this.vAlign = '';
|
|
120
|
+
}
|
|
121
|
+
insertRow(index) {
|
|
122
|
+
return new globalThis.HTMLTableRowElement();
|
|
123
|
+
}
|
|
124
|
+
deleteRow(index) { }
|
|
125
|
+
};
|
|
126
|
+
// HTMLTableCaptionElement
|
|
127
|
+
const HTMLTableCaptionElementClass = class extends globalThis.HTMLElement {
|
|
128
|
+
constructor() {
|
|
129
|
+
super();
|
|
130
|
+
this.align = '';
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
// Define globally
|
|
134
|
+
globalThis.HTMLTableElement = HTMLTableElementClass;
|
|
135
|
+
globalThis.HTMLTableRowElement = HTMLTableRowElementClass;
|
|
136
|
+
globalThis.HTMLTableCellElement = HTMLTableCellElementClass;
|
|
137
|
+
globalThis.HTMLTableSectionElement = HTMLTableSectionElementClass;
|
|
138
|
+
globalThis.HTMLTableCaptionElement = HTMLTableCaptionElementClass;
|
|
139
|
+
// Assign to window if not already present
|
|
140
|
+
if (!window.HTMLTableElement) {
|
|
141
|
+
window.HTMLTableElement = HTMLTableElementClass;
|
|
142
|
+
}
|
|
143
|
+
if (!window.HTMLTableRowElement) {
|
|
144
|
+
window.HTMLTableRowElement = HTMLTableRowElementClass;
|
|
145
|
+
}
|
|
146
|
+
if (!window.HTMLTableCellElement) {
|
|
147
|
+
window.HTMLTableCellElement = HTMLTableCellElementClass;
|
|
148
|
+
}
|
|
149
|
+
if (!window.HTMLTableSectionElement) {
|
|
150
|
+
window.HTMLTableSectionElement = HTMLTableSectionElementClass;
|
|
151
|
+
}
|
|
152
|
+
if (!window.HTMLTableCaptionElement) {
|
|
153
|
+
window.HTMLTableCaptionElement = HTMLTableCaptionElementClass;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function setupTextElements(window) {
|
|
2
|
+
// HTMLSpanElement
|
|
3
|
+
const HTMLSpanElementClass = class extends globalThis.HTMLElement {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
// HTMLDivElement
|
|
9
|
+
const HTMLDivElementClass = class extends globalThis.HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.align = '';
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
// HTMLParagraphElement
|
|
16
|
+
const HTMLParagraphElementClass = class extends globalThis.HTMLElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.align = '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
// HTMLHeadingElement
|
|
23
|
+
const HTMLHeadingElementClass = class extends globalThis.HTMLElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// HTMLPreElement
|
|
29
|
+
const HTMLPreElementClass = class extends globalThis.HTMLElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.width = 0;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
// Define globally
|
|
36
|
+
globalThis.HTMLSpanElement = HTMLSpanElementClass;
|
|
37
|
+
globalThis.HTMLDivElement = HTMLDivElementClass;
|
|
38
|
+
globalThis.HTMLParagraphElement = HTMLParagraphElementClass;
|
|
39
|
+
globalThis.HTMLHeadingElement = HTMLHeadingElementClass;
|
|
40
|
+
globalThis.HTMLPreElement = HTMLPreElementClass;
|
|
41
|
+
// Assign to window if not already present
|
|
42
|
+
if (!window.HTMLSpanElement) {
|
|
43
|
+
window.HTMLSpanElement = HTMLSpanElementClass;
|
|
44
|
+
}
|
|
45
|
+
if (!window.HTMLDivElement) {
|
|
46
|
+
window.HTMLDivElement = HTMLDivElementClass;
|
|
47
|
+
}
|
|
48
|
+
if (!window.HTMLParagraphElement) {
|
|
49
|
+
window.HTMLParagraphElement = HTMLParagraphElementClass;
|
|
50
|
+
}
|
|
51
|
+
if (!window.HTMLHeadingElement) {
|
|
52
|
+
window.HTMLHeadingElement = HTMLHeadingElementClass;
|
|
53
|
+
}
|
|
54
|
+
if (!window.HTMLPreElement) {
|
|
55
|
+
window.HTMLPreElement = HTMLPreElementClass;
|
|
56
|
+
}
|
|
57
|
+
}
|