@dooboostore/dom-parser 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/DomParser.js +33 -12
  2. package/dist/cjs/DomParser.js.map +2 -2
  3. package/dist/cjs/node/DocumentBase.js +4 -0
  4. package/dist/cjs/node/DocumentBase.js.map +2 -2
  5. package/dist/cjs/node/elements/Element.js.map +1 -1
  6. package/dist/cjs/node/elements/ElementBase.js +12 -2
  7. package/dist/cjs/node/elements/ElementBase.js.map +2 -2
  8. package/dist/cjs/node/elements/HTMLElement.js.map +1 -1
  9. package/dist/cjs/node/elements/HTMLElementBase.js +154 -2
  10. package/dist/cjs/node/elements/HTMLElementBase.js.map +2 -2
  11. package/dist/cjs/window/WindowBase.js +128 -7
  12. package/dist/cjs/window/WindowBase.js.map +2 -2
  13. package/dist/esm/DomParser.js +33 -12
  14. package/dist/esm/DomParser.js.map +2 -2
  15. package/dist/esm/node/DocumentBase.js +4 -0
  16. package/dist/esm/node/DocumentBase.js.map +2 -2
  17. package/dist/esm/node/elements/ElementBase.js +12 -2
  18. package/dist/esm/node/elements/ElementBase.js.map +2 -2
  19. package/dist/esm/node/elements/HTMLElementBase.js +154 -2
  20. package/dist/esm/node/elements/HTMLElementBase.js.map +2 -2
  21. package/dist/esm/window/WindowBase.js +128 -7
  22. package/dist/esm/window/WindowBase.js.map +2 -2
  23. package/dist/esm-bundle/dooboostore-dom-parser.esm.js +504 -195
  24. package/dist/esm-bundle/dooboostore-dom-parser.esm.js.map +3 -3
  25. package/dist/types/DomParser.d.ts +4 -0
  26. package/dist/types/DomParser.d.ts.map +1 -1
  27. package/dist/types/node/DocumentBase.d.ts +2 -0
  28. package/dist/types/node/DocumentBase.d.ts.map +1 -1
  29. package/dist/types/node/elements/Element.d.ts +1 -0
  30. package/dist/types/node/elements/Element.d.ts.map +1 -1
  31. package/dist/types/node/elements/ElementBase.d.ts +2 -2
  32. package/dist/types/node/elements/ElementBase.d.ts.map +1 -1
  33. package/dist/types/node/elements/HTMLElement.d.ts +32 -1
  34. package/dist/types/node/elements/HTMLElement.d.ts.map +1 -1
  35. package/dist/types/node/elements/HTMLElementBase.d.ts +11 -2
  36. package/dist/types/node/elements/HTMLElementBase.d.ts.map +1 -1
  37. package/dist/types/window/WindowBase.d.ts +12 -2
  38. package/dist/types/window/WindowBase.d.ts.map +1 -1
  39. package/dist/umd-bundle/dooboostore-dom-parser.umd.js +504 -195
  40. package/dist/umd-bundle/dooboostore-dom-parser.umd.js.map +3 -3
  41. package/package.json +1 -1
  42. package/src/DomParser.ts +457 -436
  43. package/src/node/DocumentBase.ts +7 -2
  44. package/src/node/elements/Element.ts +24 -23
  45. package/src/node/elements/ElementBase.ts +50 -41
  46. package/src/node/elements/HTMLElement.ts +36 -1
  47. package/src/node/elements/HTMLElementBase.ts +191 -5
  48. package/src/window/WindowBase.ts +1128 -919
@@ -20,49 +20,70 @@ __export(DomParser_exports, {
20
20
  DomParser: () => DomParser
21
21
  });
22
22
  module.exports = __toCommonJS(DomParser_exports);
23
- var import_DocumentBase = require("./node/DocumentBase");
24
23
  var import_TextBase = require("./node/TextBase");
25
24
  var import_Comment = require("./node/Comment");
26
25
  var import_WindowBase = require("./window/WindowBase");
27
26
  class DomParser {
28
27
  constructor(html, option) {
29
- const document = new import_DocumentBase.DocumentBase();
30
- const windowBase = new import_WindowBase.WindowBase(document, option?.href);
28
+ const windowBase = new import_WindowBase.WindowBase({ initialUrl: option?.href });
31
29
  this._window = windowBase;
32
- this._document = document;
30
+ this._document = windowBase.document;
33
31
  this.parseHTML(html);
34
32
  this.setupDocumentReferences();
35
- if (document && document.simulateLoading) {
36
- document.simulateLoading();
33
+ if (this._document && this._document.simulateLoading) {
34
+ this._document.simulateLoading();
37
35
  }
38
36
  }
39
37
  get window() {
38
+ if (!this._window) {
39
+ throw new Error("DomParser has been destroyed");
40
+ }
40
41
  return this._window;
41
42
  }
42
43
  get document() {
44
+ if (!this._document) {
45
+ throw new Error("DomParser has been destroyed");
46
+ }
43
47
  return this._document;
44
48
  }
49
+ /**
50
+ * Destroy the DomParser instance and free memory
51
+ */
52
+ destroy() {
53
+ if (this._window) {
54
+ this._window.close();
55
+ this._window = null;
56
+ }
57
+ this._document = null;
58
+ }
45
59
  /**
46
60
  * Load new HTML content and replace the current document
47
61
  */
48
62
  loadHTML(html) {
63
+ if (!this._document) {
64
+ throw new Error("DomParser has been destroyed");
65
+ }
49
66
  this.clearDocument();
50
67
  this.parseHTML(html);
51
68
  this.setupDocumentReferences();
52
69
  }
53
70
  clearDocument() {
54
- if (this.document.head) {
55
- while (this.document.head.firstChild) {
56
- this.document.head.removeChild(this.document.head.firstChild);
71
+ if (!this._document) return;
72
+ if (this._document.head) {
73
+ while (this._document.head.firstChild) {
74
+ this._document.head.removeChild(this._document.head.firstChild);
57
75
  }
58
76
  }
59
- if (this.document.body) {
60
- while (this.document.body.firstChild) {
61
- this.document.body.removeChild(this.document.body.firstChild);
77
+ if (this._document.body) {
78
+ while (this._document.body.firstChild) {
79
+ this._document.body.removeChild(this._document.body.firstChild);
62
80
  }
63
81
  }
64
82
  }
65
83
  parseHTML(html) {
84
+ if (!this._document) {
85
+ throw new Error("DomParser has been destroyed");
86
+ }
66
87
  if (!html.trim()) {
67
88
  return;
68
89
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DomParser.ts"],
4
- "sourcesContent": ["import { DocumentBase } from './node/DocumentBase';\nimport { TextBase } from './node/TextBase';\nimport { Comment } from './node/Comment';\nimport { WindowBase } from './window/WindowBase';\n\nexport interface DomParserOptions {\n href?: string;\n}\n\nexport class DomParser {\n private _window: Window;\n private _document: Document;\n\n constructor(html: string, option?: DomParserOptions) {\n // Create a new document instance\n const document = new DocumentBase();\n\n // Create WindowBase instance with the document\n const windowBase = new WindowBase(document, option?.href);\n \n this._window = windowBase as unknown as Window;\n this._document = document as any;\n\n // Parse the provided HTML string\n this.parseHTML(html);\n \n // Set up document references after parsing\n this.setupDocumentReferences();\n \n // Simulate document loading process\n if (document && (document as any).simulateLoading) {\n (document as any).simulateLoading();\n }\n }\n\n get window(): Window {\n return this._window;\n }\n\n get document(): Document {\n return this._document;\n }\n /**\n * Load new HTML content and replace the current document\n */\n loadHTML(html: string): void {\n // Clear current document content\n this.clearDocument();\n \n // Parse new HTML\n this.parseHTML(html);\n \n // Set up document references after parsing\n this.setupDocumentReferences();\n }\n\n private clearDocument(): void {\n // Clear document body and head content while preserving structure\n if (this.document.head) {\n while (this.document.head.firstChild) {\n this.document.head.removeChild(this.document.head.firstChild);\n }\n }\n \n if (this.document.body) {\n while (this.document.body.firstChild) {\n this.document.body.removeChild(this.document.body.firstChild);\n }\n }\n }\n\n parseHTML(html: string): void {\n // Simple HTML parsing implementation\n if (!html.trim()) {\n return;\n }\n\n // Basic HTML parsing - this is a simplified version\n // In a real implementation, you'd use a proper HTML parser\n this.parseHTMLString(html, this.document);\n }\n\n private parseHTMLString(html: string, parent: any): void {\n // Remove DOCTYPE if present\n html = html.replace(/<!DOCTYPE[^>]*>/i, '').trim();\n\n if (!html) return;\n\n // Handle template tags specially\n const templateRegex = /<template([^>]*)>(.*?)<\\/template>/gs;\n html = html.replace(templateRegex, (match, attributes, content) => {\n const element = this.document.createElement('template');\n\n // Parse attributes\n if (attributes.trim()) {\n this.parseAttributes(attributes, element);\n }\n\n // Parse content directly into the template's content fragment\n if (content.trim()) {\n // Use internal method to avoid appendChild side effects\n this.parseHTMLString(content.trim(), element.content);\n }\n\n parent.appendChild(element);\n return ''; // Remove from HTML string\n });\n\n // Improved HTML parsing with proper nesting support\n this.parseHTMLRecursive(html, parent);\n }\n\n private parseHTMLRecursive(html: string, parent: any): void {\n let position = 0;\n\n while (position < html.length) {\n // Find next tag or comment\n const tagStart = html.indexOf('<', position);\n\n if (tagStart === -1) {\n // No more tags, add remaining text if any\n const remainingText = html.substring(position).trim();\n if (remainingText) {\n const textNode = new TextBase(remainingText, this.document);\n parent.appendChild(textNode);\n }\n break;\n }\n\n // Add text before tag if any\n if (tagStart > position) {\n const textContent = html.substring(position, tagStart).trim();\n if (textContent) {\n const textNode = new TextBase(textContent, this.document);\n parent.appendChild(textNode);\n }\n }\n\n // Check if this is a comment\n if (html.substring(tagStart, tagStart + 4) === '<!--') {\n const commentEnd = html.indexOf('-->', tagStart + 4);\n if (commentEnd !== -1) {\n const commentContent = html.substring(tagStart + 4, commentEnd);\n const commentNode = new Comment(commentContent, this.document);\n parent.appendChild(commentNode);\n position = commentEnd + 3;\n continue;\n } else {\n // Malformed comment, treat as text\n const textNode = new TextBase(html.substring(tagStart, tagStart + 4), this.document);\n parent.appendChild(textNode);\n position = tagStart + 4;\n continue;\n }\n }\n\n // Find tag end\n const tagEnd = html.indexOf('>', tagStart);\n if (tagEnd === -1) break;\n\n const tagContent = html.substring(tagStart + 1, tagEnd);\n\n // Check if it's a closing tag\n if (tagContent.startsWith('/')) {\n // This is a closing tag, we should return to parent\n position = tagEnd + 1;\n break;\n }\n\n // Check if it's a self-closing tag\n const isSelfClosing = tagContent.endsWith('/') || this.isSelfClosingTag(tagContent.split(/\\s+/)[0]);\n\n // Parse tag name and attributes\n const spaceIndex = tagContent.indexOf(' ');\n const tagName = spaceIndex === -1 ? tagContent.replace('/', '') : tagContent.substring(0, spaceIndex);\n let attributes = spaceIndex === -1 ? '' : tagContent.substring(spaceIndex + 1);\n \n // Only remove trailing slash for self-closing tags (not from attribute values)\n if (attributes.endsWith('/')) {\n attributes = attributes.slice(0, -1).trim();\n }\n\n\n\n // Create element\n const element = this.document.createElement(tagName.toLowerCase());\n\n\n\n // Parse attributes\n if (attributes.trim()) {\n this.parseAttributes(attributes, element);\n }\n\n parent.appendChild(element);\n\n if (isSelfClosing) {\n position = tagEnd + 1;\n } else {\n // Find matching closing tag and parse content\n const closingTag = `</${tagName}>`;\n const closingTagIndex = this.findMatchingClosingTag(html, tagEnd + 1, tagName);\n\n if (closingTagIndex !== -1) {\n const innerContent = html.substring(tagEnd + 1, closingTagIndex);\n if (innerContent.trim()) {\n this.parseHTMLRecursive(innerContent, element);\n }\n position = closingTagIndex + closingTag.length;\n } else {\n // No matching closing tag found, treat as self-closing\n position = tagEnd + 1;\n }\n }\n }\n }\n\n private findMatchingClosingTag(html: string, startPos: number, tagName: string): number {\n const openTag = `<${tagName}`;\n const closeTag = `</${tagName}>`;\n let depth = 1;\n let pos = startPos;\n\n while (pos < html.length && depth > 0) {\n const nextOpen = html.indexOf(openTag, pos);\n const nextClose = html.indexOf(closeTag, pos);\n\n if (nextClose === -1) {\n // No more closing tags\n return -1;\n }\n\n if (nextOpen !== -1 && nextOpen < nextClose) {\n // Found another opening tag before the closing tag\n depth++;\n pos = nextOpen + openTag.length;\n } else {\n // Found a closing tag\n depth--;\n if (depth === 0) {\n return nextClose;\n }\n pos = nextClose + closeTag.length;\n }\n }\n\n return -1;\n }\n\n private parseAttributes(attributeString: string, element: any): void {\n // Improved attribute parsing that handles complex JavaScript expressions\n let position = 0;\n const length = attributeString.length;\n\n while (position < length) {\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n if (position >= length) break;\n\n // Find attribute name\n const nameStart = position;\n while (position < length && /[\\w:-]/.test(attributeString[position])) {\n position++;\n }\n\n if (position === nameStart) {\n // Invalid character, skip it\n position++;\n continue;\n }\n\n const name = attributeString.substring(nameStart, position);\n\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n let value = '';\n\n // Check if there's an equals sign\n if (position < length && attributeString[position] === '=') {\n position++; // Skip '='\n\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n if (position < length) {\n const quote = attributeString[position];\n \n if (quote === '\"' || quote === \"'\") {\n // Quoted value - find matching closing quote\n position++; // Skip opening quote\n const valueStart = position;\n \n while (position < length && attributeString[position] !== quote) {\n position++;\n }\n \n value = attributeString.substring(valueStart, position);\n \n if (position < length && attributeString[position] === quote) {\n position++; // Skip closing quote\n }\n } else {\n // Unquoted value - read until whitespace or end\n const valueStart = position;\n while (position < length && !/\\s/.test(attributeString[position])) {\n position++;\n }\n value = attributeString.substring(valueStart, position);\n }\n }\n }\n\n // Decode HTML entities in attribute values\n value = this.decodeHTMLEntities(value);\n \n element.setAttribute(name, value);\n }\n }\n\n /**\n * Decode HTML entities in a string\n */\n private decodeHTMLEntities(str: string): string {\n const entityMap: { [key: string]: string } = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': \"'\",\n '&#34;': '\"',\n '&apos;': \"'\",\n '&copy;': '\u00A9',\n '&reg;': '\u00AE',\n '&trade;': '\u2122',\n '&nbsp;': ' ',\n '&hellip;': '\u2026',\n '&mdash;': '\u2014',\n '&ndash;': '\u2013',\n '&lsquo;': '\\u2018',\n '&rsquo;': '\\u2019',\n '&ldquo;': '\"',\n '&rdquo;': '\"'\n };\n\n return str.replace(/&[a-zA-Z0-9#]+;/g, (entity) => {\n // Handle named entities\n if (entityMap[entity]) {\n return entityMap[entity];\n }\n \n // Handle numeric entities like &#39; &#34;\n if (entity.startsWith('&#') && entity.endsWith(';')) {\n const numStr = entity.slice(2, -1);\n const num = parseInt(numStr, 10);\n if (!isNaN(num)) {\n return String.fromCharCode(num);\n }\n }\n \n // Handle hex entities like &#x27;\n if (entity.startsWith('&#x') && entity.endsWith(';')) {\n const hexStr = entity.slice(3, -1);\n const num = parseInt(hexStr, 16);\n if (!isNaN(num)) {\n return String.fromCharCode(num);\n }\n }\n \n // Return original if not recognized\n return entity;\n });\n }\n\n private isSelfClosingTag(tagName: string): boolean {\n const selfClosingTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];\n return selfClosingTags.includes(tagName.toLowerCase());\n }\n\n /**\n * Set up document references after HTML parsing\n */\n private setupDocumentReferences(): void {\n // Find HTML, HEAD, and BODY elements\n const allHtmlElements = this.document.querySelectorAll('html');\n const allHeadElements = this.document.querySelectorAll('head');\n const allBodyElements = this.document.querySelectorAll('body');\n \n // Choose the HTML element with content, then attributes, then first one\n let htmlElement = null;\n // First priority: HTML with attributes (lang, data-theme \uB4F1)\n for (let i = 0; i < allHtmlElements.length; i++) {\n const html = allHtmlElements[i];\n if (html.attributes.length > 0) {\n htmlElement = html;\n break;\n }\n }\n // Second priority: HTML with child nodes (content)\n if (!htmlElement) {\n for (let i = 0; i < allHtmlElements.length; i++) {\n const html = allHtmlElements[i];\n if (html.childNodes.length > 0) {\n htmlElement = html;\n break;\n }\n }\n }\n // Last resort: first HTML\n if (!htmlElement && allHtmlElements.length > 0) {\n htmlElement = allHtmlElements[0];\n }\n \n // Choose the HEAD element with content, then attributes, then first one\n let headElement = null;\n // First priority: HEAD with child nodes (content)\n for (let i = 0; i < allHeadElements.length; i++) {\n const head = allHeadElements[i];\n if (head.childNodes.length > 0) {\n headElement = head;\n break;\n }\n }\n // Second priority: HEAD with attributes\n if (!headElement) {\n for (let i = 0; i < allHeadElements.length; i++) {\n const head = allHeadElements[i];\n if (head.attributes.length > 0) {\n headElement = head;\n break;\n }\n }\n }\n // Last resort: first HEAD\n if (!headElement && allHeadElements.length > 0) {\n headElement = allHeadElements[0];\n }\n \n // Choose the BODY element with content, then attributes, then first one\n let bodyElement = null;\n\n \n // First priority: BODY with child nodes (content)\n for (let i = 0; i < allBodyElements.length; i++) {\n const body = allBodyElements[i];\n if (body.childNodes.length > 0) {\n bodyElement = body;\n break;\n }\n }\n \n // Second priority: BODY with attributes\n if (!bodyElement) {\n for (let i = 0; i < allBodyElements.length; i++) {\n const body = allBodyElements[i];\n if (body.attributes.length > 0) {\n bodyElement = body;\n break;\n }\n }\n }\n \n // Last resort: first BODY\n if (!bodyElement && allBodyElements.length > 0) {\n bodyElement = allBodyElements[0];\n }\n \n\n \n // For now, just use the elements as they are parsed\n // TODO: Implement proper DOM structure reorganization later\n \n // Set document references\n if (htmlElement) {\n (this.document as any).documentElement = htmlElement;\n }\n if (headElement) {\n (this.document as any).head = headElement;\n }\n if (bodyElement) {\n (this.document as any).body = bodyElement;\n }\n }\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA6B;AAC7B,sBAAyB;AACzB,qBAAwB;AACxB,wBAA2B;AAMpB,MAAM,UAAU;AAAA,EAInB,YAAY,MAAc,QAA2B;AAEjD,UAAM,WAAW,IAAI,iCAAa;AAGlC,UAAM,aAAa,IAAI,6BAAW,UAAU,QAAQ,IAAI;AAExD,SAAK,UAAU;AACf,SAAK,YAAY;AAGjB,SAAK,UAAU,IAAI;AAGnB,SAAK,wBAAwB;AAG7B,QAAI,YAAa,SAAiB,iBAAiB;AAC/C,MAAC,SAAiB,gBAAgB;AAAA,IACtC;AAAA,EACJ;AAAA,EAEA,IAAI,SAAiB;AACjB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,WAAqB;AACrB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAIA,SAAS,MAAoB;AAEzB,SAAK,cAAc;AAGnB,SAAK,UAAU,IAAI;AAGnB,SAAK,wBAAwB;AAAA,EACjC;AAAA,EAEQ,gBAAsB;AAE1B,QAAI,KAAK,SAAS,MAAM;AACpB,aAAO,KAAK,SAAS,KAAK,YAAY;AAClC,aAAK,SAAS,KAAK,YAAY,KAAK,SAAS,KAAK,UAAU;AAAA,MAChE;AAAA,IACJ;AAEA,QAAI,KAAK,SAAS,MAAM;AACpB,aAAO,KAAK,SAAS,KAAK,YAAY;AAClC,aAAK,SAAS,KAAK,YAAY,KAAK,SAAS,KAAK,UAAU;AAAA,MAChE;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,UAAU,MAAoB;AAE1B,QAAI,CAAC,KAAK,KAAK,GAAG;AACd;AAAA,IACJ;AAIA,SAAK,gBAAgB,MAAM,KAAK,QAAQ;AAAA,EAC5C;AAAA,EAEQ,gBA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iB,OAAO;AAAA,IAClC;AAAA,EACJ;AACJ;",
4
+ "sourcesContent": ["import {DocumentBase} from './node/DocumentBase';\nimport {TextBase} from './node/TextBase';\nimport {Comment} from './node/Comment';\nimport {WindowBase} from './window/WindowBase';\n\nexport interface DomParserOptions {\n href?: string;\n}\n\nexport class DomParser {\n private _window: Window | null;\n private _document: Document | null;\n\n constructor(html: string, option?: DomParserOptions) {\n // Create WindowBase instance with the document\n const windowBase = new WindowBase({initialUrl: option?.href});\n this._window = windowBase as unknown as Window;\n this._document = windowBase.document as any;\n\n // Parse the provided HTML string\n this.parseHTML(html);\n\n // Set up document references after parsing\n this.setupDocumentReferences();\n\n // Simulate document loading process\n if (this._document && (this._document as any).simulateLoading) {\n (this._document as any).simulateLoading();\n }\n }\n\n get window(): Window {\n if (!this._window) {\n throw new Error('DomParser has been destroyed');\n }\n return this._window;\n }\n\n get document(): Document {\n if (!this._document) {\n throw new Error('DomParser has been destroyed');\n }\n return this._document;\n }\n\n /**\n * Destroy the DomParser instance and free memory\n */\n destroy(): void {\n if (this._window) {\n this._window.close();\n this._window = null;\n }\n \n this._document = null;\n }\n\n /**\n * Load new HTML content and replace the current document\n */\n loadHTML(html: string): void {\n if (!this._document) {\n throw new Error('DomParser has been destroyed');\n }\n \n // Clear current document content\n this.clearDocument();\n\n // Parse new HTML\n this.parseHTML(html);\n\n // Set up document references after parsing\n this.setupDocumentReferences();\n }\n\n private clearDocument(): void {\n if (!this._document) return;\n \n // Clear document body and head content while preserving structure\n if (this._document.head) {\n while (this._document.head.firstChild) {\n this._document.head.removeChild(this._document.head.firstChild);\n }\n }\n\n if (this._document.body) {\n while (this._document.body.firstChild) {\n this._document.body.removeChild(this._document.body.firstChild);\n }\n }\n }\n\n parseHTML(html: string): void {\n if (!this._document) {\n throw new Error('DomParser has been destroyed');\n }\n // Simple HTML parsing implementation\n if (!html.trim()) {\n return;\n }\n\n // Basic HTML parsing - this is a simplified version\n // In a real implementation, you'd use a proper HTML parser\n this.parseHTMLString(html, this.document);\n }\n\n private parseHTMLString(html: string, parent: any): void {\n // Remove DOCTYPE if present\n html = html.replace(/<!DOCTYPE[^>]*>/i, '').trim();\n\n if (!html) return;\n\n // Handle template tags specially\n const templateRegex = /<template([^>]*)>(.*?)<\\/template>/gs;\n html = html.replace(templateRegex, (match, attributes, content) => {\n const element = this.document.createElement('template');\n\n // Parse attributes\n if (attributes.trim()) {\n this.parseAttributes(attributes, element);\n }\n\n // Parse content directly into the template's content fragment\n if (content.trim()) {\n // Use internal method to avoid appendChild side effects\n this.parseHTMLString(content.trim(), element.content);\n }\n\n parent.appendChild(element);\n return ''; // Remove from HTML string\n });\n\n // Improved HTML parsing with proper nesting support\n this.parseHTMLRecursive(html, parent);\n }\n\n private parseHTMLRecursive(html: string, parent: any): void {\n let position = 0;\n\n while (position < html.length) {\n // Find next tag or comment\n const tagStart = html.indexOf('<', position);\n\n if (tagStart === -1) {\n // No more tags, add remaining text if any\n const remainingText = html.substring(position).trim();\n if (remainingText) {\n const textNode = new TextBase(remainingText, this.document);\n parent.appendChild(textNode);\n }\n break;\n }\n\n // Add text before tag if any\n if (tagStart > position) {\n const textContent = html.substring(position, tagStart).trim();\n if (textContent) {\n const textNode = new TextBase(textContent, this.document);\n parent.appendChild(textNode);\n }\n }\n\n // Check if this is a comment\n if (html.substring(tagStart, tagStart + 4) === '<!--') {\n const commentEnd = html.indexOf('-->', tagStart + 4);\n if (commentEnd !== -1) {\n const commentContent = html.substring(tagStart + 4, commentEnd);\n const commentNode = new Comment(commentContent, this.document);\n parent.appendChild(commentNode);\n position = commentEnd + 3;\n continue;\n } else {\n // Malformed comment, treat as text\n const textNode = new TextBase(html.substring(tagStart, tagStart + 4), this.document);\n parent.appendChild(textNode);\n position = tagStart + 4;\n continue;\n }\n }\n\n // Find tag end\n const tagEnd = html.indexOf('>', tagStart);\n if (tagEnd === -1) break;\n\n const tagContent = html.substring(tagStart + 1, tagEnd);\n\n // Check if it's a closing tag\n if (tagContent.startsWith('/')) {\n // This is a closing tag, we should return to parent\n position = tagEnd + 1;\n break;\n }\n\n // Check if it's a self-closing tag\n const isSelfClosing = tagContent.endsWith('/') || this.isSelfClosingTag(tagContent.split(/\\s+/)[0]);\n\n // Parse tag name and attributes\n const spaceIndex = tagContent.indexOf(' ');\n const tagName = spaceIndex === -1 ? tagContent.replace('/', '') : tagContent.substring(0, spaceIndex);\n let attributes = spaceIndex === -1 ? '' : tagContent.substring(spaceIndex + 1);\n\n // Only remove trailing slash for self-closing tags (not from attribute values)\n if (attributes.endsWith('/')) {\n attributes = attributes.slice(0, -1).trim();\n }\n\n\n // Create element\n const element = this.document.createElement(tagName.toLowerCase());\n\n\n // Parse attributes\n if (attributes.trim()) {\n this.parseAttributes(attributes, element);\n }\n\n parent.appendChild(element);\n\n if (isSelfClosing) {\n position = tagEnd + 1;\n } else {\n // Find matching closing tag and parse content\n const closingTag = `</${tagName}>`;\n const closingTagIndex = this.findMatchingClosingTag(html, tagEnd + 1, tagName);\n\n if (closingTagIndex !== -1) {\n const innerContent = html.substring(tagEnd + 1, closingTagIndex);\n if (innerContent.trim()) {\n this.parseHTMLRecursive(innerContent, element);\n }\n position = closingTagIndex + closingTag.length;\n } else {\n // No matching closing tag found, treat as self-closing\n position = tagEnd + 1;\n }\n }\n }\n }\n\n private findMatchingClosingTag(html: string, startPos: number, tagName: string): number {\n const openTag = `<${tagName}`;\n const closeTag = `</${tagName}>`;\n let depth = 1;\n let pos = startPos;\n\n while (pos < html.length && depth > 0) {\n const nextOpen = html.indexOf(openTag, pos);\n const nextClose = html.indexOf(closeTag, pos);\n\n if (nextClose === -1) {\n // No more closing tags\n return -1;\n }\n\n if (nextOpen !== -1 && nextOpen < nextClose) {\n // Found another opening tag before the closing tag\n depth++;\n pos = nextOpen + openTag.length;\n } else {\n // Found a closing tag\n depth--;\n if (depth === 0) {\n return nextClose;\n }\n pos = nextClose + closeTag.length;\n }\n }\n\n return -1;\n }\n\n private parseAttributes(attributeString: string, element: any): void {\n // Improved attribute parsing that handles complex JavaScript expressions\n let position = 0;\n const length = attributeString.length;\n\n while (position < length) {\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n if (position >= length) break;\n\n // Find attribute name\n const nameStart = position;\n while (position < length && /[\\w:-]/.test(attributeString[position])) {\n position++;\n }\n\n if (position === nameStart) {\n // Invalid character, skip it\n position++;\n continue;\n }\n\n const name = attributeString.substring(nameStart, position);\n\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n let value = '';\n\n // Check if there's an equals sign\n if (position < length && attributeString[position] === '=') {\n position++; // Skip '='\n\n // Skip whitespace\n while (position < length && /\\s/.test(attributeString[position])) {\n position++;\n }\n\n if (position < length) {\n const quote = attributeString[position];\n\n if (quote === '\"' || quote === \"'\") {\n // Quoted value - find matching closing quote\n position++; // Skip opening quote\n const valueStart = position;\n\n while (position < length && attributeString[position] !== quote) {\n position++;\n }\n\n value = attributeString.substring(valueStart, position);\n\n if (position < length && attributeString[position] === quote) {\n position++; // Skip closing quote\n }\n } else {\n // Unquoted value - read until whitespace or end\n const valueStart = position;\n while (position < length && !/\\s/.test(attributeString[position])) {\n position++;\n }\n value = attributeString.substring(valueStart, position);\n }\n }\n }\n\n // Decode HTML entities in attribute values\n value = this.decodeHTMLEntities(value);\n\n element.setAttribute(name, value);\n }\n }\n\n /**\n * Decode HTML entities in a string\n */\n private decodeHTMLEntities(str: string): string {\n const entityMap: { [key: string]: string } = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': \"'\",\n '&#34;': '\"',\n '&apos;': \"'\",\n '&copy;': '\u00A9',\n '&reg;': '\u00AE',\n '&trade;': '\u2122',\n '&nbsp;': ' ',\n '&hellip;': '\u2026',\n '&mdash;': '\u2014',\n '&ndash;': '\u2013',\n '&lsquo;': '\\u2018',\n '&rsquo;': '\\u2019',\n '&ldquo;': '\"',\n '&rdquo;': '\"'\n };\n\n return str.replace(/&[a-zA-Z0-9#]+;/g, (entity) => {\n // Handle named entities\n if (entityMap[entity]) {\n return entityMap[entity];\n }\n\n // Handle numeric entities like &#39; &#34;\n if (entity.startsWith('&#') && entity.endsWith(';')) {\n const numStr = entity.slice(2, -1);\n const num = parseInt(numStr, 10);\n if (!isNaN(num)) {\n return String.fromCharCode(num);\n }\n }\n\n // Handle hex entities like &#x27;\n if (entity.startsWith('&#x') && entity.endsWith(';')) {\n const hexStr = entity.slice(3, -1);\n const num = parseInt(hexStr, 16);\n if (!isNaN(num)) {\n return String.fromCharCode(num);\n }\n }\n\n // Return original if not recognized\n return entity;\n });\n }\n\n private isSelfClosingTag(tagName: string): boolean {\n const selfClosingTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];\n return selfClosingTags.includes(tagName.toLowerCase());\n }\n\n /**\n * Set up document references after HTML parsing\n */\n private setupDocumentReferences(): void {\n // Find HTML, HEAD, and BODY elements\n const allHtmlElements = this.document.querySelectorAll('html');\n const allHeadElements = this.document.querySelectorAll('head');\n const allBodyElements = this.document.querySelectorAll('body');\n\n // Choose the HTML element with content, then attributes, then first one\n let htmlElement = null;\n // First priority: HTML with attributes (lang, data-theme \uB4F1)\n for (let i = 0; i < allHtmlElements.length; i++) {\n const html = allHtmlElements[i];\n if (html.attributes.length > 0) {\n htmlElement = html;\n break;\n }\n }\n // Second priority: HTML with child nodes (content)\n if (!htmlElement) {\n for (let i = 0; i < allHtmlElements.length; i++) {\n const html = allHtmlElements[i];\n if (html.childNodes.length > 0) {\n htmlElement = html;\n break;\n }\n }\n }\n // Last resort: first HTML\n if (!htmlElement && allHtmlElements.length > 0) {\n htmlElement = allHtmlElements[0];\n }\n\n // Choose the HEAD element with content, then attributes, then first one\n let headElement = null;\n // First priority: HEAD with child nodes (content)\n for (let i = 0; i < allHeadElements.length; i++) {\n const head = allHeadElements[i];\n if (head.childNodes.length > 0) {\n headElement = head;\n break;\n }\n }\n // Second priority: HEAD with attributes\n if (!headElement) {\n for (let i = 0; i < allHeadElements.length; i++) {\n const head = allHeadElements[i];\n if (head.attributes.length > 0) {\n headElement = head;\n break;\n }\n }\n }\n // Last resort: first HEAD\n if (!headElement && allHeadElements.length > 0) {\n headElement = allHeadElements[0];\n }\n\n // Choose the BODY element with content, then attributes, then first one\n let bodyElement = null;\n\n\n // First priority: BODY with child nodes (content)\n for (let i = 0; i < allBodyElements.length; i++) {\n const body = allBodyElements[i];\n if (body.childNodes.length > 0) {\n bodyElement = body;\n break;\n }\n }\n\n // Second priority: BODY with attributes\n if (!bodyElement) {\n for (let i = 0; i < allBodyElements.length; i++) {\n const body = allBodyElements[i];\n if (body.attributes.length > 0) {\n bodyElement = body;\n break;\n }\n }\n }\n\n // Last resort: first BODY\n if (!bodyElement && allBodyElements.length > 0) {\n bodyElement = allBodyElements[0];\n }\n\n\n // For now, just use the elements as they are parsed\n // TODO: Implement proper DOM structure reorganization later\n\n // Set document references\n if (htmlElement) {\n (this.document as any).documentElement = htmlElement;\n }\n if (headElement) {\n (this.document as any).head = headElement;\n }\n if (bodyElement) {\n (this.document as any).body = bodyElement;\n }\n }\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAuB;AACvB,qBAAsB;AACtB,wBAAyB;AAMlB,MAAM,UAAU;AAAA,EAIrB,YAAY,MAAc,QAA2B;AAEnD,UAAM,aAAa,IAAI,6BAAW,EAAC,YAAY,QAAQ,KAAI,CAAC;AAC5D,SAAK,UAAU;AACf,SAAK,YAAY,WAAW;AAG5B,SAAK,UAAU,IAAI;AAGnB,SAAK,wBAAwB;AAG7B,QAAI,KAAK,aAAc,KAAK,UAAkB,iBAAiB;AAC7D,MAAC,KAAK,UAAkB,gBAAgB;AAAA,IAC1C;AAAA,EACF;AAAA,EAEA,IAAI,SAAiB;AACnB,QAAI,CAAC,KAAK,SAAS;AACjB,YAAM,IAAI,MAAM,8BAA8B;AAAA,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AQ,KAAK;AAC/C,YAAM,OAAO,gBAAgB,CAAC;AAC9B,UAAI,KAAK,WAAW,SAAS,GAAG;AAC9B,sBAAc;AACd;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,aAAa;AAChB,eAAS,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;AAC/C,cAAM,OAAO,gBAAgB,CAAC;AAC9B,YAAI,KAAK,WAAW,SAAS,GAAG;AAC9B,wBAAc;AACd;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,eAAe,gBAAgB,SAAS,GAAG;AAC9C,oBAAc,gBAAgB,CAAC;AAAA,IACjC;AAGA,QAAI,cAAc;AAIlB,aAAS,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;AAC/C,YAAM,OAAO,gBAAgB,CAAC;AAC9B,UAAI,KAAK,WAAW,SAAS,GAAG;AAC9B,sBAAc;AACd;AAAA,MACF;AAAA,IACF;AAGA,QAAI,CAAC,aAAa;AAChB,eAAS,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK;AAC/C,cAAM,OAAO,gBAAgB,CAAC;AAC9B,YAAI,KAAK,WAAW,SAAS,GAAG;AAC9B,wBAAc;AACd;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAGA,QAAI,CAAC,eAAe,gBAAgB,SAAS,GAAG;AAC9C,oBAAc,gBAAgB,CAAC;AAAA,IACjC;AAOA,QAAI,aAAa;AACf,MAAC,KAAK,SAAiB,kBAAkB;AAAA,IAC3C;AACA,QAAI,aAAa;AACf,MAAC,KAAK,SAAiB,OAAO;AAAA,IAChC;AACA,QAAI,aAAa;AACf,MAAC,KAAK,SAAiB,OAAO;AAAA,IAChC;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -90,6 +90,7 @@ class DocumentBase extends import_ParentNodeBase.ParentNodeBase {
90
90
  },
91
91
  reload: () => {
92
92
  },
93
+ // @ts-ignore
93
94
  toString: () => this._location.href
94
95
  };
95
96
  // Event handlers
@@ -119,6 +120,9 @@ class DocumentBase extends import_ParentNodeBase.ParentNodeBase {
119
120
  this.head = head;
120
121
  this.body = body;
121
122
  }
123
+ setLocation(location) {
124
+ this._location = location;
125
+ }
122
126
  get location() {
123
127
  return this._location;
124
128
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/node/DocumentBase.ts"],
4
- "sourcesContent": ["import {ParentNodeBase} from './ParentNodeBase';\nimport {DOCUMENT_NODE, Node} from './Node';\nimport {Document, ElementCreationOptions, DocumentReadyState, DocumentVisibilityState, ImportNodeOptions, CaretPositionFromPointOptions, StartViewTransitionOptions, ViewTransitionUpdateCallback} from './Document';\nimport {Comment} from './Comment';\nimport {Text} from './Text';\nimport {DocumentFragment} from './DocumentFragment';\nimport {DocumentFragmentBase} from './DocumentFragmentBase';\nimport {Element} from './elements/Element';\nimport {HTMLElement} from './elements/HTMLElement';\nimport {HTMLCollection, HTMLCollectionOf} from './collection';\nimport {HTMLElementTagNameMap, SVGElementTagNameMap, MathMLElementTagNameMap, HTMLElementDeprecatedTagNameMap} from './elements';\nimport {NodeListOf} from './collection/NodeListOf';\nimport {ElementFactory} from '../factory';\nimport {NodeIterator, NodeFilter} from './NodeIterator';\n\n// Document event listener interface\ninterface DocumentEventListener {\n type: string;\n listener: (event: any) => void;\n options?: boolean | AddEventListenerOptions;\n}\n\n/**\n * The **`DocumentBase`** class is the concrete implementation of the Document interface.\n */\nexport class DocumentBase extends ParentNodeBase implements Document {\n // Event system\n private _eventListeners: DocumentEventListener[] = [];\n private _readyState: DocumentReadyState = 'uninitialized' as any;\n private _window: any = null; // Reference to window for load event\n // Properties\n readonly URL: string = 'about:blank';\n alinkColor: string = '';\n readonly all: any = null;\n readonly anchors: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly applets: HTMLCollection = new HTMLCollection([]);\n bgColor: string = '';\n body: HTMLElement = null as any;\n readonly characterSet: string = 'UTF-8';\n readonly charset: string = 'UTF-8';\n readonly compatMode: string = 'CSS1Compat';\n readonly contentType: string = 'text/html';\n cookie: string = '';\n readonly currentScript: any = null;\n readonly defaultView: any = null;\n designMode: string = 'off';\n dir: string = '';\n readonly doctype: any = null;\n readonly documentElement: HTMLElement = null as any;\n readonly documentURI: string = 'about:blank';\n domain: string = '';\n readonly embeds: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n fgColor: string = '';\n readonly forms: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly fragmentDirective: any = null;\n readonly fullscreen: boolean = false;\n readonly fullscreenEnabled: boolean = false;\n readonly head: any = null;\n readonly hidden: boolean = false;\n readonly images: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly implementation: any = null;\n readonly inputEncoding: string = 'UTF-8';\n readonly lastModified: string = new Date().toString();\n linkColor: string = '';\n readonly links: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n \n // Location property - simple implementation for Document\n private _location: any = {\n href: 'about:blank',\n protocol: 'about:',\n host: '',\n hostname: '',\n port: '',\n pathname: 'blank',\n search: '',\n hash: '',\n origin: 'null',\n assign: (url: string) => { this._location.href = url; },\n replace: (url: string) => { this._location.href = url; },\n reload: () => {},\n toString: () => this._location.href\n };\n \n get location(): any {\n return this._location;\n }\n \n set location(href: string) {\n this._location.href = href;\n // Simple URL parsing for document location\n try {\n const url = new URL(href);\n this._location.protocol = url.protocol;\n this._location.host = url.host;\n this._location.hostname = url.hostname;\n this._location.port = url.port;\n this._location.pathname = url.pathname;\n this._location.search = url.search;\n this._location.hash = url.hash;\n this._location.origin = url.origin;\n } catch (e) {\n // Keep defaults for invalid URLs\n }\n }\n \n // Event handlers\n onfullscreenchange: ((this: Document, ev: Event) => any) | null = null;\n onfullscreenerror: ((this: Document, ev: Event) => any) | null = null;\n onpointerlockchange: ((this: Document, ev: Event) => any) | null = null;\n onpointerlockerror: ((this: Document, ev: Event) => any) | null = null;\n onreadystatechange: ((this: Document, ev: Event) => any) | null = null;\n onvisibilitychange: ((this: Document, ev: Event) => any) | null = null;\n \n get ownerDocument(): null {\n return null;\n }\n readonly pictureInPictureEnabled: boolean = false;\n readonly plugins: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n get readyState(): DocumentReadyState {\n return this._readyState;\n }\n readonly referrer: string = '';\n readonly rootElement: any = null;\n readonly scripts: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly scrollingElement: Element | null = null;\n readonly timeline: any = null;\n get title(): string {\n const titleElement = this.querySelector('title');\n return titleElement ? titleElement.textContent || '' : '';\n }\n \n set title(value: string) {\n let titleElement = this.querySelector('title');\n if (!titleElement) {\n // Create title element if it doesn't exist\n titleElement = this.createElement('title');\n const head = this.head || this.querySelector('head');\n if (head) {\n head.appendChild(titleElement);\n }\n }\n titleElement.textContent = value;\n }\n readonly visibilityState: DocumentVisibilityState = 'visible';\n vlinkColor: string = '';\n\n constructor() {\n super(DOCUMENT_NODE, '#document');\n this._ownerDocument = null;\n\n // Create basic document structure\n const documentElement = this.createElement('html') as HTMLElement;\n const head = this.createElement('head') as HTMLElement;\n const body = this.createElement('body') as HTMLElement;\n\n documentElement.appendChild(head);\n documentElement.appendChild(body);\n this.appendChild(documentElement);\n\n // Set readonly properties\n (this as any).documentElement = documentElement;\n (this as any).head = head;\n this.body = body;\n }\n\n get textContent(): null {\n return null;\n }\n\n // Methods\n adoptNode<T extends Node>(node: T): T {\n (node as any)._ownerDocument = this;\n return node;\n }\n\n captureEvents(): void {}\n\n caretPositionFromPoint(_x: number, _y: number, _options?: CaretPositionFromPointOptions): any {\n return null;\n }\n\n caretRangeFromPoint(_x: number, _y: number): any {\n return null;\n }\n\n clear(): void {}\n\n close(): void {}\n\n createAttribute(localName: string): any {\n return { name: localName, value: '' };\n }\n\n createAttributeNS(_namespace: string | null, qualifiedName: string): any {\n return { name: qualifiedName, value: '' };\n }\n\n createCDATASection(data: string): any {\n return { data, nodeType: 4 };\n }\n\n createComment(data: string): Comment {\n return new Comment(data, this);\n }\n\n createDocumentFragment(): DocumentFragment {\n return new DocumentFragmentBase(this);\n }\n\n createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, _options?: ElementCreationOptions): HTMLElementTagNameMap[K];\n createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(tagName: K, _options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K];\n createElement(tagName: string, _options?: ElementCreationOptions): HTMLElement;\n createElement(tagName: string, _options?: ElementCreationOptions): HTMLElement {\n return ElementFactory.createElement(tagName, this);\n }\n\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement;\n createElementNS<K extends keyof SVGElementTagNameMap>(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: K): SVGElementTagNameMap[K];\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): any;\n createElementNS<K extends keyof MathMLElementTagNameMap>(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", qualifiedName: K): MathMLElementTagNameMap[K];\n createElementNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", qualifiedName: string): any;\n createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element;\n createElementNS(_namespace: string | null, qualifiedName: string, _options?: string | ElementCreationOptions): Element;\n createElementNS(_namespaceURI: string | null, qualifiedName: string, _options?: ElementCreationOptions | string): Element {\n return ElementFactory.createElement(qualifiedName, this);\n }\n\n createEvent(_eventInterface: string): any {\n return {};\n }\n\n createNodeIterator(root: Node, whatToShow: number = NodeFilter.SHOW_ALL, filter: NodeFilter | null = null): NodeIterator {\n return new NodeIterator(root, whatToShow, filter);\n }\n\n createProcessingInstruction(target: string, data: string): any {\n return { target, data, nodeType: 7 };\n }\n\n createRange(): any {\n return {};\n }\n\n createTextNode(data: string): Text {\n const { TextBase } = require('./TextBase');\n return new TextBase(data, this);\n }\n\n createTreeWalker(_root: Node, _whatToShow?: number, _filter?: any): any {\n return {};\n }\n\n execCommand(_commandId: string, _showUI?: boolean, _value?: string): boolean {\n return false;\n }\n\n exitFullscreen(): Promise<void> {\n return Promise.resolve();\n }\n\n exitPictureInPicture(): Promise<void> {\n return Promise.resolve();\n }\n\n exitPointerLock(): void {}\n\n getElementById(elementId: string): HTMLElement | null {\n const elements = this.querySelectorAll(`#${elementId}`);\n return elements.length > 0 ? elements[0] as HTMLElement : null;\n }\n\n getElementsByClassName(classNames: string): HTMLCollectionOf<Element> {\n const elements = this.querySelectorAll(`.${classNames.split(' ').join('.')}`);\n return new HTMLCollectionOf(Array.from(elements));\n }\n\n getElementsByName(elementName: string): NodeListOf<HTMLElement> {\n const elements = this.querySelectorAll(`[name=\"${elementName}\"]`);\n return new NodeListOf(Array.from(elements) as HTMLElement[]);\n }\n\n getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element> {\n const elements = this.querySelectorAll<Element>(qualifiedName);\n return new HTMLCollectionOf(Array.from(elements));\n }\n\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<any>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", localName: string): HTMLCollectionOf<any>;\n getElementsByTagNameNS(_namespace: string | null, localName: string): HTMLCollectionOf<Element>;\n getElementsByTagNameNS(_namespace: string | null, localName: string): HTMLCollectionOf<Element> {\n return this.getElementsByTagName(localName);\n }\n\n getSelection(): any {\n return null;\n }\n\n hasFocus(): boolean {\n return false;\n }\n\n hasStorageAccess(): Promise<boolean> {\n return Promise.resolve(false);\n }\n\n importNode<T extends Node>(node: T, _options?: boolean | ImportNodeOptions): T {\n const cloned = (node as any).cloneNode(typeof _options === 'boolean' ? _options : _options?.deep);\n (cloned as any)._ownerDocument = this;\n return cloned;\n }\n\n open(_unused1?: string, _unused2?: string): Document;\n open(_url: string | URL, _name: string, _features: string): any;\n open(_arg1?: string | URL, _arg2?: string, _arg3?: string): Document | any {\n if (arguments.length <= 2) {\n return this;\n }\n return null;\n }\n\n queryCommandEnabled(_commandId: string): boolean {\n return false;\n }\n\n queryCommandIndeterm(_commandId: string): boolean {\n return false;\n }\n\n queryCommandState(_commandId: string): boolean {\n return false;\n }\n\n queryCommandSupported(_commandId: string): boolean {\n return false;\n }\n\n queryCommandValue(_commandId: string): string {\n return '';\n }\n\n releaseEvents(): void {}\n\n requestStorageAccess(): Promise<void> {\n return Promise.resolve();\n }\n\n startViewTransition(_callbackOptions?: ViewTransitionUpdateCallback | StartViewTransitionOptions): any {\n return {};\n }\n\n write(...text: string[]): void {\n console.log('Document.write:', text.join(''));\n }\n\n writeln(...text: string[]): void {\n this.write(...text, '\\n');\n }\n\n addEventListener(type: string, listener: any, options?: boolean | any): void {\n // Support DOMContentLoaded and readystatechange events\n if (type === 'DOMContentLoaded' || type === 'readystatechange') {\n this._eventListeners.push({\n type,\n listener: typeof listener === 'function' ? listener : listener.handleEvent,\n options\n });\n }\n }\n\n removeEventListener(type: string, listener: any, options?: boolean | any): void {\n if (type === 'DOMContentLoaded' || type === 'readystatechange') {\n const targetListener = typeof listener === 'function' ? listener : listener.handleEvent;\n this._eventListeners = this._eventListeners.filter(\n eventListener => !(eventListener.type === type && eventListener.listener === targetListener)\n );\n }\n }\n\n dispatchEvent(event: any): boolean {\n const eventListeners = this._eventListeners.filter(listener => listener.type === event.type);\n \n for (const eventListener of eventListeners) {\n try {\n eventListener.listener.call(this, event);\n \n // Handle 'once' option\n if (eventListener.options && typeof eventListener.options === 'object' && eventListener.options.once) {\n this.removeEventListener(event.type, eventListener.listener);\n }\n } catch (error) {\n console.error('Error in document event listener:', error);\n }\n }\n \n return true;\n }\n\n /**\n * Set window reference for load event dispatching\n */\n setWindow(window: any): void {\n this._window = window;\n }\n\n /**\n * Change document ready state and dispatch events\n */\n setReadyState(state: DocumentReadyState): void {\n if (this._readyState === state) return;\n \n this._readyState = state;\n \n // Dispatch readystatechange event\n this.dispatchEvent({\n type: 'readystatechange',\n target: this,\n readyState: state\n });\n \n // Dispatch DOMContentLoaded when interactive\n if (state === 'interactive') {\n this.dispatchEvent({\n type: 'DOMContentLoaded',\n target: this\n });\n }\n \n // Dispatch load event on window when complete\n if (state === 'complete' && this._window) {\n // Use setTimeout to ensure it's dispatched after current execution\n setTimeout(() => {\n if (this._window && this._window.dispatchEvent) {\n this._window.dispatchEvent({\n type: 'load',\n target: this._window\n });\n }\n }, 0);\n }\n }\n\n /**\n * Simulate document loading process\n */\n simulateLoading(): void {\n // Start with loading state\n this.setReadyState('loading');\n \n // Simulate DOM parsing completion\n setTimeout(() => {\n this.setReadyState('interactive');\n \n // Simulate resource loading completion\n setTimeout(() => {\n this.setReadyState('complete');\n }, 10);\n }, 5);\n }\n}"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA6B;AAC7B,kBAAkC;AAElC,qBAAsB;AAGtB,kCAAmC;AAGnC,wBAA+C;AAE/C,wBAAyB;AACzB,qBAA6B;AAC7B,0BAAuC;AAYhC,MAAM,qBAAqB,qCAAmC;AAAA,EAyHjE,cAAc;AACV,UAAM,2BAAe,WAAW;AAxHpC;AAAA,SAAQ,kBAA2C,CAAC;AACpD,SAAQ,cAAkC;AAC1C,SAAQ,UAAe;AAEvB;AAAA;AAAA,SAAS,MAAc;AACvB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AAQ,eAAe;AAC5C,eAAK,QAAQ,cAAc;AAAA,YACvB,MAAM;AAAA,YACN,QAAQ,KAAK;AAAA,UACjB,CAAC;AAAA,QACL;AAAA,MACJ,GAAG,CAAC;AAAA,IACR;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAwB;AAEpB,SAAK,cAAc,SAAS;AAG5B,eAAW,MAAM;AACb,WAAK,cAAc,aAAa;AAGhC,iBAAW,MAAM;AACb,aAAK,cAAc,UAAU;AAAA,MACjC,GAAG,EAAE;AAAA,IACT,GAAG,CAAC;AAAA,EACR;AACJ;",
4
+ "sourcesContent": ["import {ParentNodeBase} from './ParentNodeBase';\nimport {DOCUMENT_NODE, Node} from './Node';\nimport {Document, ElementCreationOptions, DocumentReadyState, DocumentVisibilityState, ImportNodeOptions, CaretPositionFromPointOptions, StartViewTransitionOptions, ViewTransitionUpdateCallback} from './Document';\nimport {Location} from '../window/Window';\nimport {Comment} from './Comment';\nimport {Text} from './Text';\nimport {DocumentFragment} from './DocumentFragment';\nimport {DocumentFragmentBase} from './DocumentFragmentBase';\nimport {Element} from './elements/Element';\nimport {HTMLElement} from './elements/HTMLElement';\nimport {HTMLCollection, HTMLCollectionOf} from './collection';\nimport {HTMLElementTagNameMap, SVGElementTagNameMap, MathMLElementTagNameMap, HTMLElementDeprecatedTagNameMap} from './elements';\nimport {NodeListOf} from './collection/NodeListOf';\nimport {ElementFactory} from '../factory';\nimport {NodeIterator, NodeFilter} from './NodeIterator';\n\n// Document event listener interface\ninterface DocumentEventListener {\n type: string;\n listener: (event: any) => void;\n options?: boolean | AddEventListenerOptions;\n}\n\n/**\n * The **`DocumentBase`** class is the concrete implementation of the Document interface.\n */\nexport class DocumentBase extends ParentNodeBase implements Document {\n // Event system\n private _eventListeners: DocumentEventListener[] = [];\n private _readyState: DocumentReadyState = 'uninitialized' as any;\n private _window: any = null; // Reference to window for load event\n // Properties\n readonly URL: string = 'about:blank';\n alinkColor: string = '';\n readonly all: any = null;\n readonly anchors: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly applets: HTMLCollection = new HTMLCollection([]);\n bgColor: string = '';\n body: HTMLElement = null as any;\n readonly characterSet: string = 'UTF-8';\n readonly charset: string = 'UTF-8';\n readonly compatMode: string = 'CSS1Compat';\n readonly contentType: string = 'text/html';\n cookie: string = '';\n readonly currentScript: any = null;\n readonly defaultView: any = null;\n designMode: string = 'off';\n dir: string = '';\n readonly doctype: any = null;\n readonly documentElement: HTMLElement = null as any;\n readonly documentURI: string = 'about:blank';\n domain: string = '';\n readonly embeds: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n fgColor: string = '';\n readonly forms: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly fragmentDirective: any = null;\n readonly fullscreen: boolean = false;\n readonly fullscreenEnabled: boolean = false;\n readonly head: any = null;\n readonly hidden: boolean = false;\n readonly images: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly implementation: any = null;\n readonly inputEncoding: string = 'UTF-8';\n readonly lastModified: string = new Date().toString();\n linkColor: string = '';\n readonly links: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n \n // Location property - simple implementation for Document\n private _location: Location = {\n href: 'about:blank',\n protocol: 'about:',\n host: '',\n hostname: '',\n port: '',\n pathname: 'blank',\n search: '',\n hash: '',\n origin: 'null',\n assign: (url: string) => { this._location.href = url; },\n replace: (url: string) => { this._location.href = url; },\n reload: () => {},\n // @ts-ignore\n toString: () => this._location.href\n };\n\n setLocation(location: Location): void {\n this._location = location;\n }\n get location(): any {\n return this._location;\n }\n \n set location(href: string) {\n this._location.href = href;\n // Simple URL parsing for document location\n try {\n const url = new URL(href);\n this._location.protocol = url.protocol;\n this._location.host = url.host;\n this._location.hostname = url.hostname;\n this._location.port = url.port;\n this._location.pathname = url.pathname;\n this._location.search = url.search;\n this._location.hash = url.hash;\n this._location.origin = url.origin;\n } catch (e) {\n // Keep defaults for invalid URLs\n }\n }\n \n // Event handlers\n onfullscreenchange: ((this: Document, ev: Event) => any) | null = null;\n onfullscreenerror: ((this: Document, ev: Event) => any) | null = null;\n onpointerlockchange: ((this: Document, ev: Event) => any) | null = null;\n onpointerlockerror: ((this: Document, ev: Event) => any) | null = null;\n onreadystatechange: ((this: Document, ev: Event) => any) | null = null;\n onvisibilitychange: ((this: Document, ev: Event) => any) | null = null;\n \n get ownerDocument(): null {\n return null;\n }\n readonly pictureInPictureEnabled: boolean = false;\n readonly plugins: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n get readyState(): DocumentReadyState {\n return this._readyState;\n }\n readonly referrer: string = '';\n readonly rootElement: any = null;\n readonly scripts: HTMLCollectionOf<any> = new HTMLCollectionOf([]);\n readonly scrollingElement: Element | null = null;\n readonly timeline: any = null;\n get title(): string {\n const titleElement = this.querySelector('title');\n return titleElement ? titleElement.textContent || '' : '';\n }\n \n set title(value: string) {\n let titleElement = this.querySelector('title');\n if (!titleElement) {\n // Create title element if it doesn't exist\n titleElement = this.createElement('title');\n const head = this.head || this.querySelector('head');\n if (head) {\n head.appendChild(titleElement);\n }\n }\n titleElement.textContent = value;\n }\n readonly visibilityState: DocumentVisibilityState = 'visible';\n vlinkColor: string = '';\n\n constructor() {\n super(DOCUMENT_NODE, '#document');\n this._ownerDocument = null;\n\n // Create basic document structure\n const documentElement = this.createElement('html') as HTMLElement;\n const head = this.createElement('head') as HTMLElement;\n const body = this.createElement('body') as HTMLElement;\n\n documentElement.appendChild(head);\n documentElement.appendChild(body);\n this.appendChild(documentElement);\n\n // Set readonly properties\n (this as any).documentElement = documentElement;\n (this as any).head = head;\n this.body = body;\n }\n\n get textContent(): null {\n return null;\n }\n\n // Methods\n adoptNode<T extends Node>(node: T): T {\n (node as any)._ownerDocument = this;\n return node;\n }\n\n captureEvents(): void {}\n\n caretPositionFromPoint(_x: number, _y: number, _options?: CaretPositionFromPointOptions): any {\n return null;\n }\n\n caretRangeFromPoint(_x: number, _y: number): any {\n return null;\n }\n\n clear(): void {}\n\n close(): void {}\n\n createAttribute(localName: string): any {\n return { name: localName, value: '' };\n }\n\n createAttributeNS(_namespace: string | null, qualifiedName: string): any {\n return { name: qualifiedName, value: '' };\n }\n\n createCDATASection(data: string): any {\n return { data, nodeType: 4 };\n }\n\n createComment(data: string): Comment {\n return new Comment(data, this);\n }\n\n createDocumentFragment(): DocumentFragment {\n return new DocumentFragmentBase(this);\n }\n\n createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, _options?: ElementCreationOptions): HTMLElementTagNameMap[K];\n createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(tagName: K, _options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K];\n createElement(tagName: string, _options?: ElementCreationOptions): HTMLElement;\n createElement(tagName: string, _options?: ElementCreationOptions): HTMLElement {\n return ElementFactory.createElement(tagName, this);\n }\n\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement;\n createElementNS<K extends keyof SVGElementTagNameMap>(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: K): SVGElementTagNameMap[K];\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): any;\n createElementNS<K extends keyof MathMLElementTagNameMap>(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", qualifiedName: K): MathMLElementTagNameMap[K];\n createElementNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", qualifiedName: string): any;\n createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element;\n createElementNS(_namespace: string | null, qualifiedName: string, _options?: string | ElementCreationOptions): Element;\n createElementNS(_namespaceURI: string | null, qualifiedName: string, _options?: ElementCreationOptions | string): Element {\n return ElementFactory.createElement(qualifiedName, this);\n }\n\n createEvent(_eventInterface: string): any {\n return {};\n }\n\n createNodeIterator(root: Node, whatToShow: number = NodeFilter.SHOW_ALL, filter: NodeFilter | null = null): NodeIterator {\n return new NodeIterator(root, whatToShow, filter);\n }\n\n createProcessingInstruction(target: string, data: string): any {\n return { target, data, nodeType: 7 };\n }\n\n createRange(): any {\n return {};\n }\n\n createTextNode(data: string): Text {\n const { TextBase } = require('./TextBase');\n return new TextBase(data, this);\n }\n\n createTreeWalker(_root: Node, _whatToShow?: number, _filter?: any): any {\n return {};\n }\n\n execCommand(_commandId: string, _showUI?: boolean, _value?: string): boolean {\n return false;\n }\n\n exitFullscreen(): Promise<void> {\n return Promise.resolve();\n }\n\n exitPictureInPicture(): Promise<void> {\n return Promise.resolve();\n }\n\n exitPointerLock(): void {}\n\n getElementById(elementId: string): HTMLElement | null {\n const elements = this.querySelectorAll(`#${elementId}`);\n return elements.length > 0 ? elements[0] as HTMLElement : null;\n }\n\n getElementsByClassName(classNames: string): HTMLCollectionOf<Element> {\n const elements = this.querySelectorAll(`.${classNames.split(' ').join('.')}`);\n return new HTMLCollectionOf(Array.from(elements));\n }\n\n getElementsByName(elementName: string): NodeListOf<HTMLElement> {\n const elements = this.querySelectorAll(`[name=\"${elementName}\"]`);\n return new NodeListOf(Array.from(elements) as HTMLElement[]);\n }\n\n getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element> {\n const elements = this.querySelectorAll<Element>(qualifiedName);\n return new HTMLCollectionOf(Array.from(elements));\n }\n\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<any>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", localName: string): HTMLCollectionOf<any>;\n getElementsByTagNameNS(_namespace: string | null, localName: string): HTMLCollectionOf<Element>;\n getElementsByTagNameNS(_namespace: string | null, localName: string): HTMLCollectionOf<Element> {\n return this.getElementsByTagName(localName);\n }\n\n getSelection(): any {\n return null;\n }\n\n hasFocus(): boolean {\n return false;\n }\n\n hasStorageAccess(): Promise<boolean> {\n return Promise.resolve(false);\n }\n\n importNode<T extends Node>(node: T, _options?: boolean | ImportNodeOptions): T {\n const cloned = (node as any).cloneNode(typeof _options === 'boolean' ? _options : _options?.deep);\n (cloned as any)._ownerDocument = this;\n return cloned;\n }\n\n open(_unused1?: string, _unused2?: string): Document;\n open(_url: string | URL, _name: string, _features: string): any;\n open(_arg1?: string | URL, _arg2?: string, _arg3?: string): Document | any {\n if (arguments.length <= 2) {\n return this;\n }\n return null;\n }\n\n queryCommandEnabled(_commandId: string): boolean {\n return false;\n }\n\n queryCommandIndeterm(_commandId: string): boolean {\n return false;\n }\n\n queryCommandState(_commandId: string): boolean {\n return false;\n }\n\n queryCommandSupported(_commandId: string): boolean {\n return false;\n }\n\n queryCommandValue(_commandId: string): string {\n return '';\n }\n\n releaseEvents(): void {}\n\n requestStorageAccess(): Promise<void> {\n return Promise.resolve();\n }\n\n startViewTransition(_callbackOptions?: ViewTransitionUpdateCallback | StartViewTransitionOptions): any {\n return {};\n }\n\n write(...text: string[]): void {\n console.log('Document.write:', text.join(''));\n }\n\n writeln(...text: string[]): void {\n this.write(...text, '\\n');\n }\n\n addEventListener(type: string, listener: any, options?: boolean | any): void {\n // Support DOMContentLoaded and readystatechange events\n if (type === 'DOMContentLoaded' || type === 'readystatechange') {\n this._eventListeners.push({\n type,\n listener: typeof listener === 'function' ? listener : listener.handleEvent,\n options\n });\n }\n }\n\n removeEventListener(type: string, listener: any, options?: boolean | any): void {\n if (type === 'DOMContentLoaded' || type === 'readystatechange') {\n const targetListener = typeof listener === 'function' ? listener : listener.handleEvent;\n this._eventListeners = this._eventListeners.filter(\n eventListener => !(eventListener.type === type && eventListener.listener === targetListener)\n );\n }\n }\n\n dispatchEvent(event: any): boolean {\n const eventListeners = this._eventListeners.filter(listener => listener.type === event.type);\n \n for (const eventListener of eventListeners) {\n try {\n eventListener.listener.call(this, event);\n \n // Handle 'once' option\n if (eventListener.options && typeof eventListener.options === 'object' && eventListener.options.once) {\n this.removeEventListener(event.type, eventListener.listener);\n }\n } catch (error) {\n console.error('Error in document event listener:', error);\n }\n }\n \n return true;\n }\n\n /**\n * Set window reference for load event dispatching\n */\n setWindow(window: any): void {\n this._window = window;\n }\n\n /**\n * Change document ready state and dispatch events\n */\n setReadyState(state: DocumentReadyState): void {\n if (this._readyState === state) return;\n \n this._readyState = state;\n \n // Dispatch readystatechange event\n this.dispatchEvent({\n type: 'readystatechange',\n target: this,\n readyState: state\n });\n \n // Dispatch DOMContentLoaded when interactive\n if (state === 'interactive') {\n this.dispatchEvent({\n type: 'DOMContentLoaded',\n target: this\n });\n }\n \n // Dispatch load event on window when complete\n if (state === 'complete' && this._window) {\n // Use setTimeout to ensure it's dispatched after current execution\n setTimeout(() => {\n if (this._window && this._window.dispatchEvent) {\n this._window.dispatchEvent({\n type: 'load',\n target: this._window\n });\n }\n }, 0);\n }\n }\n\n /**\n * Simulate document loading process\n */\n simulateLoading(): void {\n // Start with loading state\n this.setReadyState('loading');\n \n // Simulate DOM parsing completion\n setTimeout(() => {\n this.setReadyState('interactive');\n \n // Simulate resource loading completion\n setTimeout(() => {\n this.setReadyState('complete');\n }, 10);\n }, 5);\n }\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA6B;AAC7B,kBAAkC;AAGlC,qBAAsB;AAGtB,kCAAmC;AAGnC,wBAA+C;AAE/C,wBAAyB;AACzB,qBAA6B;AAC7B,0BAA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f,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,YAAY;AAAA,IAChB,CAAC;AAGD,QAAI,UAAU,eAAe;AACzB,WAAK,cAAc;AAAA,QACf,MAAM;AAAA,QACN,QAAQ;AAAA,MACZ,CAAC;AAAA,IACL;AAGA,QAAI,UAAU,cAAc,KAAK,SAAS;AAEtC,iBAAW,MAAM;AACb,YAAI,KAAK,WAAW,KAAK,QAAQ,eAAe;AAC5C,eAAK,QAAQ,cAAc;AAAA,YACvB,MAAM;AAAA,YACN,QAAQ,KAAK;AAAA,UACjB,CAAC;AAAA,QACL;AAAA,MACJ,GAAG,CAAC;AAAA,IACR;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAwB;AAEpB,SAAK,cAAc,SAAS;AAG5B,eAAW,MAAM;AACb,WAAK,cAAc,aAAa;AAGhC,iBAAW,MAAM;AACb,aAAK,cAAc,UAAU;AAAA,MACjC,GAAG,EAAE;AAAA,IACT,GAAG,CAAC;AAAA,EACR;AACJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/node/elements/Element.ts"],
4
- "sourcesContent": ["import { Node } from '../Node';\nimport { ChildNode } from '../ChildNode';\nimport { ParentNode } from '../ParentNode';\nimport {HTMLCollectionOf} from '../collection/HTMLCollectionOf';\nimport {HTMLElement} from './HTMLElement';\nimport {SVGElement} from './SVGElement';\nimport {MathMLElement} from './MathMLElement';\nimport {HTMLElementTagNameMap, SVGElementTagNameMap, MathMLElementTagNameMap} from '../index';\n// Forward declarations for types that will be implemented later\nexport interface NamedNodeMap {\n readonly length: number;\n getNamedItem(qualifiedName: string): Attr | null;\n getNamedItemNS(namespace: string | null, localName: string): Attr | null;\n item(index: number): Attr | null;\n removeNamedItem(qualifiedName: string): Attr;\n removeNamedItemNS(namespace: string | null, localName: string): Attr;\n setNamedItem(attr: Attr): Attr | null;\n setNamedItemNS(attr: Attr): Attr | null;\n [index: number]: Attr;\n}\n\nexport interface Attr extends Node {\n readonly localName: string;\n readonly name: string;\n readonly namespaceURI: string | null;\n readonly ownerElement: Element | null;\n readonly prefix: string | null;\n readonly specified: boolean;\n value: string;\n}\n\nexport interface DOMRect {\n readonly bottom: number;\n readonly height: number;\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly width: number;\n readonly x: number;\n readonly y: number;\n}\n\nexport interface DOMRectList {\n readonly length: number;\n item(index: number): DOMRect | null;\n [index: number]: DOMRect;\n}\n\nexport interface ShadowRoot extends DocumentFragment {\n readonly delegatesFocus: boolean;\n readonly host: Element;\n readonly mode: ShadowRootMode;\n readonly slotAssignment: SlotAssignmentMode;\n}\n\nexport interface ShadowRootInit {\n delegatesFocus?: boolean;\n mode: ShadowRootMode;\n slotAssignment?: SlotAssignmentMode;\n}\n\nexport type ShadowRootMode = \"closed\" | \"open\";\nexport type SlotAssignmentMode = \"manual\" | \"named\";\n\nexport interface CheckVisibilityOptions {\n checkOpacity?: boolean;\n checkVisibilityCSS?: boolean;\n contentVisibilityAuto?: boolean;\n opacityProperty?: boolean;\n visibilityProperty?: boolean;\n}\n\nexport interface StylePropertyMapReadOnly {\n readonly size: number;\n entries(): IterableIterator<[string, CSSStyleValue[]]>;\n forEach(callbackfn: (value: CSSStyleValue[], key: string, parent: StylePropertyMapReadOnly) => void, thisArg?: any): void;\n get(property: string): CSSStyleValue | undefined;\n getAll(property: string): CSSStyleValue[];\n has(property: string): boolean;\n keys(): IterableIterator<string>;\n values(): IterableIterator<CSSStyleValue[]>;\n}\n\nexport interface CSSStyleValue {\n toString(): string;\n}\n\nexport interface GetHTMLOptions {\n serializableShadowRoots?: boolean;\n shadowRoots?: ShadowRoot[];\n}\n\nexport type InsertPosition = \"afterbegin\" | \"afterend\" | \"beforebegin\" | \"beforeend\";\n\nexport interface FullscreenOptions {\n navigationUI?: FullscreenNavigationUI;\n}\n\nexport type FullscreenNavigationUI = \"auto\" | \"hide\" | \"show\";\n\nexport interface PointerLockOptions {\n unadjustedMovement?: boolean;\n}\n\nexport interface ScrollToOptions {\n behavior?: ScrollBehavior;\n left?: number;\n top?: number;\n}\n\nexport interface ScrollIntoViewOptions extends ScrollToOptions {\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\nexport type ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\nexport type ScrollLogicalPosition = \"center\" | \"end\" | \"nearest\" | \"start\";\n\nexport interface ElementEventMap extends GlobalEventHandlersEventMap {\n \"fullscreenchange\": Event;\n \"fullscreenerror\": Event;\n}\n\nexport interface GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"animationcancel\": AnimationEvent;\n \"animationend\": AnimationEvent;\n \"animationiteration\": AnimationEvent;\n \"animationstart\": AnimationEvent;\n \"auxclick\": MouseEvent;\n \"beforeinput\": InputEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"close\": Event;\n \"compositionend\": CompositionEvent;\n \"compositionstart\": CompositionEvent;\n \"compositionupdate\": CompositionEvent;\n \"contextmenu\": MouseEvent;\n \"copy\": ClipboardEvent;\n \"cuechange\": Event;\n \"cut\": ClipboardEvent;\n \"dblclick\": MouseEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": Event;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"focusin\": FocusEvent;\n \"focusout\": FocusEvent;\n \"formdata\": FormDataEvent;\n \"gotpointercapture\": PointerEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"lostpointercapture\": PointerEvent;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"paste\": ClipboardEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"pointercancel\": PointerEvent;\n \"pointerdown\": PointerEvent;\n \"pointerenter\": PointerEvent;\n \"pointerleave\": PointerEvent;\n \"pointermove\": PointerEvent;\n \"pointerout\": PointerEvent;\n \"pointerover\": PointerEvent;\n \"pointerup\": PointerEvent;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"reset\": Event;\n \"resize\": UIEvent;\n \"scroll\": Event;\n \"securitypolicyviolation\": SecurityPolicyViolationEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": Event;\n \"selectionchange\": Event;\n \"selectstart\": Event;\n \"slotchange\": Event;\n \"stalled\": Event;\n \"submit\": SubmitEvent;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"toggle\": Event;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"transitioncancel\": TransitionEvent;\n \"transitionend\": TransitionEvent;\n \"transitionrun\": TransitionEvent;\n \"transitionstart\": TransitionEvent;\n \"volumechange\": Event;\n \"waiting\": Event;\n \"webkitanimationend\": Event;\n \"webkitanimationiteration\": Event;\n \"webkitanimationstart\": Event;\n \"webkittransitionend\": Event;\n \"wheel\": WheelEvent;\n}\n\n// Event interfaces (simplified declarations)\nexport interface Event {\n readonly type: string;\n readonly target: EventTarget | null;\n readonly currentTarget: EventTarget | null;\n readonly bubbles: boolean;\n readonly cancelable: boolean;\n readonly defaultPrevented: boolean;\n preventDefault(): void;\n stopPropagation(): void;\n stopImmediatePropagation(): void;\n}\n\nexport interface UIEvent extends Event {}\nexport interface MouseEvent extends UIEvent {}\nexport interface KeyboardEvent extends UIEvent {}\nexport interface FocusEvent extends UIEvent {}\nexport interface InputEvent extends UIEvent {}\nexport interface WheelEvent extends MouseEvent {}\nexport interface PointerEvent extends MouseEvent {}\nexport interface TouchEvent extends UIEvent {}\nexport interface DragEvent extends MouseEvent {}\nexport interface ClipboardEvent extends Event {}\nexport interface AnimationEvent extends Event {}\nexport interface TransitionEvent extends Event {}\nexport interface CompositionEvent extends UIEvent {}\nexport interface FormDataEvent extends Event {}\nexport interface ProgressEvent extends Event {}\nexport interface SecurityPolicyViolationEvent extends Event {}\nexport interface SubmitEvent extends Event {}\nexport interface ErrorEvent extends Event {}\n\nexport interface EventTarget {\n addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;\n dispatchEvent(event: Event): boolean;\n removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;\n}\n\nexport interface EventListenerOptions {\n capture?: boolean;\n}\n\nexport interface AddEventListenerOptions extends EventListenerOptions {\n once?: boolean;\n passive?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface EventListener {\n (evt: Event): void;\n}\n\nexport interface EventListenerObject {\n handleEvent(object: Event): void;\n}\n\nexport type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\nexport interface AbortSignal extends EventTarget {\n readonly aborted: boolean;\n readonly reason: any;\n}\n\n/**\n * **`Element`** is the most general base class from which all element objects (i.e. objects that represent elements) in a Document inherit.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element)\n */\nexport interface Element extends Node, ChildNode, ParentNode, EventTarget {\n /**\n * Returns the namespace-aware tag name of the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/tagName)\n */\n readonly tagName: string;\n\n /**\n * Returns the value of element's id content attribute. Can be set to change it.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/id)\n */\n id: string;\n\n /**\n * Returns the value of element's class content attribute. Can be set to change it.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/className)\n */\n className: string;\n\n /**\n * Returns the value of element's class content attribute as a DOMTokenList.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/classList)\n */\n readonly classList: DOMTokenList;\n\n /**\n * Returns a string representation of the markup of the element's content.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/innerHTML)\n */\n innerHTML: string;\n\n /**\n * Returns a string representation of the element and its descendants.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/outerHTML)\n */\n outerHTML: string;\n\n /**\n * Returns the local part of the qualified name of the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/localName)\n */\n readonly localName: string;\n\n /**\n * Returns the namespace URI of the element, or null if it is no namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/namespaceURI)\n */\n readonly namespaceURI: string | null;\n\n /**\n * Returns the namespace prefix of the element, or null if no prefix is specified.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/prefix)\n */\n readonly prefix: string | null;\n\n /**\n * Returns the value of a specified attribute on the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttribute)\n */\n getAttribute(qualifiedName: string): string | null;\n\n /**\n * Sets the value of an attribute on the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttribute)\n */\n setAttribute(qualifiedName: string, value: string): void;\n\n /**\n * Removes an attribute from the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttribute)\n */\n removeAttribute(qualifiedName: string): void;\n\n /**\n * Returns a Boolean value indicating whether the specified element has the specified attribute or not.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttribute)\n */\n hasAttribute(qualifiedName: string): boolean;\n\n /**\n * Returns the closest ancestor element (including the element itself) that matches the specified CSS selector.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/closest)\n */\n closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;\n closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;\n closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;\n closest<E extends Element = Element>(selectors: string): E | null;\n\n /**\n * Returns true if the element would be selected by the specified CSS selector; otherwise, returns false.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches)\n */\n matches(selectors: string): boolean;\n\n // Additional Element properties and methods\n\n /**\n * The **`Element.attributes`** property returns a live collection of all attribute nodes registered to the specified node.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attributes)\n */\n readonly attributes: NamedNodeMap;\n\n /**\n * The **`clientHeight`** read-only property of the Element interface is zero for elements with no CSS or inline layout boxes; otherwise, it's the inner height of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientHeight)\n */\n readonly clientHeight: number;\n\n /**\n * The **`clientLeft`** read-only property of the Element interface returns the width of the left border of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientLeft)\n */\n readonly clientLeft: number;\n\n /**\n * The **`clientTop`** read-only property of the Element interface returns the width of the top border of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientTop)\n */\n readonly clientTop: number;\n\n /**\n * The **`clientWidth`** read-only property of the Element interface is zero for inline elements and elements with no CSS; otherwise, it's the inner width of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientWidth)\n */\n readonly clientWidth: number;\n\n /**\n * The **`currentCSSZoom`** read-only property of the Element interface provides the 'effective' CSS `zoom` of an element, taking into account the zoom applied to the element and all its parent elements.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/currentCSSZoom)\n */\n readonly currentCSSZoom: number;\n\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenchange_event) */\n onfullscreenchange: ((this: Element, ev: Event) => any) | null;\n\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenerror_event) */\n onfullscreenerror: ((this: Element, ev: Event) => any) | null;\n\n /**\n * The **`part`** property of the Element interface represents the part identifier(s) of the element (i.e., set using the `part` attribute), returned as a DOMTokenList.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/part)\n */\n readonly part: DOMTokenList;\n\n /**\n * The **`scrollHeight`** read-only property of the Element interface is a measurement of the height of an element's content, including content not visible on the screen due to overflow.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollHeight)\n */\n readonly scrollHeight: number;\n\n /**\n * The **`scrollLeft`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its left edge.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)\n */\n scrollLeft: number;\n\n /**\n * The **`scrollTop`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its top edge.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)\n */\n scrollTop: number;\n\n /**\n * The **`scrollWidth`** read-only property of the Element interface is a measurement of the width of an element's content, including content not visible on the screen due to overflow.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)\n */\n readonly scrollWidth: number;\n\n /**\n * The `Element.shadowRoot` read-only property represents the shadow root hosted by the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/shadowRoot)\n */\n readonly shadowRoot: ShadowRoot | null;\n\n /**\n * The **`slot`** property of the Element interface returns the name of the shadow DOM slot the element is inserted in.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/slot)\n */\n slot: string;\n\n // Methods\n\n /**\n * The **`Element.attachShadow()`** method attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attachShadow)\n */\n attachShadow(init: ShadowRootInit): ShadowRoot;\n\n /**\n * The **`checkVisibility()`** method of the Element interface checks whether the element is visible.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/checkVisibility)\n */\n checkVisibility(options?: CheckVisibilityOptions): boolean;\n\n /**\n * The **`computedStyleMap()`** method of the Element interface returns a StylePropertyMapReadOnly interface which provides a read-only representation of a CSS declaration block that is an alternative to CSSStyleDeclaration.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/computedStyleMap)\n */\n computedStyleMap(): StylePropertyMapReadOnly;\n\n /**\n * The **`getAttributeNS()`** method of the Element interface returns the string value of the attribute with the specified namespace and name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNS)\n */\n getAttributeNS(namespace: string | null, localName: string): string | null;\n\n /**\n * The **`getAttributeNames()`** method of the Element interface returns the attribute names of the element as an Array of strings.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNames)\n */\n getAttributeNames(): string[];\n\n /**\n * Returns the specified attribute of the specified element, as an Attr node.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNode)\n */\n getAttributeNode(qualifiedName: string): Attr | null;\n\n /**\n * The **`getAttributeNodeNS()`** method of the Element interface returns the namespaced Attr node of an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNodeNS)\n */\n getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;\n\n /**\n * The **`Element.getBoundingClientRect()`** method returns a DOMRect object providing information about the size of an element and its position relative to the viewport.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getBoundingClientRect)\n */\n getBoundingClientRect(): DOMRect;\n\n /**\n * The **`getClientRects()`** method of the Element interface returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getClientRects)\n */\n getClientRects(): DOMRectList;\n\n /**\n * The Element method **`getElementsByClassName()`** returns a live HTMLCollectionOf which contains every descendant element which has the specified class name or names.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByClassName)\n */\n getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`Element.getElementsByTagName()`** method returns a live HTMLCollectionOf of elements with the given tag name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagName)\n */\n getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`Element.getElementsByTagNameNS()`** method returns a live HTMLCollectionOf of elements with the given tag name belonging to the given namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagNameNS)\n */\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", localName: string): HTMLCollectionOf<MathMLElement>;\n getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`getHTML()`** method of the Element interface is used to serialize an element's DOM to an HTML string.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getHTML)\n */\n getHTML(options?: GetHTMLOptions): string;\n\n /**\n * The **`hasAttributeNS()`** method of the Element interface returns a boolean value indicating whether the current element has the specified attribute with the specified namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributeNS)\n */\n hasAttributeNS(namespace: string | null, localName: string): boolean;\n\n /**\n * The **`hasAttributes()`** method of the Element interface returns a boolean value indicating whether the current element has any attributes or not.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributes)\n */\n hasAttributes(): boolean;\n\n /**\n * The **`hasPointerCapture()`** method of the Element interface checks whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer ID.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasPointerCapture)\n */\n hasPointerCapture(pointerId: number): boolean;\n\n /**\n * The **`insertAdjacentElement()`** method of the Element interface inserts a given element node at a given position relative to the element it is invoked upon.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentElement)\n */\n insertAdjacentElement(where: InsertPosition, element: Element): Element | null;\n\n /**\n * The **`insertAdjacentHTML()`** method of the Element interface parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentHTML)\n */\n insertAdjacentHTML(position: InsertPosition, string: string): void;\n\n /**\n * The **`insertAdjacentText()`** method of the Element interface, given a relative position and a string, inserts a new text node at the given position relative to the element it is called from.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentText)\n */\n insertAdjacentText(where: InsertPosition, data: string): void;\n\n /**\n * The **`releasePointerCapture()`** method of the Element interface releases (stops) pointer capture that was previously set for a specific PointerEvent.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/releasePointerCapture)\n */\n releasePointerCapture(pointerId: number): void;\n\n /**\n * The **`removeAttributeNS()`** method of the Element interface removes the specified attribute from an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNS)\n */\n removeAttributeNS(namespace: string | null, localName: string): void;\n\n /**\n * The **`removeAttributeNode()`** method of the Element interface removes the specified Attr node from the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNode)\n */\n removeAttributeNode(attr: Attr): Attr;\n\n /**\n * The **`Element.requestFullscreen()`** method issues an asynchronous request to make the element be displayed in fullscreen mode.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestFullscreen)\n */\n requestFullscreen(options?: FullscreenOptions): Promise<void>;\n\n /**\n * The **`requestPointerLock()`** method of the Element interface lets you asynchronously ask for the pointer to be locked on the given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestPointerLock)\n */\n requestPointerLock(options?: PointerLockOptions): Promise<void>;\n\n /**\n * The **`scroll()`** method of the Element interface scrolls the element to a particular set of coordinates inside a given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll)\n */\n scroll(options?: ScrollToOptions): void;\n scroll(x: number, y: number): void;\n\n /**\n * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy)\n */\n scrollBy(options?: ScrollToOptions): void;\n scrollBy(x: number, y: number): void;\n\n /**\n * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which `scrollIntoView()` is called is visible to the user.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)\n */\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n\n /**\n * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo)\n */\n scrollTo(options?: ScrollToOptions): void;\n scrollTo(x: number, y: number): void;\n\n /**\n * `setAttributeNS` adds a new attribute or changes the value of an attribute with the given namespace and name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNS)\n */\n setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;\n\n /**\n * The **`setAttributeNode()`** method of the Element interface adds a new Attr node to the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNode)\n */\n setAttributeNode(attr: Attr): Attr | null;\n\n /**\n * The **`setAttributeNodeNS()`** method of the Element interface adds a new namespaced Attr node to an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNodeNS)\n */\n setAttributeNodeNS(attr: Attr): Attr | null;\n\n /**\n * The **`setHTMLUnsafe()`** method of the Element interface is used to parse a string of HTML into a DocumentFragment, optionally filtering out unwanted elements and attributes, and those that don't belong in the context, and then using it to replace the element's subtree in the DOM.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setHTMLUnsafe)\n */\n setHTMLUnsafe(html: string): void;\n\n /**\n * The **`setPointerCapture()`** method of the Element interface is used to designate a specific element as the capture target of future pointer events.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setPointerCapture)\n */\n setPointerCapture(pointerId: number): void;\n\n /**\n * The **`toggleAttribute()`** method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/toggleAttribute)\n */\n toggleAttribute(qualifiedName: string, force?: boolean): boolean;\n\n /**\n * @deprecated This is a legacy alias of `matches`.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches)\n */\n webkitMatchesSelector(selectors: string): boolean;\n}\n\n// \uAE30\uBCF8 \uD0C0\uC785\uB4E4 \uC815\uC758\nexport interface DOMTokenList {\n readonly length: number;\n value: string;\n add(...tokens: string[]): void;\n remove(...tokens: string[]): void;\n contains(token: string): boolean;\n toggle(token: string, force?: boolean): boolean;\n replace(oldToken: string, newToken: string): boolean;\n item(index: number): string | null;\n [index: number]: string;\n}\n\n// Export Element as the main interface"],
4
+ "sourcesContent": ["import { Node } from '../Node';\nimport { ChildNode } from '../ChildNode';\nimport { ParentNode } from '../ParentNode';\nimport { HTMLCollectionOf } from '../collection/HTMLCollectionOf';\nimport { HTMLElement } from './HTMLElement';\nimport { SVGElement } from './SVGElement';\nimport { MathMLElement } from './MathMLElement';\nimport { HTMLElementTagNameMap, SVGElementTagNameMap, MathMLElementTagNameMap } from '../index';\n// Forward declarations for types that will be implemented later\nexport interface NamedNodeMap {\n readonly length: number;\n getNamedItem(qualifiedName: string): Attr | null;\n getNamedItemNS(namespace: string | null, localName: string): Attr | null;\n item(index: number): Attr | null;\n removeNamedItem(qualifiedName: string): Attr;\n removeNamedItemNS(namespace: string | null, localName: string): Attr;\n setNamedItem(attr: Attr): Attr | null;\n setNamedItemNS(attr: Attr): Attr | null;\n [index: number]: Attr;\n}\n\nexport interface Attr extends Node {\n readonly localName: string;\n readonly name: string;\n readonly namespaceURI: string | null;\n readonly ownerElement: Element | null;\n readonly prefix: string | null;\n readonly specified: boolean;\n value: string;\n}\n\nexport interface DOMRect {\n readonly bottom: number;\n readonly height: number;\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly width: number;\n readonly x: number;\n readonly y: number;\n toJSON(): any;\n}\n\nexport interface DOMRectList {\n readonly length: number;\n item(index: number): DOMRect | null;\n [index: number]: DOMRect;\n}\n\nexport interface ShadowRoot extends DocumentFragment {\n readonly delegatesFocus: boolean;\n readonly host: Element;\n readonly mode: ShadowRootMode;\n readonly slotAssignment: SlotAssignmentMode;\n}\n\nexport interface ShadowRootInit {\n delegatesFocus?: boolean;\n mode: ShadowRootMode;\n slotAssignment?: SlotAssignmentMode;\n}\n\nexport type ShadowRootMode = \"closed\" | \"open\";\nexport type SlotAssignmentMode = \"manual\" | \"named\";\n\nexport interface CheckVisibilityOptions {\n checkOpacity?: boolean;\n checkVisibilityCSS?: boolean;\n contentVisibilityAuto?: boolean;\n opacityProperty?: boolean;\n visibilityProperty?: boolean;\n}\n\nexport interface StylePropertyMapReadOnly {\n readonly size: number;\n entries(): IterableIterator<[string, CSSStyleValue[]]>;\n forEach(callbackfn: (value: CSSStyleValue[], key: string, parent: StylePropertyMapReadOnly) => void, thisArg?: any): void;\n get(property: string): CSSStyleValue | undefined;\n getAll(property: string): CSSStyleValue[];\n has(property: string): boolean;\n keys(): IterableIterator<string>;\n values(): IterableIterator<CSSStyleValue[]>;\n}\n\nexport interface CSSStyleValue {\n toString(): string;\n}\n\nexport interface GetHTMLOptions {\n serializableShadowRoots?: boolean;\n shadowRoots?: ShadowRoot[];\n}\n\nexport type InsertPosition = \"afterbegin\" | \"afterend\" | \"beforebegin\" | \"beforeend\";\n\nexport interface FullscreenOptions {\n navigationUI?: FullscreenNavigationUI;\n}\n\nexport type FullscreenNavigationUI = \"auto\" | \"hide\" | \"show\";\n\nexport interface PointerLockOptions {\n unadjustedMovement?: boolean;\n}\n\nexport interface ScrollToOptions {\n behavior?: ScrollBehavior;\n left?: number;\n top?: number;\n}\n\nexport interface ScrollIntoViewOptions extends ScrollToOptions {\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\nexport type ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\nexport type ScrollLogicalPosition = \"center\" | \"end\" | \"nearest\" | \"start\";\n\nexport interface ElementEventMap extends GlobalEventHandlersEventMap {\n \"fullscreenchange\": Event;\n \"fullscreenerror\": Event;\n}\n\nexport interface GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"animationcancel\": AnimationEvent;\n \"animationend\": AnimationEvent;\n \"animationiteration\": AnimationEvent;\n \"animationstart\": AnimationEvent;\n \"auxclick\": MouseEvent;\n \"beforeinput\": InputEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"close\": Event;\n \"compositionend\": CompositionEvent;\n \"compositionstart\": CompositionEvent;\n \"compositionupdate\": CompositionEvent;\n \"contextmenu\": MouseEvent;\n \"copy\": ClipboardEvent;\n \"cuechange\": Event;\n \"cut\": ClipboardEvent;\n \"dblclick\": MouseEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": Event;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"focusin\": FocusEvent;\n \"focusout\": FocusEvent;\n \"formdata\": FormDataEvent;\n \"gotpointercapture\": PointerEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"lostpointercapture\": PointerEvent;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"paste\": ClipboardEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"pointercancel\": PointerEvent;\n \"pointerdown\": PointerEvent;\n \"pointerenter\": PointerEvent;\n \"pointerleave\": PointerEvent;\n \"pointermove\": PointerEvent;\n \"pointerout\": PointerEvent;\n \"pointerover\": PointerEvent;\n \"pointerup\": PointerEvent;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"reset\": Event;\n \"resize\": UIEvent;\n \"scroll\": Event;\n \"securitypolicyviolation\": SecurityPolicyViolationEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": Event;\n \"selectionchange\": Event;\n \"selectstart\": Event;\n \"slotchange\": Event;\n \"stalled\": Event;\n \"submit\": SubmitEvent;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"toggle\": Event;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"transitioncancel\": TransitionEvent;\n \"transitionend\": TransitionEvent;\n \"transitionrun\": TransitionEvent;\n \"transitionstart\": TransitionEvent;\n \"volumechange\": Event;\n \"waiting\": Event;\n \"webkitanimationend\": Event;\n \"webkitanimationiteration\": Event;\n \"webkitanimationstart\": Event;\n \"webkittransitionend\": Event;\n \"wheel\": WheelEvent;\n}\n\n// Event interfaces (simplified declarations)\nexport interface Event {\n readonly type: string;\n readonly target: EventTarget | null;\n readonly currentTarget: EventTarget | null;\n readonly bubbles: boolean;\n readonly cancelable: boolean;\n readonly defaultPrevented: boolean;\n preventDefault(): void;\n stopPropagation(): void;\n stopImmediatePropagation(): void;\n}\n\nexport interface UIEvent extends Event { }\nexport interface MouseEvent extends UIEvent { }\nexport interface KeyboardEvent extends UIEvent { }\nexport interface FocusEvent extends UIEvent { }\nexport interface InputEvent extends UIEvent { }\nexport interface WheelEvent extends MouseEvent { }\nexport interface PointerEvent extends MouseEvent { }\nexport interface TouchEvent extends UIEvent { }\nexport interface DragEvent extends MouseEvent { }\nexport interface ClipboardEvent extends Event { }\nexport interface AnimationEvent extends Event { }\nexport interface TransitionEvent extends Event { }\nexport interface CompositionEvent extends UIEvent { }\nexport interface FormDataEvent extends Event { }\nexport interface ProgressEvent extends Event { }\nexport interface SecurityPolicyViolationEvent extends Event { }\nexport interface SubmitEvent extends Event { }\nexport interface ErrorEvent extends Event { }\n\nexport interface EventTarget {\n addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;\n dispatchEvent(event: Event): boolean;\n removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;\n}\n\nexport interface EventListenerOptions {\n capture?: boolean;\n}\n\nexport interface AddEventListenerOptions extends EventListenerOptions {\n once?: boolean;\n passive?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface EventListener {\n (evt: Event): void;\n}\n\nexport interface EventListenerObject {\n handleEvent(object: Event): void;\n}\n\nexport type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\nexport interface AbortSignal extends EventTarget {\n readonly aborted: boolean;\n readonly reason: any;\n}\n\n/**\n * **`Element`** is the most general base class from which all element objects (i.e. objects that represent elements) in a Document inherit.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element)\n */\nexport interface Element extends Node, ChildNode, ParentNode, EventTarget {\n /**\n * Returns the namespace-aware tag name of the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/tagName)\n */\n readonly tagName: string;\n\n /**\n * Returns the value of element's id content attribute. Can be set to change it.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/id)\n */\n id: string;\n\n /**\n * Returns the value of element's class content attribute. Can be set to change it.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/className)\n */\n className: string;\n\n /**\n * Returns the value of element's class content attribute as a DOMTokenList.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/classList)\n */\n readonly classList: DOMTokenList;\n\n /**\n * Returns a string representation of the markup of the element's content.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/innerHTML)\n */\n innerHTML: string;\n\n /**\n * Returns a string representation of the element and its descendants.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/outerHTML)\n */\n outerHTML: string;\n\n /**\n * Returns the local part of the qualified name of the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/localName)\n */\n readonly localName: string;\n\n /**\n * Returns the namespace URI of the element, or null if it is no namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/namespaceURI)\n */\n readonly namespaceURI: string | null;\n\n /**\n * Returns the namespace prefix of the element, or null if no prefix is specified.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/prefix)\n */\n readonly prefix: string | null;\n\n /**\n * Returns the value of a specified attribute on the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttribute)\n */\n getAttribute(qualifiedName: string): string | null;\n\n /**\n * Sets the value of an attribute on the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttribute)\n */\n setAttribute(qualifiedName: string, value: string): void;\n\n /**\n * Removes an attribute from the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttribute)\n */\n removeAttribute(qualifiedName: string): void;\n\n /**\n * Returns a Boolean value indicating whether the specified element has the specified attribute or not.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttribute)\n */\n hasAttribute(qualifiedName: string): boolean;\n\n /**\n * Returns the closest ancestor element (including the element itself) that matches the specified CSS selector.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/closest)\n */\n closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;\n closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;\n closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;\n closest<E extends Element = Element>(selectors: string): E | null;\n\n /**\n * Returns true if the element would be selected by the specified CSS selector; otherwise, returns false.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches)\n */\n matches(selectors: string): boolean;\n\n // Additional Element properties and methods\n\n /**\n * The **`Element.attributes`** property returns a live collection of all attribute nodes registered to the specified node.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attributes)\n */\n readonly attributes: NamedNodeMap;\n\n /**\n * The **`clientHeight`** read-only property of the Element interface is zero for elements with no CSS or inline layout boxes; otherwise, it's the inner height of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientHeight)\n */\n readonly clientHeight: number;\n\n /**\n * The **`clientLeft`** read-only property of the Element interface returns the width of the left border of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientLeft)\n */\n readonly clientLeft: number;\n\n /**\n * The **`clientTop`** read-only property of the Element interface returns the width of the top border of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientTop)\n */\n readonly clientTop: number;\n\n /**\n * The **`clientWidth`** read-only property of the Element interface is zero for inline elements and elements with no CSS; otherwise, it's the inner width of an element in pixels.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientWidth)\n */\n readonly clientWidth: number;\n\n /**\n * The **`currentCSSZoom`** read-only property of the Element interface provides the 'effective' CSS `zoom` of an element, taking into account the zoom applied to the element and all its parent elements.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/currentCSSZoom)\n */\n readonly currentCSSZoom: number;\n\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenchange_event) */\n onfullscreenchange: ((this: Element, ev: Event) => any) | null;\n\n /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenerror_event) */\n onfullscreenerror: ((this: Element, ev: Event) => any) | null;\n\n /**\n * The **`part`** property of the Element interface represents the part identifier(s) of the element (i.e., set using the `part` attribute), returned as a DOMTokenList.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/part)\n */\n readonly part: DOMTokenList;\n\n /**\n * The **`scrollHeight`** read-only property of the Element interface is a measurement of the height of an element's content, including content not visible on the screen due to overflow.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollHeight)\n */\n readonly scrollHeight: number;\n\n /**\n * The **`scrollLeft`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its left edge.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)\n */\n scrollLeft: number;\n\n /**\n * The **`scrollTop`** property of the Element interface gets or sets the number of pixels by which an element's content is scrolled from its top edge.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)\n */\n scrollTop: number;\n\n /**\n * The **`scrollWidth`** read-only property of the Element interface is a measurement of the width of an element's content, including content not visible on the screen due to overflow.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)\n */\n readonly scrollWidth: number;\n\n /**\n * The `Element.shadowRoot` read-only property represents the shadow root hosted by the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/shadowRoot)\n */\n readonly shadowRoot: ShadowRoot | null;\n\n /**\n * The **`slot`** property of the Element interface returns the name of the shadow DOM slot the element is inserted in.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/slot)\n */\n slot: string;\n\n // Methods\n\n /**\n * The **`Element.attachShadow()`** method attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attachShadow)\n */\n attachShadow(init: ShadowRootInit): ShadowRoot;\n\n /**\n * The **`checkVisibility()`** method of the Element interface checks whether the element is visible.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/checkVisibility)\n */\n checkVisibility(options?: CheckVisibilityOptions): boolean;\n\n /**\n * The **`computedStyleMap()`** method of the Element interface returns a StylePropertyMapReadOnly interface which provides a read-only representation of a CSS declaration block that is an alternative to CSSStyleDeclaration.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/computedStyleMap)\n */\n computedStyleMap(): StylePropertyMapReadOnly;\n\n /**\n * The **`getAttributeNS()`** method of the Element interface returns the string value of the attribute with the specified namespace and name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNS)\n */\n getAttributeNS(namespace: string | null, localName: string): string | null;\n\n /**\n * The **`getAttributeNames()`** method of the Element interface returns the attribute names of the element as an Array of strings.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNames)\n */\n getAttributeNames(): string[];\n\n /**\n * Returns the specified attribute of the specified element, as an Attr node.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNode)\n */\n getAttributeNode(qualifiedName: string): Attr | null;\n\n /**\n * The **`getAttributeNodeNS()`** method of the Element interface returns the namespaced Attr node of an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNodeNS)\n */\n getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;\n\n /**\n * The **`Element.getBoundingClientRect()`** method returns a DOMRect object providing information about the size of an element and its position relative to the viewport.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getBoundingClientRect)\n */\n getBoundingClientRect(): DOMRect;\n\n /**\n * The **`getClientRects()`** method of the Element interface returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getClientRects)\n */\n getClientRects(): DOMRectList;\n\n /**\n * The Element method **`getElementsByClassName()`** returns a live HTMLCollectionOf which contains every descendant element which has the specified class name or names.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByClassName)\n */\n getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`Element.getElementsByTagName()`** method returns a live HTMLCollectionOf of elements with the given tag name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagName)\n */\n getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`Element.getElementsByTagNameNS()`** method returns a live HTMLCollectionOf of elements with the given tag name belonging to the given namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagNameNS)\n */\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf<HTMLElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf<SVGElement>;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1998/Math/MathML\", localName: string): HTMLCollectionOf<MathMLElement>;\n getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;\n\n /**\n * The **`getHTML()`** method of the Element interface is used to serialize an element's DOM to an HTML string.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getHTML)\n */\n getHTML(options?: GetHTMLOptions): string;\n\n /**\n * The **`hasAttributeNS()`** method of the Element interface returns a boolean value indicating whether the current element has the specified attribute with the specified namespace.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributeNS)\n */\n hasAttributeNS(namespace: string | null, localName: string): boolean;\n\n /**\n * The **`hasAttributes()`** method of the Element interface returns a boolean value indicating whether the current element has any attributes or not.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributes)\n */\n hasAttributes(): boolean;\n\n /**\n * The **`hasPointerCapture()`** method of the Element interface checks whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer ID.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasPointerCapture)\n */\n hasPointerCapture(pointerId: number): boolean;\n\n /**\n * The **`insertAdjacentElement()`** method of the Element interface inserts a given element node at a given position relative to the element it is invoked upon.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentElement)\n */\n insertAdjacentElement(where: InsertPosition, element: Element): Element | null;\n\n /**\n * The **`insertAdjacentHTML()`** method of the Element interface parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentHTML)\n */\n insertAdjacentHTML(position: InsertPosition, string: string): void;\n\n /**\n * The **`insertAdjacentText()`** method of the Element interface, given a relative position and a string, inserts a new text node at the given position relative to the element it is called from.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentText)\n */\n insertAdjacentText(where: InsertPosition, data: string): void;\n\n /**\n * The **`releasePointerCapture()`** method of the Element interface releases (stops) pointer capture that was previously set for a specific PointerEvent.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/releasePointerCapture)\n */\n releasePointerCapture(pointerId: number): void;\n\n /**\n * The **`removeAttributeNS()`** method of the Element interface removes the specified attribute from an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNS)\n */\n removeAttributeNS(namespace: string | null, localName: string): void;\n\n /**\n * The **`removeAttributeNode()`** method of the Element interface removes the specified Attr node from the element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNode)\n */\n removeAttributeNode(attr: Attr): Attr;\n\n /**\n * The **`Element.requestFullscreen()`** method issues an asynchronous request to make the element be displayed in fullscreen mode.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestFullscreen)\n */\n requestFullscreen(options?: FullscreenOptions): Promise<void>;\n\n /**\n * The **`requestPointerLock()`** method of the Element interface lets you asynchronously ask for the pointer to be locked on the given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestPointerLock)\n */\n requestPointerLock(options?: PointerLockOptions): Promise<void>;\n\n /**\n * The **`scroll()`** method of the Element interface scrolls the element to a particular set of coordinates inside a given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll)\n */\n scroll(options?: ScrollToOptions): void;\n scroll(x: number, y: number): void;\n\n /**\n * The **`scrollBy()`** method of the Element interface scrolls an element by the given amount.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy)\n */\n scrollBy(options?: ScrollToOptions): void;\n scrollBy(x: number, y: number): void;\n\n /**\n * The Element interface's **`scrollIntoView()`** method scrolls the element's ancestor containers such that the element on which `scrollIntoView()` is called is visible to the user.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)\n */\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n\n /**\n * The **`scrollTo()`** method of the Element interface scrolls to a particular set of coordinates inside a given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo)\n */\n scrollTo(options?: ScrollToOptions): void;\n scrollTo(x: number, y: number): void;\n\n /**\n * `setAttributeNS` adds a new attribute or changes the value of an attribute with the given namespace and name.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNS)\n */\n setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;\n\n /**\n * The **`setAttributeNode()`** method of the Element interface adds a new Attr node to the specified element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNode)\n */\n setAttributeNode(attr: Attr): Attr | null;\n\n /**\n * The **`setAttributeNodeNS()`** method of the Element interface adds a new namespaced Attr node to an element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNodeNS)\n */\n setAttributeNodeNS(attr: Attr): Attr | null;\n\n /**\n * The **`setHTMLUnsafe()`** method of the Element interface is used to parse a string of HTML into a DocumentFragment, optionally filtering out unwanted elements and attributes, and those that don't belong in the context, and then using it to replace the element's subtree in the DOM.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setHTMLUnsafe)\n */\n setHTMLUnsafe(html: string): void;\n\n /**\n * The **`setPointerCapture()`** method of the Element interface is used to designate a specific element as the capture target of future pointer events.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setPointerCapture)\n */\n setPointerCapture(pointerId: number): void;\n\n /**\n * The **`toggleAttribute()`** method of the Element interface toggles a Boolean attribute (removing it if it is present and adding it if it is not present) on the given element.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/toggleAttribute)\n */\n toggleAttribute(qualifiedName: string, force?: boolean): boolean;\n\n /**\n * @deprecated This is a legacy alias of `matches`.\n * \n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches)\n */\n webkitMatchesSelector(selectors: string): boolean;\n}\n\n// \uAE30\uBCF8 \uD0C0\uC785\uB4E4 \uC815\uC758\nexport interface DOMTokenList {\n readonly length: number;\n value: string;\n add(...tokens: string[]): void;\n remove(...tokens: string[]): void;\n contains(token: string): boolean;\n toggle(token: string, force?: boolean): boolean;\n replace(oldToken: string, newToken: string): boolean;\n item(index: number): string | null;\n [index: number]: string;\n}\n\n// Export Element as the main interface"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -110,7 +110,7 @@ class ElementBase extends import_ParentNodeBase.ParentNodeBase {
110
110
  */
111
111
  generateChildElementHTML(element) {
112
112
  const tagName = element.tagName.toLowerCase();
113
- const attrs = Array.from(element._attributes?.entries() || []).map(([name, value]) => value === "" ? ` ${name}` : ` ${name}="${value.replace(/"/g, "&quot;")}"`).join("");
113
+ const attrs = Array.from(element._attributes?.entries() || []).map(([name, value]) => value === "" ? ` ${name}` : ` ${name}="${String(value).replace(/"/g, "&quot;")}"`).join("");
114
114
  const selfClosingTags = ["img", "input", "br", "hr", "meta", "link", "area", "base", "col", "embed", "source", "track", "wbr"];
115
115
  const isSelfClosing = selfClosingTags.includes(tagName);
116
116
  if (isSelfClosing) {
@@ -542,7 +542,17 @@ class ElementBase extends import_ParentNodeBase.ParentNodeBase {
542
542
  return this.getAttributeNode(localName);
543
543
  }
544
544
  getBoundingClientRect() {
545
- throw new Error("Element.getBoundingClientRect() is not implemented yet");
545
+ return {
546
+ bottom: 0,
547
+ height: 0,
548
+ left: 0,
549
+ right: 0,
550
+ top: 0,
551
+ width: 0,
552
+ x: 0,
553
+ y: 0,
554
+ toJSON: () => ({})
555
+ };
546
556
  }
547
557
  getClientRects() {
548
558
  throw new Error("Element.getClientRects() is not implemented yet");