From a59ccb4d740e0a9c19fd48bea3ea327ad291e3b1 Mon Sep 17 00:00:00 2001 From: Flaki Date: Mon, 11 Mar 2024 18:49:24 +0200 Subject: [PATCH] Release v0.1.1 --- lib/fauxdom-with-canvas.cjs | 2 +- lib/fauxdom-with-canvas.cjs.map | 1 + lib/fauxdom-with-canvas.js | 2 +- lib/fauxdom-with-canvas.mjs | 2 +- lib/fauxdom-with-canvas.tests.cjs | 3399 +++++++++++++++++++++++++ lib/fauxdom-with-canvas.tests.cjs.map | 1 + 6 files changed, 3404 insertions(+), 3 deletions(-) create mode 100644 lib/fauxdom-with-canvas.cjs.map create mode 100644 lib/fauxdom-with-canvas.tests.cjs create mode 100644 lib/fauxdom-with-canvas.tests.cjs.map diff --git a/lib/fauxdom-with-canvas.cjs b/lib/fauxdom-with-canvas.cjs index 09e8621..edd45e8 100644 --- a/lib/fauxdom-with-canvas.cjs +++ b/lib/fauxdom-with-canvas.cjs @@ -1,3 +1,3 @@ const e={},t={},s=Object.prototype.hasOwnProperty.bind(t),i=null;class r{constructor(e){if(this.index=0,this.str=e,this.scanChar=this.str[this.index],!s(" ")){for(let e=0;e<=32;e++)t[String.fromCharCode(e)]=null;for(let e=128;e<=159;e++)t[String.fromCharCode(e)]=null}}isWhiteSpace(e){return e!==i&&s(e)}goToString(t,s){if(!1!==s)this.index=this.str.indexOf(t,this.index);else{e[t]||(e[t]=new RegExp(t,"ig")),e[t].lastIndex=this.index;const s=e[t].exec(this.str);this.index=s?s.index:-1}this.index>-1?this.scanChar=this.str[this.index]:(this.index=this.str.length,this.scanChar=i)}goToIndex(e){this.scanChar=this.str[this.index=e]}advance(e){return this.index+=e,this.index>this.str.length?(this.index=this.str.length,this.scanChar=i):this.scanChar=this.str[this.index]}match(e,t){var s=this.str.substr(this.index,e.length);return!1===t&&(e=e.toLowerCase(),s=s.toLowerCase()),s===e&&(this.index+=e.length-1,this.getNextChar(),!0)}peek(){return this.str[this.index+1]}getChar(){return this.scanChar}getNextChar(){return this.index+1e.callback===t&&e.capturing===r?s:void 0)).reverse().forEach((e=>{void 0!==e&&i.splice(e,1)}))}dispatchEvent(e){let t=!0;if(!this[n])return t;const s=this[n].get(e.type)??[];return s?.forEach((({callback:s})=>{s(e),e.defaultPrevented&&(t=!1)})),t}}const a=Symbol("doctype"),l=Symbol("head"),h=Symbol("body"),c=Symbol("documentElement"),d=Symbol("nodeType"),u=Symbol("parentNode"),p=Symbol("ownerDocument"),N=Symbol("tagName"),f=Symbol("parserOptions"),g=/\s+/g,E={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11},T={AREA:!0,BASE:!0,BR:!0,COL:!0,COMMAND:!0,EMBED:!0,HR:!0,IMG:!0,INPUT:!0,KEYGEN:!0,LINK:!0,META:!0,PARAM:!0,SOURCE:!0,TRACK:!0,WBR:!0};function m(e){var t=-1,s=-1,i="HTML";e[a]&&e[f].allowCustomRootElement&&(i=e[a].name.toUpperCase());for(let r=0,n=e.childNodes.length;r0)for(let t=0;t{e[p]=s}),null),e[u]=t,e[p]=s}function C(e){if(!e.global){let t=e.flags;e=new RegExp(e.source,t+"g")}return e}const b=Symbol("element"),D=Symbol("length"),w=/^\S+$/,S=Array.prototype.indexOf,_=Array.prototype.join,A=Array.prototype.splice;class I{constructor(){throw new Error("Cannot directly instantiate DOMTokenList.")}get length(){return this[D]}set length(e){}get value(){return _.call(this," ")}set value(e){if(this[D]>0)for(let e in this)this.hasOwnProperty(e)&&isFinite(e)&&delete this[e];this[D]=0,"string"==typeof e?this.add.apply(this,e.split(g)):delete this[b].attributes.class}add(){for(let e=0;e=0&&e=0&&this.supports(t))&&(-1===S.call(this,t)?this[s]=t:(A.call(this,s,1),this[D]--),this[b].attributes.class=this.value,!0)}supports(e){return!(!e||"string"!=typeof e)&&e.match(w)}}const M=Symbol("element");function v(e){return e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}function R(e){return"string"==typeof e&&(!!e.match(/^\-?[a-z_-]*[a-z]$/)||(!!e.match(/^\-\-[A-Za-z_-]*[A-Za-z0-9]$/)||!!e.match(/^[a-zA-Z]+$/)))}function L(e=""){return new Map(e.split(/\s*;\s*/g).filter((e=>e.length)).map((e=>e.trim().match(/^([a-z-]+)\s*:\s*(.*)$/).slice(1))))}function U(e){return Array.from(e?.entries()??[]).map((e=>e.join(": "))).join("; ")}function k(e){return new Proxy({[M]:e},{get(t,s){if(s===M)return e;if(!R(s))return;const i=v(s);return L(e.attributes.style).get(i)},set(t,s,i){if(!R(s))return!0;const r=v(s),n=L(e.attributes.style);return e.attributes.style=U(n.set(r,i)),!0},deleteProperty(t,s){if(!R(s))return;const i=v(s),r=L(e.attributes.style);e.attributes.style=U(r.delete(i))}})}const P=/\r\n|\r|\f/g,$=/\(\s*(even|odd|(?:(?:([+-]?\d*)n)\s*(?:([+-])\s*(\d+))?|([+-]?\d+)))\s*/g,W={Selectors:0,Identifier:1,Iterator:2,IteratorOf:3},G={is:W.Selectors,not:W.Selectors,where:W.Selectors,has:W.Selectors,lang:W.Identifier,dir:W.Identifier,"nth-child":W.IteratorOf,"nth-last-child":W.IteratorOf,"nth-of-type":W.Iterator,"nth-last-of-type":W.Iterator,"nth-col":W.Iterator,"nth-last-col":W.Iterator};function j(e){return B(new r(e.replace(P,"\n")))}function B(e,t=i,s=!1){for(var r=e.skipWhiteSpace(),n={},o=[],a=[o],l=[a];r!==i&&r!==t;){switch(r){case"*":if(o.length>0)throw H("Universal selectors must come before all other simple selectors.",e);n.type="universal",o.push(n),n={};break;case"#":case".":{e.getNextChar();const t=F(e);if(!t)throw H("Expected an identifier.",e);n.type="#"===r?"id":"class",n.name=t,o.push(n),n={};break}case"[":{e.getNextAfterWhiteSpace();const t=F(e);if(!t)throw H("Expected an identifier.",e);if(n.type="attr",n.name=t,n.comparison="=",n.value=!0,n.ignoreCase=!1,"]"!==(r=e.getNextAfterWhiteSpace())){switch(r){case"=":break;case"~":case"|":case"^":case"$":case"*":if("="!==e.peek())throw H("Expected '='.",e,1);n.comparison=r+n.comparison,e.getNextChar();break;default:throw H("Unexpected character '"+(r===i?"END_OF_INPUT":r)+"'.",e)}if("'"===(r=e.getNextAfterWhiteSpace())||'"'===r){const t=r;for(n.value="",r=e.getNextChar();r!==i&&r!==t&&"\n"!==r;)"\\"===r?(n.value+=Y(e),r=e.getChar()):(n.value+=r,r=e.getNextChar())}else{const t=F(e);if(!t)throw H("Expected an identifier.",e);n.value=t}if("]"!==e.getNextAfterWhiteSpace()){const t=F(e);if("i"===t||"I"===t)n.ignoreCase=!0;else if("s"===t||"S"===t)n.ignoreCase=!1;else if(t)throw H("Unexpected identifier '"+t+"'.",e,1-t.length);if("]"!==e.getNextAfterWhiteSpace())throw H("Expected ']'.",e,-1+t.length)}}o.push(n),n={};break}case":":if(e.getNextChar(),e.match(":")){const t=F(e);if(!t)throw H("Expected a pseudo-element name.",e);n.type="pseudo-element",n.name=t}else{const t=F(e);if(!t)throw H("Expected a pseudo-class name.",e);n.type="pseudo-class",n.name=t;const s=G[t];if(null!=s){if(n.type="pseudo-fn","("!==e.getNextChar())throw H("Expected '('.",e);switch(s){case W.IteratorOf:case W.Iterator:let t,i=0,r=0;$.lastIndex=e.index;const o=$.exec(e.str);if(!o)throw H("Invalid parameter.",e,1);if(e.advance(o[0].length),s===W.IteratorOf){e.skipWhiteSpace();const s=e.index;if("of"===F(e).toLowerCase()){const s=e.getNextChar();if(")"!==s&&!e.isWhiteSpace(s))throw H("Expected whitespace.",e);if(t=B(e,")"),!(t instanceof Array)||0===t.length)throw H("Expected at least one selector.",e)}else e.goToIndex(s)}if(")"!==e.skipWhiteSpace())throw H("Expected ')'.",e);"even"===o[1]||"odd"===o[1]?(i=2,"odd"===o[1]&&(r=1)):o[5]?r=parseInt(o[5],10):(i="-"===o[2]?-1:o[2]&&"+"!==o[2]?parseInt(o[2],10):1,o[3]&&(r=parseInt(o[3]+o[4],10))),n.params=[i,r],t&&n.params.push(t);break;case W.Selectors:if(e.getNextChar(),n.params=B(e,")",!0),0===n.params.length)throw H("Expected at least one selector.",e);break;case W.Identifier:if(!X(e.getNextAfterWhiteSpace()))throw H("Expected an identifier.",e);n.params=[F(e)],e.getNextChar()}if(")"!==e.skipWhiteSpace())throw H("Expected ')'.",e)}else"before"!==t&&"after"!==t&&"first-line"!==t&&"first-letter"!==t||(n.type="pseudo-element")}o.push(n),n={};break;case"+":case">":case"~":if(0===o.length){if(1===a.length){if(!s)throw H("Absolute selectors cannot start with a combinator.",e);a.unshift([{type:"pseudo-class",name:"scope"}])}else if("string"==typeof a[a.length-2])throw H("Cannot have multiple combinators in a row.",e);a.splice(a.length-1,0,r)}else a.push(r,o=[]);break;case",":if(0===o.length){if(a.length>1){if(a.pop(),"string"==typeof a[a.length-1])throw H("Complex selectors are not allowed to end with a combinator.",e,-1);l.push(a=[o])}}else l.push(a=[o=[]]);e.skipWhiteSpace();break;default:if(e.isWhiteSpace(r))o.length>0&&a.push(o=[]),e.skipWhiteSpace(),e.advance(-1);else{if(!X(r))throw H("Unexpected character '"+r+"'.",e);if(o.length>0)throw H("Type (tag name) selectors must come before all other simple selectors.",e);n.type="type",n.name=F(e).toUpperCase(),o.push(n),n={}}}r=e.getNextChar()}if(0===o.length&&(1===a.length?(l.pop(),a=l[l.length-1]):a.pop()),a&&"string"==typeof a[a.length-1])throw H("Complex selectors are not allowed to end with a combinator.",e,-1);return l}function H(e,t,s=0){var i=new SyntaxError(e),r=t.index+s;return i.stack="SyntaxError: "+e+"\n\n"+t.str+"\n"+" ".repeat(r)+"^\n at index "+r,i}function F(e){var t="",s=e.getChar();if(X(s)){do{"\\"===s?(t+=Y(e),s=e.getChar()):(t+=s,s=e.getNextChar())}while(s!==i&&(X(s)||s>="0"&&s<="9"||"-"===s));e.advance(-1)}return t}function Y(e){var t=e.getNextChar();if(V(t)){let s="";for(let i=5;i>=0&&V(t);i--)s+=t,t=e.getNextChar();return e.isWhiteSpace(t)&&e.getNextChar(),s=0|parseInt(s,16),0===s||s>=55296&&s<=57343||s>1114111?"�":String.fromCodePoint(s)}return t===i?"�":(e.getNextChar(),t)}function V(e){return e!==i&&(e>="0"&&e<="9"||e>="A"&&e<="F"||e>="a"&&e<="f")}function X(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"||"_"===e||e>="€"||"\\"===e}const z=0,q=1,Z=2,K=3,J=4,Q={">":Z,"+":K,"~":J},ee={is:(e,t,s)=>ie(e,t,s),not:(e,t,s)=>!ie(e,t,s),has(e,t,s){var i=!1;for(let e=0;e0&&t.forEach((e=>{if(ie(t,e,s))return i=!0,!1})),i},"nth-child"(e,t,s){const i=t[u],r=i.childNodes,n=new oe(s[0],s[1]);for(let e=0;e=0;e--)if(r[e][d]===pe.ELEMENT_NODE&&(!s[2]||ie(i,r[e],s[2]))){const s=n.next();if(r[e]===t)return s}return!1},"nth-of-type"(e,t,s){const i=t[u].childNodes,r=new oe(s[0],s[1]),n=t[N];for(let e=0;e=0;e--)if(i[e][N]===n){const s=r.next();if(i[e]===t)return s}}},te={scope:(e,t)=>t===e,enabled(e,t){switch(t[N]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return!t.hasAttribute("disabled")}return!1},disabled(e,t){switch(t[N]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return t.hasAttribute("disabled")}return!1},checked(e,t){if("INPUT"===t[N]){const e=t.getAttribute("type");if("checkbox"===e||"radio"===e)return t.hasAttribute("checked")}else if("OPTION"===t[N])return t.hasAttribute("selected");return!1},required(e,t){switch(t[N]){case"INPUT":case"SELECT":case"TEXTAREA":return t.hasAttribute("required")}return!1},optional(e,t){switch(t[N]){case"INPUT":case"SELECT":case"TEXTAREA":return!t.hasAttribute("required")}return!1},root(e,t){const s=O(e);return!!s&&s.documentElement===t},empty:(e,t)=>0===t.childNodes.length,"first-child"(e,t){const s=t[u].childNodes;for(let e=0;e=0;e--)if(s[e][d]===pe.ELEMENT_NODE)return s[e]===t},"only-child"(e,t){const s=t[u].childNodes;let i,r;for(let e=0,t=s.length-1;t>=0&&(!i||!r);e++,t--)i||s[e][d]!==pe.ELEMENT_NODE||(i=s[e]),r||s[t][d]!==pe.ELEMENT_NODE||(r=s[t]);return i===r&&i===t},"first-of-type"(e,t){const s=t[u].childNodes,i=t[N];for(let e=0;e=0;e--)if(s[e][N]===i)return s[e]===t},"only-of-type"(e,t){const s=t[u].childNodes,i=t[N];let r,n;for(let e=0,t=s.length-1;t>=0&&(!r||!n);e++,t--)r||s[e][N]!==i||(r=s[e]),n||s[t][N]!==i||(n=s[t]);return r===n&&r===t}};function se(e,t,s){const i=j(t),r=[];return e.forEach((t=>{if(ie(e,t,i)&&(r.push(t),!s))return!1})),s?r:r[0]||null}function ie(e,t,s,i=!1){var r;e:for(let n=0;n=0;i?t++:t--)if(Q.hasOwnProperty(o[t]))a=Q[o[t]];else switch(a){case z:if(!re(e,r,o[t]))continue e;a=q;break;case q:for(;r=r[u];)if(re(e,r,o[t]))continue t;continue e;case Z:if(!re(e,r=r[u],o[t]))continue e;break;case K:{const s=r[u].childNodes;if(!re(e,r=s[s.indexOf(r)+(i?1:-1)],o[t]))continue e;break}case J:{const s=r[u].childNodes;for(let n=s.indexOf(r)+(i?1:-1);i?n=0;i?n++:n--)if(re(e,s[n],o[t])){r=s[n];continue t}continue e}}return!0}}return!1}function re(e,t,s){if(!t||t[d]!==pe.ELEMENT_NODE)return!1;for(let i=0;i=this.current||this.A>0&&this.current>=this.B)&&(e=(this.current+this.B)%this.A==0),e}}function ae(e){var t=e.tagName,s=O(e),i=s?s.entityEncoder:null,r="";switch(e.nodeType){case E.ELEMENT_NODE:r+="<"+(t=t.toLowerCase());for(let t in e.attributes)if(e.attributes.hasOwnProperty(t)){let n=e.attributes[t];!0===n?n="":i&&s[f]&&(n=le(n,i,s[f])),r+=" "+t,""!==n&&(r+='="'+n+'"')}r+=">";for(let t=0;t");break;case E.TEXT_NODE:i&&s[f]&&(!e.parentNode||"SCRIPT"!==e.parentNode.tagName&&"STYLE"!==e.parentNode.tagName)?r+=le(e.nodeValue,i,s[f]):r+=e.nodeValue;break;case E.CDATA_SECTION_NODE:r+="";break;case E.PROCESSING_INSTRUCTION_NODE:r+="";break;case E.COMMENT_NODE:r+="\x3c!--"+e.nodeValue+"--\x3e";break;case E.DOCUMENT_TYPE_NODE:r+=""}return r}function le(e,t,s){return!1===s.encodeEntities?e:!0!==s.encodeEntities&&s.encodeEntities instanceof RegExp?t.encode(e,s.encodeEntities):t.encode(e)}const he=Symbol("classList"),ce=Symbol("style"),de=Symbol("extendNode");function ue(e,t=pe){const s=Object.create(t.prototype);switch(s[d]=e,s.nodeValue=null,s[u]=null,s[p]=null,e){case pe.ELEMENT_NODE:s[N]=null,s.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:s.childNodes=[]}return s}class pe extends o{constructor(){if(super(),arguments[0]!==de)throw new Error("Cannot directly instantiate Node.")}get nodeType(){return this[d]}get nodeName(){switch(this.nodeType){case pe.ELEMENT_NODE:return this.tagName;case pe.TEXT_NODE:return"#text";case pe.CDATA_SECTION_NODE:return"#cdata-section";case pe.PROCESSING_INSTRUCTION_NODE:return this.target;case pe.COMMENT_NODE:return"#comment";case pe.DOCUMENT_NODE:return"#document";case pe.DOCUMENT_TYPE_NODE:return this.name;case pe.DOCUMENT_FRAGMENT_NODE:return"#document-fragment"}}get parentNode(){return this[u]}get ownerDocument(){return this[p]}get tagName(){return this[N]||null}get firstChild(){return this.childNodes&&this.childNodes[0]||null}get lastChild(){return this.childNodes&&this.childNodes[this.childNodes.length-1]||null}get previousSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>0)return e.childNodes[t-1]}return null}get nextSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>-1&&t=pe.TEXT_NODE&&this.nodeType<=pe.COMMENT_NODE&&(this.nodeValue=e)}getRootNode(){let e=this;for(;e.parentNode;)e=e.parentNode;return e}hasAttributes(){if(this.attributes)for(let e in this.attributes)if(this.attributes.hasOwnProperty(e))return!0;return!1}getAttributeNames(){return this.attributes?Object.keys(this.attributes):[]}getAttribute(e){var t;return this.attributes&&e&&"string"==typeof e&&(t=this.attributes[Ee(this,e)]),void 0===t?null:t}setAttribute(e,t){this.attributes&&e&&"string"==typeof e&&("class"===(e=Ee(this,e))?!0!==t?this.className=""+t:(this.classList.value="",this.attributes[e]=!0):this.attributes[e]="string"==typeof t||!0===t?t:""+t)}toggleAttribute(e,t){if(this.attributes&&e&&"string"==typeof e)return e=Ee(this,e),this.attributes.hasOwnProperty(e)?1!==arguments.length&&!1!==t||(delete this.attributes[e],!1):(1===arguments.length||!0===t)&&(this.attributes[e]=!0)}removeAttribute(e){this.attributes&&e&&"string"==typeof e&&("class"===(e=Ee(this,e))&&this[he]&&(this[he].value=null),delete this.attributes[e])}hasAttribute(e){return!(!this.attributes||!e||"string"!=typeof e)&&this.attributes.hasOwnProperty(Ee(this,e))}hasChildNodes(){return!!this.childNodes&&this.childNodes.length>0}appendChild(e){return this.insertBefore(e,null)}insertBefore(e,t){if(this.childNodes&&e instanceof pe&&arguments.length>1){let s=-1;if(null==t?s=this.childNodes.length:t instanceof pe&&t.parentNode===this&&(s=this.childNodes.indexOf(t)),-1!==s)return fe(this,e,s)}return null}replaceChild(e,t){return this.childNodes&&t instanceof pe&&e instanceof pe&&t.parentNode===this&&t!==e?(fe(this,e,this.childNodes.indexOf(t),1),t):null}removeChild(e){if(this.childNodes&&e instanceof pe&&e.parentNode===this){const t=this.childNodes.indexOf(e),s=O(this);return s&&e.parentNode===s.documentElement&&Ne.hasOwnProperty(e.tagName)&&(s[Ne[e.tagName]]=null),x(this.childNodes.splice(t,1)),e}return null}cloneNode(e){var t;switch(t=this.nodeType===pe.DOCUMENT_NODE||this.nodeType===pe.DOCUMENT_FRAGMENT_NODE?new Xe(null,this[f]):ue(this.nodeType),this.nodeType){case pe.ELEMENT_NODE:t[N]=this.tagName,t.attributes=Object.assign(t.attributes,this.attributes);break;case pe.TEXT_NODE:case pe.CDATA_SECTION_NODE:case pe.PROCESSING_INSTRUCTION_NODE:case pe.COMMENT_NODE:t.nodeValue=this.nodeValue;break;case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t[d]=this.nodeType,t.entityEncoder.entities=this.entityEncoder;break;case pe.DOCUMENT_TYPE_NODE:t.name=this.name,t.publicId=this.publicId,t.systemId=this.systemId}if(!0===e&&this.childNodes&&this.childNodes.length>0){for(let e=0;e{if(s.id===e)return t=s,!1})),t}getElementsByClassName(e){var t=[];if(e&&"string"==typeof e){const s=e.trim().split(g);(s.length>1||""!==s[0])&&this.forEach((e=>{for(let t=0;t{"*"!==e&&s.tagName!==e||t.push(s)}))),t}closest(e){return e&&"string"==typeof e?function(e,t){const s=j(t);let i=e;for(;null!=i&&i[d]===pe.ELEMENT_NODE;){if(ie(e,i,s))return i;i=i[u]}return null}(this,e):null}matches(e){return!(!e||"string"!=typeof e)&&function(e,t){return ie(e,e,j(t))}(this,e)}querySelector(e){return e&&"string"==typeof e?se(this,e,!1):null}querySelectorAll(e){return e&&"string"==typeof e?se(this,e,!0):[]}forEach(e,t=E.ELEMENT_NODE){let s,i,r=this.childNodes,n=this.firstChild,o=[],a=0;for(;n;){if(s=n[u],i=r[a+1],(null===t||n.nodeType===t)&&!1===e(n,s))return;if(n[u]===s&&n.childNodes&&n.childNodes.length>0)o.push(a),r=n.childNodes,n=r[a=0];else{for(i?(a+=1,i!==r[a]&&(a=s.childNodes.indexOf(i))):a=r.length;null==r[a];){if(n=s,s=n[u],!n||n===this)return;r=s.childNodes,a=o.pop()+1}n=r[a]}}}}Object.defineProperties(pe,{ELEMENT_NODE:{value:E.ELEMENT_NODE},TEXT_NODE:{value:E.TEXT_NODE},CDATA_SECTION_NODE:{value:E.CDATA_SECTION_NODE},PROCESSING_INSTRUCTION_NODE:{value:E.PROCESSING_INSTRUCTION_NODE},COMMENT_NODE:{value:E.COMMENT_NODE},DOCUMENT_NODE:{value:E.DOCUMENT_NODE},DOCUMENT_TYPE_NODE:{value:E.DOCUMENT_TYPE_NODE},DOCUMENT_FRAGMENT_NODE:{value:E.DOCUMENT_FRAGMENT_NODE}});const Ne={HEAD:l,BODY:h,FRAMESET:h};function fe(e,t,s,i=0){if(!e||e.nodeType!==pe.ELEMENT_NODE&&e.nodeType!==pe.DOCUMENT_NODE&&e.nodeType!==pe.DOCUMENT_FRAGMENT_NODE||e.nodeType===pe.ELEMENT_NODE&&!0===T[e.tagName])return t;if(t.nodeType<=pe.COMMENT_NODE){if(e.parentNode&&e.parentNode.nodeType===pe.DOCUMENT_NODE&&Ne.hasOwnProperty(t.tagName)){const s=Ne[t.tagName];if(e.parentNode[s]&&0===i)return t;e.parentNode[s]=t}t.parentNode&&t.parentNode.removeChild(t),y(t,e),x(e.childNodes.splice(s,i,t))}else if(t.nodeType!==pe.DOCUMENT_TYPE_NODE||e.nodeType!==pe.DOCUMENT_NODE&&e.nodeType!==pe.DOCUMENT_FRAGMENT_NODE){if(t.nodeType===pe.DOCUMENT_FRAGMENT_NODE)if(e.parentNode&&e.parentNode.nodeType===pe.DOCUMENT_NODE){i>0&&x(e.childNodes.splice(s,i));for(let r=t.childNodes.length-1;r>=0;r--){const n=t.childNodes[r];if(Ne.hasOwnProperty(n.tagName)){const t=Ne[n.tagName];if(e.parentNode[t]&&0===i)continue;e.parentNode[t]=n}y(n,e),e.childNodes.splice(s,0,n),t.childNodes.splice(r,1)}}else if(t!==O(e)){for(let s=0;s":!0,"/":!0,"=":!0},ye={P:!0},Ce={DT:!0,DD:!0},be={TBODY:!0,THEAD:!0,TFOOT:!0},De={TD:!0,TH:!0},we={BUTTON:!0,DATALIST:!0,OPTGROUP:!0,OPTION:!0,PROGRESS:!0,SELECT:!0,TEXTAREA:!0},Se={ADDRESS:ye,ARTICLE:ye,ASIDE:ye,BLOCKQUOTE:ye,DIV:ye,FIELDSET:ye,FOOTER:ye,H1:ye,H2:ye,H3:ye,H4:ye,H5:ye,H6:ye,HEADER:ye,HGROUP:ye,HR:ye,MAIN:ye,NAV:ye,P:ye,PRE:ye,SECTION:ye,BODY:{HEAD:!0,TITLE:!0},DL:ye,DD:Ce,DT:Ce,TABLE:ye,TBODY:be,THEAD:be,TD:De,TFOOT:be,TH:De,TR:{TR:!0},LI:{LI:!0},OL:ye,UL:ye,BUTTON:we,DATALIST:we,FORM:ye,INPUT:we,OPTGROUP:{OPTGROUP:!0,OPTION:!0},OPTION:{OPTION:!0},OUTPUT:we,PROGRESS:we,SELECT:we,TEXTAREA:we};class _e{constructor(e,t,s){this.options=_e.setupOptions(t),this.lexer=new r(e),this.entityEncoder=s}static setupOptions(e){return(e=Object.assign({},Oe,e)).encodeEntities instanceof RegExp&&(e.encodeEntities=C(e.encodeEntities)),Object.freeze(e)}static isNameCharStart(e){return":"===e||"_"===e||e>="A"&&e<="Z"||e>="a"&&e<="z"||e>="À"&&e<="Ö"||e>="Ø"&&e<="ö"||e>="ø"&&e<="˿"||e>="Ͱ"&&e<="ͽ"||e>="Ϳ"&&e<="῿"||"‌"===e||"‍"===e||e>="⁰"&&e<="↏"||e>="Ⰰ"&&e<="⿯"||e>="、"&&e<="퟿"||e>="豈"&&e<="﷏"||e>="ﷰ"&&e<="�"||e>="က0"&&e<="F"}static isNameChar(e){return _e.isNameCharStart(e)||e>="0"&&e<="9"||"-"===e||"."===e||"·"===e||e>="̀"&&e<="ͯ"||"‿"===e||"⁀"===e}parseHTML(){var e,t=ue(pe.DOCUMENT_FRAGMENT_NODE),s=[t];for(t[f]=this.options,e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();e!==i&&s.length>0;)"<"===e?this.parseTag(s):this.parseText(s),e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();return t}parseTag(e){var t,s,r,n,o=0,a=this.lexer.index,l=this.lexer.getNextChar();if(l!==i)e:for(;">"!==l&&l!==i;){if(r=this.lexer.index,0===o){if("!"===l||"?"===l){if(this.options.allowProcessingInstructions&&this.lexer.match("?")){r=this.lexer.index,l=this.lexer.getChar();t:if(_e.isNameCharStart(l)){for(t=ue(pe.PROCESSING_INSTRUCTION_NODE);l!==i&&_e.isNameChar(l);)l=this.lexer.getNextChar();if(!this.lexer.isWhiteSpace(l)&&l!==i&&("?"!==l||">"!==this.lexer.peek()))break t;t.target=this.lexer.str.slice(r,this.lexer.index),this.lexer.skipWhiteSpace(),r=this.lexer.index,this.lexer.goToString("?>"),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(1),e[0].childNodes.push(t),y(t,e[0]);break}this.lexer.advance(r-this.lexer.index-1)}if(this.options.allowCDATA&&this.lexer.match("![CDATA[")){t=ue(pe.CDATA_SECTION_NODE),r=this.lexer.index,this.lexer.goToString("]]>"),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(2),e[0].childNodes.push(t),y(t,e[0]);break}if(this.lexer.match("!DOCTYPE",!1)){this.lexer.skipWhiteSpace(),r=this.lexer.index,this.lexer.goToString(">");let s=e[e.length-1];if(s.doctype)break;if(s.childNodes.length>0)for(let e=s.childNodes.length-1;e>=0;e--)if(s.childNodes[e].nodeTypepe.COMMENT_NODE)break e;let i=this.lexer.str.slice(r,this.lexer.index).split(g);if((t=ue(pe.DOCUMENT_TYPE_NODE)).name=Te.call(i.shift()),i.length>1){let e=Te.call(i.shift());if(i=i.join(" ").split('"'),""===i[0])switch(e){case"public":i.shift(),t.publicId=i.shift();case"system":i.shift(),t.systemId=i.shift()}}t.publicId||(t.publicId=""),t.systemId||(t.systemId=""),s.childNodes.push(t),s.doctype=t,y(t,s);break}{let s;this.lexer.match("!--")?this.lexer.match(">")||this.lexer.match("->")||(s="--\x3e"):("!"===l&&this.lexer.getNextChar(),s=">"),t=ue(pe.COMMENT_NODE),r=this.lexer.index,s&&this.lexer.goToString(s),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(s?s.length-1:-1),e[0].childNodes.push(t),y(t,e[0]);break}}"/"===l&&(l=this.lexer.getNextChar(),o=2,r+=1)}if(1===o){for(;this.lexer.index===r&&"="===l||!this.lexer.isWhiteSpace(l)&&!xe[l]&&l!==i;)l=this.lexer.getNextChar();n=this.lexer.index}else{for(;(l>="a"&&l<="z"||l>="A"&&l<="Z"||this.lexer.index>r&&(l>="0"&&l<="9"||"-"===l||"_"===l||":"===l))&&l!==i;)l=this.lexer.getNextChar();if(n=this.lexer.index,l===i)return void this.addTextNode(e,a,n,!1);l=this.lexer.skipWhiteSpace(),2===o&&(l=this.lexer.goToString(">"))}if(r===n){if(!this.options.allowSelfClosingSyntax||"/"!==l||">"!==this.lexer.peek()){if(0===o){this.lexer.goToString("<"),this.addTextNode(e,a,this.lexer.index,!1),a=this.lexer.index,l=this.lexer.getNextChar();continue}if(2===o){if(r===this.lexer.index)break;(t=this.addTextNode(e,r,this.lexer.index))[d]=pe.COMMENT_NODE;break}this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();continue}l=this.lexer.getNextChar(),o=2,s=e[0][N]}else s=this.lexer.str.slice(r,n),1!==o&&(s=me.call(s)),l=this.lexer.skipWhiteSpace();switch(o){case 0:for((t=ue(pe.ELEMENT_NODE))[N]=s;Se.hasOwnProperty(t[N])&&Se[t[N]][e[0][N]];)e.splice(0,1);e[0].childNodes.push(t),y(t,e[0]),o=1,!0!==T[t[N]]&&e.unshift(t);break;case 1:let a=!0;if(this.options.lowerAttributeCase&&(s=Te.call(s)),"="===l){if(this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace(),r=this.lexer.index,'"'===l||"'"===l)this.lexer.getNextChar(),this.lexer.goToString(l),n=this.lexer.index,r+=1,this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();else{for(;!(this.lexer.isWhiteSpace(l)|| //!unquotedAttributeExclusions[theChar] && -">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===i);)l=this.lexer.getNextChar();n=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(s))break;a=this.lexer.str.slice(r,n),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(s))break;t.attributes[s]=a;break;case 2:for(let i=0;i0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,s=!1;"SCRIPT"===e[0][N]||"STYLE"===e[0][N]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,s,i,r),c=h.data,d=this.canvas[$e],u=r,p=i;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,s){return e instanceof Ae?new Ae(e.data,e.width,e.height):new Ae(e,t,s)}getImageData(e,t,s,i,r){if(0===e&&0===t&&s===this.canvas.width&&i===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new Ae(this.canvas[$e],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new Ae(s,i,r)}putImageData(e,t,s,i,r,n,o){let a,l;const h=this.canvas[$e];if(void 0!==i)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===s&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),i=null===(s=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===s?void 0:s.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const Le=Symbol("canvas-width"),Ue=Symbol("canvas-height"),ke=Symbol("canvas-context"),Pe=Symbol("element-id"),$e=Symbol("accesscanvas-data");class We extends pe{get width(){return console.debug(`${this}→width? (${this[Le]})`),this[Le]}get height(){return console.debug(`${this}→height? (${this[Ue]})`),this[Ue]}set width(e){console.debug(`${this}→width = ${e}`),this[Le]=e,this.resize(this[Le],this[Ue])}set height(e){console.debug(`${this}→height = ${e}`),this[Ue]=e,this.resize(this[Le],this[Ue])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[ke]=this[ke]||new Me(this),!(this[ke]instanceof Me))throw new Error("Context invalid");return this[ke]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",s){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(de),this[Pe]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[Pe]}`}resize(e,t){this[Le]=e,this[Ue]=t,this[$e]=new Uint8ClampedArray(this[Le]*this[Ue]*4),console.debug(`${this}→reset, new size: ${this[Le]}x${this[Ue]} (${this[$e].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=We);const Ge=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,je=/[\^$\\.*+?()[\]{}|]/g,Be=Ye({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let He=Be;class Fe{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?C(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(Ge,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=He:e&&e.encodingRE instanceof RegExp||(e=Ye(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){He=e&&"object"==typeof e?Ye(Object.assign({},e)):Be}}function Ye(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const s={},i={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(je,"\\$&")),(!s.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=s,t.decodingReplacements=i)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const Ve=Symbol("entityEncoder");class Xe extends pe{constructor(e,t){const s=ue(pe.DOCUMENT_FRAGMENT_NODE,Xe);return s[f]=_e.setupOptions(t),s[Ve]=new Fe(s[f].entities),s.innerHTML=e,s}get documentElement(){return this[c]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let s=t.getElementsByTagName("title");s=s.length<=0?t.appendChild(this.createElement("title")):s[0],s.textContent=e}}get body(){return this[h]||null}set body(e){e instanceof pe&&e.nodeType===pe.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[h]&&this[c]&&(this[h]?this[h].parentNode.replaceChild(e,this[h]):this[c].appendChild(e))}get entityEncoder(){return this[Ve]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new We;switch(t[d]=e,t.nodeValue=null,t[u]=null,t[p]=null,e){case pe.ELEMENT_NODE:t[N]=null,t.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(pe.ELEMENT_NODE);return ue(pe.ELEMENT_NODE)}(e);return t[N]=e.toUpperCase(),t}}createTextNode(e){return ze(pe.TEXT_NODE,e)}createComment(e){return ze(pe.COMMENT_NODE,e)}createCDATASection(e){return ze(pe.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!_e.isNameCharStart(e[0]))break e;for(let t=1;t");return s.target=e,s}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,s){return qe(ue(pe.DOCUMENT_TYPE_NODE),e,t,s)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((s=>{s.attributes&&s.attributes.name===e&&t.push(s)})),t}}function ze(e,t,s=!1){const i=ue(e);if(i.nodeValue="",t&&"string"==typeof t){if(s&&"string"==typeof s&&-1!==t.indexOf(s))throw new Error("The data provided ('"+t+"') contains '"+s+"'.");i.nodeValue+=t}return i}function qe(e,t,s,i){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=s&&"string"==typeof s?s:"",e.systemId=i&&"string"==typeof i?i:""):e.name=e.publicId=e.systemId="",e}Xe.Node=pe,Xe.EntityEncoder=Fe,module.exports=Xe; +">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===i);)l=this.lexer.getNextChar();n=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(s))break;a=this.lexer.str.slice(r,n),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(s))break;t.attributes[s]=a;break;case 2:for(let i=0;i0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,s=!1;"SCRIPT"===e[0][N]||"STYLE"===e[0][N]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,s,i,r),c=h.data,d=this.canvas[$e],u=r,p=i;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,s){return e instanceof Ae?new Ae(e.data,e.width,e.height):new Ae(e,t,s)}getImageData(e,t,s,i,r){if(0===e&&0===t&&s===this.canvas.width&&i===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new Ae(this.canvas[$e],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new Ae(s,i,r)}putImageData(e,t,s,i,r,n,o){let a,l;const h=this.canvas[$e];if(void 0!==i)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===s&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),i=null===(s=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===s?void 0:s.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const Le=Symbol("canvas-width"),Ue=Symbol("canvas-height"),ke=Symbol("canvas-context"),Pe=Symbol("element-id"),$e=Symbol("accesscanvas-data");class We extends pe{get width(){return console.debug(`${this}→width? (${this[Le]})`),this[Le]}get height(){return console.debug(`${this}→height? (${this[Ue]})`),this[Ue]}set width(e){console.debug(`${this}→width = ${e}`),this[Le]=e,this.resize(this[Le],this[Ue])}set height(e){console.debug(`${this}→height = ${e}`),this[Ue]=e,this.resize(this[Le],this[Ue])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[ke]=this[ke]||new Me(this),!(this[ke]instanceof Me))throw new Error("Context invalid");return this[ke]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",s){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(de),this[Pe]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[Pe]}`}resize(e,t){this[Le]=e,this[Ue]=t,this[$e]=new Uint8ClampedArray(this[Le]*this[Ue]*4),console.debug(`${this}→reset, new size: ${this[Le]}x${this[Ue]} (${this[$e].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=We);const Ge=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,je=/[\^$\\.*+?()[\]{}|]/g,Be=Ye({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let He=Be;class Fe{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?C(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(Ge,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=He:e&&e.encodingRE instanceof RegExp||(e=Ye(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){He=e&&"object"==typeof e?Ye(Object.assign({},e)):Be}}function Ye(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const s={},i={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(je,"\\$&")),(!s.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=s,t.decodingReplacements=i)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const Ve=Symbol("entityEncoder");class Xe extends pe{constructor(e,t){const s=ue(pe.DOCUMENT_FRAGMENT_NODE,Xe);return s[f]=_e.setupOptions(t),s[Ve]=new Fe(s[f].entities),s.innerHTML=e,s}get documentElement(){return this[c]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let s=t.getElementsByTagName("title");s=s.length<=0?t.appendChild(this.createElement("title")):s[0],s.textContent=e}}get body(){return this[h]||null}set body(e){e instanceof pe&&e.nodeType===pe.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[h]&&this[c]&&(this[h]?this[h].parentNode.replaceChild(e,this[h]):this[c].appendChild(e))}get entityEncoder(){return this[Ve]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new We;switch(t[d]=e,t.nodeValue=null,t[u]=null,t[p]=null,e){case pe.ELEMENT_NODE:t[N]=null,t.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(pe.ELEMENT_NODE);return ue(pe.ELEMENT_NODE)}(e);return t[N]=e.toUpperCase(),t}}createTextNode(e){return ze(pe.TEXT_NODE,e)}createComment(e){return ze(pe.COMMENT_NODE,e)}createCDATASection(e){return ze(pe.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!_e.isNameCharStart(e[0]))break e;for(let t=1;t");return s.target=e,s}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,s){return qe(ue(pe.DOCUMENT_TYPE_NODE),e,t,s)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((s=>{s.attributes&&s.attributes.name===e&&t.push(s)})),t}}function ze(e,t,s=!1){const i=ue(e);if(i.nodeValue="",t&&"string"==typeof t){if(s&&"string"==typeof s&&-1!==t.indexOf(s))throw new Error("The data provided ('"+t+"') contains '"+s+"'.");i.nodeValue+=t}return i}function qe(e,t,s,i){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=s&&"string"==typeof s?s:"",e.systemId=i&&"string"==typeof i?i:""):e.name=e.publicId=e.systemId="",e}Xe.Node=pe,Xe.EntityEncoder=Fe,module.exports=Xe; diff --git a/lib/fauxdom-with-canvas.cjs.map b/lib/fauxdom-with-canvas.cjs.map new file mode 100644 index 0000000..b72730f --- /dev/null +++ b/lib/fauxdom-with-canvas.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"fauxdom-with-canvas.cjs","sources":["../src/lexer.js","../src/event-target.js","../src/utils.js","../src/token-list.js","../src/css-style-declaration.js","../src/selector-parser.js","../src/selectors.js","../src/serializer.js","../src/node.js","../src/html-parser.js","../src/js-canvas/ImageData.js","../src/js-canvas/RenderingContext.js","../src/js-canvas/HTMLCanvasElement.js","../src/canvas-node.js","../src/entity-encoder.js","../src/document.js"],"sourcesContent":["const reCache = {},\n\twhitespaces = {},\n\tisWhiteSpace = Object.prototype.hasOwnProperty.bind( whitespaces ),\n\tEOF = null;\n\nexport {whitespaces, EOF};\n\nexport class Lexer\n{\n\tconstructor( str )\n\t{\n\t\tthis.index = 0;\n\t\tthis.str = str;\n\t\tthis.scanChar = this.str[this.index];\n\t\t\n\t\tif ( !isWhiteSpace( \"\\x20\" ) )\n\t\t{\n\t\t\t// Unicode C0 & C1 control characters are treated as whitespace, along with the ASCII space character.\n\t\t\tfor ( let i = 0; i <= 0x20; i++ )\n\t\t\t\twhitespaces[String.fromCharCode( i )] = null;\n\t\t\tfor ( let i = 0x80; i <= 0x9f; i++ )\n\t\t\t\twhitespaces[String.fromCharCode( i )] = null;\n\t\t}\n\t}\n\t\n\tisWhiteSpace( theChar )\n\t{\n\t\treturn (theChar !== EOF && isWhiteSpace( theChar ));\n\t}\n\t\n\tgoToString( toChar, caseSensitive )\n\t{\n\t\tif ( caseSensitive !== false )\n\t\t\tthis.index = this.str.indexOf( toChar, this.index );\n\t\telse\n\t\t{\n\t\t\tif ( !reCache[toChar] )\n\t\t\t\treCache[toChar] = new RegExp( toChar, \"ig\" );\n\t\t\t\n\t\t\treCache[toChar].lastIndex = this.index;\n\t\t\t\n\t\t\tconst match = reCache[toChar].exec( this.str );\n\t\t\tif ( match ) this.index = match.index;\n\t\t\telse this.index = -1;\n\t\t}\n\t\t\n\t\tif ( this.index > -1 )\n\t\t\tthis.scanChar = this.str[this.index];\n\t\telse\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\tthis.scanChar = EOF;\n\t\t}\n\t}\n\t\n\tgoToIndex( index )\n\t{\n\t\tthis.scanChar = this.str[this.index = index];\n\t}\n\t\n\tadvance( amount )\n\t{\n\t\tthis.index += amount;\n\t\tif ( this.index > this.str.length )\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\treturn (this.scanChar = EOF);\n\t\t}\n\t\treturn (this.scanChar = this.str[this.index]);\n\t}\n\t\n\tmatch( str, caseSensitive )\n\t{\n\t\tvar chunk = this.str.substr( this.index, str.length );\n\t\tif ( caseSensitive === false )\n\t\t{\n\t\t\tstr = str.toLowerCase();\n\t\t\tchunk = chunk.toLowerCase();\n\t\t}\n\t\tif ( chunk === str )\n\t\t{\n\t\t\tthis.index += str.length-1;\n\t\t\tthis.getNextChar();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpeek()\n\t{\n\t\treturn this.str[this.index + 1];\n\t}\n\t\n\tgetChar()\n\t{\n\t\treturn this.scanChar;\n\t}\n\t\n\tgetNextChar()\n\t{\n\t\tif ( this.index + 1 < this.str.length )\n\t\t\treturn (this.scanChar = this.str[++this.index]);\n\t\telse\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\treturn (this.scanChar = EOF);\n\t\t}\n\t}\n\t\n\tgetNextAfterWhiteSpace()\n\t{\n\t\tvar theChar;\n\t\tdo theChar = this.getNextChar();\n\t\twhile ( theChar !== EOF && isWhiteSpace( theChar ) )\n\t\treturn theChar;\n\t}\n\t\n\tskipWhiteSpace()\n\t{\n\t\tvar theChar = this.scanChar;\n\t\t\n\t\twhile ( theChar !== EOF && isWhiteSpace( theChar ) )\n\t\t\ttheChar = this.getNextChar();\n\t\t\n\t\treturn this.scanChar;\n\t}\n}","// Implementation of the HTML EventTarget API\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\nconst EVENT_LISTENERS = Symbol(\"event-listeners\");\n\nexport default class EventTarget {\n\taddEventListener( eventType, callback, useCaptureOrOptions )\n\t{\n\t\t// Lazily create the event listener map on the node\n\t\tthis[EVENT_LISTENERS] = this[EVENT_LISTENERS] ?? new Map();\n\n\t\t// Registered listeners for this eventType\n\t\tlet listeners = this[EVENT_LISTENERS].get(eventType);\n\t\tif (!listeners) {\n\t\t\tlisteners = [];\n\t\t\tthis[EVENT_LISTENERS].set(eventType, listeners);\n\t\t}\n\n\t\t// Capturing and non-capturing listeners need to be removed separately\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#sect1\n\t\t// TODO: handle other options? (once, passive, signal)\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options\n\t\tlisteners.push({\n\t\t\tcallback,\n\t\t\tcapturing: useCaptureOrOptions === true || !!useCaptureOrOptions?.capture,\n\t\t\toptions: typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions : { capture: !!useCaptureOrOptions }\n\t\t});\n\t}\n\n\tremoveEventListener( eventType, callback, useCaptureOrOptions )\n\t{\n\t\t// There aren't any listeners registered\n\t\tif (!this[EVENT_LISTENERS]) return;\n\n\t\t// Registered listeners for this eventType\n\t\tlet listeners = this[EVENT_LISTENERS].get(eventType);\n\t\tif (!listeners) return;\n\n\t\t// Extract the boolean capture value from the different possible argument formats\n\t\tconst captureSetting = !!(typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions.capture : useCaptureOrOptions);\n\n\t\t// Find the indexes of listeners we want to remove, then remove them from the listeners array\n\t\t// A listener must match the callback object (function) and capture setting (true/false)\n\t\t// We remove the elements in reverse index order to avoid the indexes changing\n\t\tlisteners.map((listener, i) => {\n\t\t\treturn listener.callback === callback && listener.capturing === captureSetting ? i : undefined\n\t\t})\n\t\t\t.reverse()\n\t\t\t.forEach(i => {\n\t\t\t\tif (i !== undefined) listeners.splice(i, 1)\n\t\t\t});\n\t}\n\n\tdispatchEvent( event )\n\t{\n\t\tlet notCancelled = true;\n\n\t\t// There aren't any listeners registered\n\t\tif (!this[EVENT_LISTENERS]) return notCancelled;\n\n\t\t// List active listeners\n\t\tconst listeners = this[EVENT_LISTENERS].get(event.type) ?? [];\n\n\t\t// Dispatch the event for every listener\n\t\t// TODO: handle 'once', 'passive' options, bubbling & capture\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase\n\t\tlisteners?.forEach(({ callback }) => {\n\t\t\tcallback(event);\n\n\t\t\t// The event has been canceled through preventDefault()\n\t\t\tif (event.defaultPrevented) notCancelled = false;\n\t\t});\n\n\t\treturn notCancelled;\n\t}\n\n}\n","const DOCTYPE = Symbol( \"doctype\" ),\n\tHEAD = Symbol( \"head\" ),\n\tBODY = Symbol( \"body\" ),\n\tDOCUMENT_ELEMENT = Symbol( \"documentElement\" ),\n\tNODE_TYPE = Symbol( \"nodeType\" ),\n\tPARENT_NODE = Symbol( \"parentNode\" ),\n\tOWNER = Symbol( \"ownerDocument\" ),\n\tTAG_NAME = Symbol( \"tagName\" ),\n\tPARSER_OPTIONS = Symbol( \"parserOptions\" ),\n\t\n\tspacesRE = /\\s+/g,\n/* @START_BROWSER_ONLY */\n\treFlagsRE = /[gimsuy]*$/,\n/* @END_BROWSER_ONLY */\n\t\n\tnodeTypes = {\n\t\tELEMENT_NODE: 1,\n\t\t//ATTRIBUTE_NODE: 2, // Unused\n\t\tTEXT_NODE: 3,\n\t\tCDATA_SECTION_NODE: 4,\n\t\t//ENTITY_REFERENCE_NODE: 5, // Unused, historical\n\t\t//ENTITY_NODE: 6, // Unused, historical\n\t\tPROCESSING_INSTRUCTION_NODE: 7,\n\t\tCOMMENT_NODE: 8,\n\t\tDOCUMENT_NODE: 9,\n\t\tDOCUMENT_TYPE_NODE: 10,\n\t\tDOCUMENT_FRAGMENT_NODE: 11,\n\t\t//NOTATION_NODE: 12 // Unused, historical\n\t},\n\t\n\tselfClosingTags = {\n\t\t\"AREA\": true,\n\t\t\"BASE\": true,\n\t\t\"BR\": true,\n\t\t\"COL\": true,\n\t\t\"COMMAND\": true,\n\t\t\"EMBED\": true,\n\t\t\"HR\": true,\n\t\t\"IMG\": true,\n\t\t\"INPUT\": true,\n\t\t\"KEYGEN\": true,\n\t\t\"LINK\": true,\n\t\t\"META\": true,\n\t\t\"PARAM\": true,\n\t\t\"SOURCE\": true,\n\t\t\"TRACK\": true,\n\t\t\"WBR\": true\n\t};\n\nexport {DOCTYPE, HEAD, BODY, DOCUMENT_ELEMENT, NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME, PARSER_OPTIONS, spacesRE, nodeTypes, selfClosingTags};\n\nexport function setupDocument( document )\n{\n\tvar firstElementPosition = -1,\n\t\tdocumentElementPosition = -1,\n\t\tdocumentTagName = \"HTML\";\n\t\n\tif ( document[DOCTYPE] && document[PARSER_OPTIONS].allowCustomRootElement )\n\t\tdocumentTagName = document[DOCTYPE].name.toUpperCase();\n\t\n\tfor ( let i = 0, l = document.childNodes.length; i < l; i++ )\n\t\tif ( document.childNodes[i].tagName === documentTagName )\n\t\t{\n\t\t\tdocumentElementPosition = i;\n\t\t\t\n\t\t\tdocument[NODE_TYPE] = nodeTypes.DOCUMENT_NODE;\n\t\t\tdocument[DOCUMENT_ELEMENT] = document.childNodes[i];\n\t\t\tdocument[HEAD] = document[BODY] = null;\n\t\t\tfor ( let k = 0; k < document[DOCUMENT_ELEMENT].childNodes.length; k++ )\n\t\t\t{\n\t\t\t\tconst node = document[DOCUMENT_ELEMENT].childNodes[k];\n\t\t\t\t\n\t\t\t\tswitch ( node.tagName )\n\t\t\t\t{\n\t\t\t\t\tcase \"HEAD\": document[HEAD] = node; break;\n\t\t\t\t\t\n\t\t\t\t\tcase \"BODY\":\n\t\t\t\t\tcase \"FRAMESET\":\n\t\t\t\t\t\tdocument[BODY] = node; break;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( document[HEAD] && document[BODY] ) break;\n\t\t\t}\n\t\t\t\n\t\t\tif ( firstElementPosition !== -1 )\n\t\t\t{\n\t\t\t\tconst newParent = document[HEAD] || document[BODY] || document[DOCUMENT_ELEMENT],\n\t\t\t\t\tcount = documentElementPosition - firstElementPosition;\n\t\t\t\tfor ( let k = firstElementPosition; k < documentElementPosition; k++ )\n\t\t\t\t\tsetNodeParent( document.childNodes[k], newParent );\n\t\t\t\tnewParent.childNodes.splice( 0, 0, ...document.childNodes.splice( firstElementPosition, count ) );\n\t\t\t\tdocumentElementPosition -= count;\n\t\t\t\tl -= count;\n\t\t\t}\n\t\t\t\n\t\t\tif ( documentElementPosition < l - 1 )\n\t\t\t{\n\t\t\t\tconst newParent = document[BODY] || document[HEAD] || document[DOCUMENT_ELEMENT];\n\t\t\t\tfor ( let k = documentElementPosition + 1; k < l; k++ )\n\t\t\t\t\tsetNodeParent( document.childNodes[k], newParent );\n\t\t\t\tnewParent.childNodes.splice( newParent.childNodes.length, 0, ...document.childNodes.splice( documentElementPosition + 1 ) );\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\t}\n\t\telse if ( firstElementPosition === -1 && document.childNodes[i].nodeType === nodeTypes.ELEMENT_NODE )\n\t\t\tfirstElementPosition = i;\n}\n\nexport function getDocument( node )\n{\n\tconst owner = node[OWNER] || node.getRootNode();\n\tif ( owner[NODE_TYPE] === nodeTypes.DOCUMENT_NODE || owner[NODE_TYPE] === nodeTypes.DOCUMENT_FRAGMENT_NODE )\n\t\treturn owner;\n\treturn null;\n}\n\nexport function detachNodes( nodes )\n{\n\tif ( nodes && nodes.length > 0 ) for ( let i = 0; i < nodes.length; i++ )\n\t\tsetNodeParent( nodes[i], null );\n}\n\nexport function setNodeParent( node, parent )\n{\n\tconst owner = (parent !== null ? getDocument( parent ) : null);\n\t\n\tif ( node[OWNER] !== owner && node.hasChildNodes() )\n\t\tnode.forEach( node => {node[OWNER] = owner}, null );\n\t\n\tnode[PARENT_NODE] = parent;\n\tnode[OWNER] = owner;\n}\n\nexport function globalizeRegExp( re )\n{\n\tif ( !re.global )\n\t{\n\t\tlet flags = re.flags;\n\t/* @START_BROWSER_ONLY */\n\t\tif ( flags === undefined )\n\t\t\tflags = re.toString().match( reFlagsRE )[0];\n\t/* @END_BROWSER_ONLY */\n\t\tre = new RegExp( re.source, flags +\"g\" );\n\t}\n\treturn re;\n}","import {spacesRE} from \"./utils.js\";\n\nconst ELEMENT = Symbol( \"element\" ),\n\tLENGTH = Symbol( \"length\" ),\n\t\n\tvalidClassTokenRE = /^\\S+$/,\n\t\n\tindexOf = Array.prototype.indexOf,\n\tjoin = Array.prototype.join,\n\tsplice = Array.prototype.splice;\n\nexport function createTokenList( elem )\n{\n\tconst list = Object.create( DOMTokenList.prototype );\n\t\n\tlist[LENGTH] = 0;\n\tlist[ELEMENT] = elem;\n\tconst className = elem.className;\n\tif ( className ) list.value = className;\n\t\n\treturn list;\n}\n\nexport default class DOMTokenList\n{\n\tconstructor()\n\t{\n\t\tthrow new Error( \"Cannot directly instantiate DOMTokenList.\" );\n\t}\n\t\n\tget length() {return this[LENGTH]}\n\tset length( val ) {}\n\t\n\tget value()\n\t{\n\t\treturn join.call( this, \" \" );\n\t}\n\tset value( val )\n\t{\n\t\tif ( this[LENGTH] > 0 )\n\t\t\tfor ( let k in this ) if ( this.hasOwnProperty( k ) && isFinite( k ) )\n\t\t\t\tdelete this[k];\n\t\tthis[LENGTH] = 0;\n\t\t\n\t\tif ( typeof val === \"string\" )\n\t\t\tthis.add.apply( this, val.split( spacesRE ) );\n\t\telse delete this[ELEMENT].attributes.class;\n\t}\n\t\n\tadd()\n\t{\n\t\tfor ( let i = 0; i < arguments.length; i++ )\n\t\t\tif ( indexOf.call( this, arguments[i] ) === -1 && this.supports( arguments[i] ) )\n\t\t\t\tthis[this[LENGTH]++] = arguments[i];\n\t\tthis[ELEMENT].attributes.class = this.value;\n\t}\n\t\n\tremove()\n\t{\n\t\tfor ( let i = 0, idx; i < arguments.length; i++ )\n\t\t{\n\t\t\tidx = indexOf.call( this, arguments[i] );\n\t\t\tif ( idx !== -1 )\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t}\n\t\tthis[ELEMENT].attributes.class = this.value;\n\t}\n\t\n\titem( v )\n\t{\n\t\tif ( typeof v === \"number\" && v >= 0 && v < this[LENGTH] )\n\t\t\treturn this[v];\n\t}\n\t\n\ttoggle( token, force )\n\t{\n\t\tvar exists = false;\n\t\tif ( this.supports( token ) )\n\t\t{\n\t\t\tlet idx = indexOf.call( this, token );\n\t\t\tif ( idx !== -1 && force !== true )\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t\telse if ( force !== false )\n\t\t\t{\n\t\t\t\texists = true;\n\t\t\t\tif ( idx === -1 )\n\t\t\t\t\tthis[this[LENGTH]++] = token;\n\t\t\t}\n\t\t\tthis[ELEMENT].attributes.class = this.value;\n\t\t}\n\t\treturn exists;\n\t}\n\t\n\tcontains( token )\n\t{\n\t\treturn (indexOf.call( this, token ) !== -1);\n\t}\n\t\n\treplace( token, newToken )\n\t{\n\t\tvar idx = indexOf.call( this, token );\n\t\tif ( idx >= 0 && this.supports( newToken ) )\n\t\t{\n\t\t\tif ( indexOf.call( this, newToken ) === -1 )\n\t\t\t\tthis[idx] = newToken;\n\t\t\telse\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t\tthis[ELEMENT].attributes.class = this.value;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tsupports( token )\n\t{\n\t\tif ( token && typeof token === \"string\" )\n\t\t\treturn token.match( validClassTokenRE );\n\t\treturn false;\n\t}\n}","// HTML \"style\" inline CSS property handling\n// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style\n\n// style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; border-bottom-color: hotpink; -moz-animation-iteration-count: 1\"\nconst ELEMENT = Symbol( \"element\" );\n\n// Conversions between kebab-case and camelCase forms of the CSS property name\n// The rules are as described in https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style\nfunction prop2dom(cssPropertyName) {\n\treturn cssPropertyName.replace(/-[a-z]/g, (r) => r.toUpperCase().substr(1));\n}\n// Note: dom2prop(dom2prop('camelCaseProp')) will work as expected so it's always safe\n// to use dom2prop to canonicalize property names in their kebab case (dashed) form\nfunction dom2prop(cssStyleDeclarationPropertyName) {\n\treturn cssStyleDeclarationPropertyName.replace(/[A-Z]/g, (r) => '-'+r.toLowerCase());\n}\n// In theory a valid CSS property (identifier) is more permissive, but in practice this covers all property names in use\nfunction valid(propertyName) {\n\tif (typeof propertyName !== 'string') return false;\n\t// Valid css property name\n\tif (propertyName.match(/^\\-?[a-z_-]*[a-z]$/)) return true;\n\t// Valid custom property\n\tif (propertyName.match(/^\\-\\-[A-Za-z_-]*[A-Za-z0-9]$/)) return true;\n\t// Valid DOM-style (camel case) property\n\tif (propertyName.match(/^[a-zA-Z]+$/)) return true;\n\n\treturn false;\n}\n\n// Parses a style=\"\" attribute into a map of property-value pairs for easier alterations\nfunction styleToMap(styleString = \"\") {\n\treturn new Map(styleString.split(/\\s*;\\s*/g).filter(s => s.length).map(sd => sd.trim().match(/^([a-z-]+)\\s*:\\s*(.*)$/).slice(1)));\n}\n\n// Stringifies a map of property-value pairs back into a style=\"\" inline style attribute value\nfunction mapToStyle(styleMap) {\n\treturn Array.from(styleMap?.entries() ?? []).map(e => e.join(': ')).join('; ');\n}\n\nexport function createInlineStyle( elem )\n{\n\tconst styleObject = {\n\t\t[ELEMENT]: elem\n\t};\n\n\tconst styleProxy = new Proxy(styleObject, {\n\t\tget(target, name) {\n\t\t\tif (name === ELEMENT) return elem;\n\t\t\tif (!valid(name)) return undefined;\n\n\t\t\tconst prop = dom2prop(name);\n\n\t\t\treturn styleToMap(elem.attributes.style).get(prop);\n\t\t},\n\t\tset(target, name, value) {\n\t\t\t// Fail silently (return truthy value to avoid showing an TypeError)\n\t\t\tif (!valid(name)) return true;\n\n\t\t\tconst prop = dom2prop(name);\n\t\t\tconst map = styleToMap(elem.attributes.style);\n\n\t\t\telem.attributes.style = mapToStyle(map.set(prop, value));\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, name) {\n\t\t\tif (!valid(name)) return;\n\n\t\t\tconst prop = dom2prop(name);\n\t\t\tconst map = styleToMap(elem.attributes.style);\n\n\t\t\telem.attributes.style = mapToStyle(map.delete(prop));\n\t\t},\n\t});\n\n\treturn styleProxy;\n}\n\nexport function updateInlineStyle( style, value )\n{\n\t// Parse and re-stringify value to validate format\n\tconst styleValue = mapToStyle(styleToMap(value));\n\n\tstyle[ELEMENT].attributes.style = styleValue;\n}\n\nexport default class CSSStyleDeclaration {\n\tconstructor()\n\t{\n\t\tthrow new Error( \"Cannot directly instantiate CSSStyleDeclaration.\" );\n\t}\n}\n","import {Lexer, EOF} from \"./lexer.js\";\n\nconst newLinesRE = /\\r\\n|\\r|\\f/g,\n\tanbSyntaxRE = /\\(\\s*(even|odd|(?:(?:([+-]?\\d*)n)\\s*(?:([+-])\\s*(\\d+))?|([+-]?\\d+)))\\s*/g;\n\nconst ParamTypes = {\n\tSelectors: 0,\n\tIdentifier: 1,\n\tIterator: 2,\n\tIteratorOf: 3\n};\n\nconst paramExpectations = {\n\t\"is\": ParamTypes.Selectors,\n\t\"not\": ParamTypes.Selectors,\n\t\"where\": ParamTypes.Selectors, // Alias of :is()\n\t\"has\": ParamTypes.Selectors,\n\t\n\t\"lang\": ParamTypes.Identifier, // Not implementing\n\t\"dir\": ParamTypes.Identifier, // Not implementing\n\t\n\t\"nth-child\": ParamTypes.IteratorOf,\n\t\"nth-last-child\": ParamTypes.IteratorOf,\n\t\n\t\"nth-of-type\": ParamTypes.Iterator,\n\t\"nth-last-of-type\": ParamTypes.Iterator,\n\t\"nth-col\": ParamTypes.Iterator, // Not implementing\n\t\"nth-last-col\": ParamTypes.Iterator, // Not implementing\n};\n\n// https://drafts.csswg.org/selectors-4/\n\nexport function parseSelector( selector )\n{\n\treturn parseSelectorList( new Lexer( selector.replace( newLinesRE, \"\\n\" ) ) );\n}\n\nfunction parseSelectorList( lexer, terminator = EOF, relative = false )\n{\n\tvar theChar = lexer.skipWhiteSpace(),\n\t\tselector = {},\n\t\tcompound = [],\n\t\tcomplex = [compound],\n\t\tast = [complex];\n\t\n\twhile ( theChar !== EOF && theChar !== terminator )\n\t{\n\t\tswitch ( theChar )\n\t\t{\n\t\t\tcase \"*\": // https://drafts.csswg.org/selectors-4/#universal-selector\n\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\tthrow syntaxError( \"Universal selectors must come before all other simple selectors.\", lexer );\n\t\t\t\tselector.type = \"universal\";\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"#\":\n\t\t\tcase \".\":\n\t\t\t{\n\t\t\t\tlexer.getNextChar();\n\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\n\t\t\t\tselector.type = (theChar === \"#\" ? \"id\" : \"class\");\n\t\t\t\tselector.name = name;\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"[\": // https://drafts.csswg.org/selectors-4/#attribute-selectors\n\t\t\t{\n\t\t\t\tlexer.getNextAfterWhiteSpace();\n\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\n\t\t\t\tselector.type = \"attr\";\n\t\t\t\tselector.name = name;\n\t\t\t\tselector.comparison = \"=\";\n\t\t\t\tselector.value = true;\n\t\t\t\tselector.ignoreCase = false;\n\t\t\t\t\n\t\t\t\tif ( (theChar = lexer.getNextAfterWhiteSpace()) !== \"]\" )\n\t\t\t\t{\n\t\t\t\t\tswitch ( theChar )\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"=\": break;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"~\":\n\t\t\t\t\t\tcase \"|\":\n\t\t\t\t\t\tcase \"^\":\n\t\t\t\t\t\tcase \"$\":\n\t\t\t\t\t\tcase \"*\":\n\t\t\t\t\t\t\tif ( lexer.peek() !== \"=\" ) throw syntaxError( \"Expected '='.\", lexer, 1 );\n\t\t\t\t\t\t\tselector.comparison = theChar + selector.comparison;\n\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tdefault: throw syntaxError( \"Unexpected character '\"+ (theChar === EOF ? \"END_OF_INPUT\" : theChar) +\"'.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttheChar = lexer.getNextAfterWhiteSpace();\n\t\t\t\t\tif ( theChar === \"'\" || theChar === '\"' )\n\t\t\t\t\t{\n\t\t\t\t\t\t// https://drafts.csswg.org/css-syntax-3/#consume-string-token\n\t\t\t\t\t\tconst quote = theChar;\n\t\t\t\t\t\t\n\t\t\t\t\t\tselector.value = \"\";\n\t\t\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile ( theChar !== EOF && theChar !== quote && theChar !== \"\\n\" )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( theChar === \"\\\\\" )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tselector.value += parseEscapedCodePoint( lexer );\n\t\t\t\t\t\t\t\ttheChar = lexer.getChar();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tselector.value += theChar;\n\t\t\t\t\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\t\tselector.value = name;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( lexer.getNextAfterWhiteSpace() !== \"]\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ident = parseIdentifier( lexer );\n\t\t\t\t\t\tif ( ident === \"i\" || ident === \"I\" )\n\t\t\t\t\t\t\tselector.ignoreCase = true;\n\t\t\t\t\t\telse if ( ident === \"s\" || ident === \"S\" )\n\t\t\t\t\t\t\tselector.ignoreCase = false;\n\t\t\t\t\t\telse if ( ident )\n\t\t\t\t\t\t\tthrow syntaxError( \"Unexpected identifier '\"+ ident +\"'.\", lexer, -ident.length + 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( lexer.getNextAfterWhiteSpace() !== \"]\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Expected ']'.\", lexer, -1 + ident.length );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \":\":\n\t\t\t{\n\t\t\t\tlexer.getNextChar();\n\t\t\t\tif ( lexer.match( \":\" ) ) // https://drafts.csswg.org/selectors-4/#pseudo-elements\n\t\t\t\t{\n\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected a pseudo-element name.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"pseudo-element\";\n\t\t\t\t\tselector.name = name;\n\t\t\t\t}\n\t\t\t\telse // https://drafts.csswg.org/selectors-4/#pseudo-classes\n\t\t\t\t{\n\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected a pseudo-class name.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"pseudo-class\";\n\t\t\t\t\tselector.name = name;\n\t\t\t\t\t\n\t\t\t\t\tconst paramType = paramExpectations[name];\n\t\t\t\t\tif ( paramType != null )\n\t\t\t\t\t{\n\t\t\t\t\t\tselector.type = \"pseudo-fn\";\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( lexer.getNextChar() !== \"(\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Expected '('.\", lexer );\n\t\t\t\t\t\t\n\t\t\t\t\t\tswitch ( paramType )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase ParamTypes.IteratorOf: // https://drafts.csswg.org/selectors-4/#nth-child-pseudo\n\t\t\t\t\t\t\tcase ParamTypes.Iterator: // https://drafts.csswg.org/css-syntax-3/#anb-microsyntax\n\t\t\t\t\t\t\t\tlet A = 0, B = 0, ofSelector;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tanbSyntaxRE.lastIndex = lexer.index;\n\t\t\t\t\t\t\t\tconst match = anbSyntaxRE.exec( lexer.str );\n\t\t\t\t\t\t\t\tif ( !match ) throw syntaxError( \"Invalid parameter.\", lexer, 1 );\n\t\t\t\t\t\t\t\tlexer.advance( match[0].length );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( paramType === ParamTypes.IteratorOf )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\t\t\t\t\t\tconst savedIdx = lexer.index;\n\t\t\t\t\t\t\t\t\tif ( parseIdentifier( lexer ).toLowerCase() === \"of\" )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tconst chr = lexer.getNextChar();\n\t\t\t\t\t\t\t\t\t\tif ( chr !== \")\" && !lexer.isWhiteSpace( chr ) )\n\t\t\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected whitespace.\", lexer );\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tofSelector = parseSelectorList( lexer, \")\" );\n\t\t\t\t\t\t\t\t\t\tif ( !(ofSelector instanceof Array) || ofSelector.length === 0 )\n\t\t\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected at least one selector.\", lexer );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse lexer.goToIndex( savedIdx );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( lexer.skipWhiteSpace() !== \")\" )\n\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected ')'.\", lexer );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( match[1] === \"even\" || match[1] === \"odd\" )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tA = 2;\n\t\t\t\t\t\t\t\t\tif ( match[1] === \"odd\" ) B = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if ( match[5] ) // We found just an integer.\n\t\t\t\t\t\t\t\t\tB = parseInt( match[5], 10 );\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ( match[2] === \"-\" ) A = -1;\n\t\t\t\t\t\t\t\t\telse if ( !match[2] || match[2] === \"+\" ) A = 1;\n\t\t\t\t\t\t\t\t\telse A = parseInt( match[2], 10 );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( match[3] )\n\t\t\t\t\t\t\t\t\t\tB = parseInt( match[3] + match[4], 10 );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tselector.params = [A, B];\n\t\t\t\t\t\t\t\tif ( ofSelector ) selector.params.push( ofSelector );\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase ParamTypes.Selectors:\n\t\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\t\tselector.params = parseSelectorList( lexer, \")\", true );\n\t\t\t\t\t\t\t\tif ( selector.params.length === 0 )\n\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected at least one selector.\", lexer );\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase ParamTypes.Identifier:\n\t\t\t\t\t\t\t\tif ( isIdentifierStart( lexer.getNextAfterWhiteSpace() ) )\n\t\t\t\t\t\t\t\t\tselector.params = [parseIdentifier( lexer )];\n\t\t\t\t\t\t\t\telse throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( lexer.skipWhiteSpace() !== \")\" ) throw syntaxError( \"Expected ')'.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\t// Having this branch here allows custom functional pseudo-classes with\n\t\t\t\t\t// these names to be defined by the user.\n\t\t\t\t\telse if ( name === \"before\" || name === \"after\" || name === \"first-line\" || name === \"first-letter\" )\n\t\t\t\t\t\tselector.type = \"pseudo-element\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t// https://drafts.csswg.org/selectors-4/#combinators\n\t\t\tcase \"+\":\n\t\t\tcase \">\":\n\t\t\tcase \"~\":\n\t\t\t\tif ( compound.length === 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( complex.length === 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( relative )\n\t\t\t\t\t\t\tcomplex.unshift( [{type: \"pseudo-class\", name: \"scope\"}] );\n\t\t\t\t\t\telse throw syntaxError( \"Absolute selectors cannot start with a combinator.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( typeof complex[complex.length - 2] === \"string\" )\n\t\t\t\t\t\tthrow syntaxError( \"Cannot have multiple combinators in a row.\", lexer );\n\t\t\t\t\tcomplex.splice( complex.length - 1, 0, theChar );\n\t\t\t\t}\n\t\t\t\telse complex.push( theChar, compound = [] );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \",\":\n\t\t\t\tif ( compound.length === 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( complex.length > 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tcomplex.pop();\n\t\t\t\t\t\tif ( typeof complex[complex.length - 1] === \"string\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Complex selectors are not allowed to end with a combinator.\", lexer, -1 );\n\t\t\t\t\t\tast.push( complex = [compound] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse ast.push( complex = [compound = []] );\n\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\tif ( lexer.isWhiteSpace( theChar ) )\n\t\t\t\t{\n\t\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\t\tcomplex.push( compound = [] );\n\t\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\t\tlexer.advance( -1 );\n\t\t\t\t}\n\t\t\t\telse if ( isIdentifierStart( theChar ) )\n\t\t\t\t{\n\t\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\t\tthrow syntaxError( \"Type (tag name) selectors must come before all other simple selectors.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"type\";\n\t\t\t\t\t// We'll always have a valid identifier here, thanks to\n\t\t\t\t\t// the isIdentifierStart() above.\n\t\t\t\t\tselector.name = parseIdentifier( lexer ).toUpperCase();\n\t\t\t\t\t\n\t\t\t\t\tcompound.push( selector );\n\t\t\t\t\tselector = {};\n\t\t\t\t}\n\t\t\t\telse throw syntaxError( \"Unexpected character '\"+ theChar +\"'.\", lexer );\n\t\t}\n\t\ttheChar = lexer.getNextChar();\n\t}\n\t\n\tif ( compound.length === 0 )\n\t{\n\t\tif ( complex.length === 1 )\n\t\t{\n\t\t\tast.pop();\n\t\t\tcomplex = ast[ast.length - 1];\n\t\t}\n\t\telse complex.pop();\n\t}\n\t\n\tif ( complex && typeof complex[complex.length - 1] === \"string\" )\n\t\tthrow syntaxError( \"Complex selectors are not allowed to end with a combinator.\", lexer, -1 );\n\t\n\treturn ast;\n}\n\nfunction syntaxError( message, lexer, offset = 0 )\n{\n\tvar error = new SyntaxError( message ),\n\t\tcolumn = lexer.index + offset;\n\terror.stack = \"SyntaxError: \"+ message +\"\\n\\n\"+ lexer.str +\"\\n\"+ \" \".repeat( column ) +\"^\\n at index \"+ column;\n\treturn error;\n}\n\n// https://drafts.csswg.org/css-syntax-3/#consume-name\nfunction parseIdentifier( lexer )\n{\n\tvar name = \"\",\n\t\ttheChar = lexer.getChar();\n\t\n\tif ( isIdentifierStart( theChar ) )\n\t{\n\t\tdo\n\t\t{\n\t\t\tif ( theChar === \"\\\\\" )\n\t\t\t{\n\t\t\t\tname += parseEscapedCodePoint( lexer );\n\t\t\t\ttheChar = lexer.getChar();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tname += theChar;\n\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t}\n\t\t}\n\t\twhile ( theChar !== EOF && (isIdentifierStart( theChar ) || (theChar >= \"0\" && theChar <= \"9\") || theChar === \"-\") )\n\t\tlexer.advance( -1 );\n\t}\n\t\n\treturn name;\n}\n\n// https://drafts.csswg.org/css-syntax-3/#consume-escaped-code-point\nfunction parseEscapedCodePoint( lexer )\n{\n\tvar theChar = lexer.getNextChar();\n\t\n\tif ( isHexDigit( theChar ) )\n\t{\n\t\tlet codePoint = \"\";\n\t\t\n\t\tfor ( let i = 5; i >= 0 && isHexDigit( theChar ); i-- )\n\t\t{\n\t\t\tcodePoint += theChar;\n\t\t\ttheChar = lexer.getNextChar();\n\t\t}\n\t\t\n\t\tif ( lexer.isWhiteSpace( theChar ) )\n\t\t\tlexer.getNextChar();\n\t\t\n\t\tcodePoint = parseInt( codePoint, 16 ) | 0;\n\t\tif ( codePoint === 0 ||\n\t\t\t(codePoint >= 0xD800 && codePoint <= 0xDFFF) || // Surrogate\n\t\t\tcodePoint > 0x10FFFF ) // Maximum allowed code point\n\t\t\t\treturn \"\\uFFFD\";\n\t\treturn String.fromCodePoint( codePoint );\n\t}\n\telse if ( theChar === EOF ) return \"\\uFFFD\";\n\t\n\tlexer.getNextChar();\n\treturn theChar;\n}\n\nfunction isHexDigit( theChar )\n{\n\treturn (theChar !== EOF && ((theChar >= \"0\" && theChar <= \"9\") || (theChar >= \"A\" && theChar <= \"F\") || (theChar >= \"a\" && theChar <= \"f\")));\n}\n\nfunction isIdentifierStart( theChar )\n{\n\treturn ((theChar >= \"A\" && theChar <= \"Z\") || (theChar >= \"a\" && theChar <= \"z\") || theChar === \"_\" || theChar >= \"\\u0080\" || theChar === \"\\\\\");\n}","import {parseSelector} from \"./selector-parser.js\";\nimport Node from \"./node.js\";\nimport {NODE_TYPE, PARENT_NODE, TAG_NAME, spacesRE, getDocument} from \"./utils.js\";\n\nconst STATE_INITIAL = 0,\n\tSTATE_DESCENDANT_COMBINATOR = 1,\n\tSTATE_CHILD_COMBINATOR = 2,\n\tSTATE_NEXT_SIBLING_COMBINATOR = 3,\n\tSTATE_SUBSEQUENT_SIBLING_COMBINATOR = 4,\n\t\n\tstateTransitions = {\n\t\t\">\": STATE_CHILD_COMBINATOR,\n\t\t\"+\": STATE_NEXT_SIBLING_COMBINATOR,\n\t\t\"~\": STATE_SUBSEQUENT_SIBLING_COMBINATOR\n\t},\n\t\n\tpseudoProcs = {\n\t\tis( scope, node, selectors )\n\t\t{\n\t\t\treturn matchesSelectorList( scope, node, selectors );\n\t\t},\n\t\tnot( scope, node, selectors )\n\t\t{\n\t\t\treturn !matchesSelectorList( scope, node, selectors );\n\t\t},\n\t\thas( scope, node, selectors )\n\t\t{\n\t\t\tvar has = false;\n\t\t\t\n\t\t\tfor ( let i = 0; i < selectors.length; i++ )\n\t\t\t\tif ( selectors[i][0] instanceof Array && isRelativeSimpleSelector( selectors[i][0][0] ) )\n\t\t\t\t{\n\t\t\t\t\thas = matchesSelectorList( node, node, selectors, true );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t\tif ( !has && node.childNodes.length > 0 ) node.forEach( elem =>\n\t\t\t{\n\t\t\t\tif ( matchesSelectorList( node, elem, selectors ) )\n\t\t\t\t{\n\t\t\t\t\thas = true;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t\n\t\t\treturn has;\n\t\t},\n\t\t\n\t\t[\"nth-child\"]( scope, node, args )\n\t\t{\n\t\t\tconst parent = node[PARENT_NODE],\n\t\t\t\tnodes = parent.childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] );\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t{\n\t\t\t\t\tif ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t[\"nth-last-child\"]( scope, node, args )\n\t\t{\n\t\t\tconst parent = node[PARENT_NODE],\n\t\t\t\tnodes = parent.childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] );\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t{\n\t\t\t\t\tif ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\t[\"nth-of-type\"]( scope, node, args )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] ),\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t{\n\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t}\n\t\t\t\n\t\t\t// For code here to be reachable, 'node' would have to not be inside\n\t\t\t// its own parent, or the above test of 'nodes[i] === node' would\n\t\t\t// have to be skippable. Since neither of these scenarios is\n\t\t\t// possible (for now), an explicit 'return false' here never\n\t\t\t// executes and isn't needed.\n\t\t},\n\t\t[\"nth-last-of-type\"]( scope, node, args )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] ),\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t{\n\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t}\n\t\t\t\n\t\t\t// For code here to be reachable, 'node' would have to not be inside\n\t\t\t// its own parent, or the above test of 'nodes[i] === node' would\n\t\t\t// have to be skippable. Since neither of these scenarios is\n\t\t\t// possible (for now), an explicit 'return false' here never\n\t\t\t// executes and isn't needed.\n\t\t}\n\t},\n\tpseudoClasses = {\n\t\tscope( scope, node )\n\t\t{\n\t\t\treturn (node === scope);\n\t\t},\n\t\t\n\t\tenabled( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"BUTTON\":\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\tcase \"OPTGROUP\":\n\t\t\t\tcase \"OPTION\":\n\t\t\t\tcase \"FIELDSET\":\n\t\t\t\t\treturn !node.hasAttribute( \"disabled\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tdisabled( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"BUTTON\":\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\tcase \"OPTGROUP\":\n\t\t\t\tcase \"OPTION\":\n\t\t\t\tcase \"FIELDSET\":\n\t\t\t\t\treturn node.hasAttribute( \"disabled\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\tchecked( scope, node )\n\t\t{\n\t\t\tif ( node[TAG_NAME] === \"INPUT\" )\n\t\t\t{\n\t\t\t\tconst type = node.getAttribute( \"type\" );\n\t\t\t\tif ( type === \"checkbox\" || type === \"radio\" )\n\t\t\t\t\treturn node.hasAttribute( \"checked\" );\n\t\t\t}\n\t\t\telse if ( node[TAG_NAME] === \"OPTION\" )\n\t\t\t\treturn node.hasAttribute( \"selected\" );\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\trequired( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\t\treturn node.hasAttribute( \"required\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\toptional( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\t\treturn !node.hasAttribute( \"required\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\troot( scope, node )\n\t\t{\n\t\t\tconst document = getDocument( scope );\n\t\t\treturn (!!document && document.documentElement === node);\n\t\t},\n\t\tempty( scope, node )\n\t\t{\n\t\t\treturn (node.childNodes.length === 0);\n\t\t},\n\t\t\n\t\t[\"first-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"last-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"only-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tlet first, last;\n\t\t\tfor ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- )\n\t\t\t{\n\t\t\t\tif ( !first && nodes[s][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\tfirst = nodes[s];\n\t\t\t\tif ( !last && nodes[e][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\tlast = nodes[e];\n\t\t\t}\n\t\t\treturn (first === last && first === node);\n\t\t},\n\t\t\n\t\t[\"first-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"last-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"only-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tlet first, last;\n\t\t\tfor ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- )\n\t\t\t{\n\t\t\t\tif ( !first && nodes[s][TAG_NAME] === tagName )\n\t\t\t\t\tfirst = nodes[s];\n\t\t\t\tif ( !last && nodes[e][TAG_NAME] === tagName )\n\t\t\t\t\tlast = nodes[e];\n\t\t\t}\n\t\t\treturn (first === last && first === node);\n\t\t}\n\t};\n\npseudoProcs.where = pseudoProcs.is;\n\nexport function querySelector( scope, selector, all )\n{\n\tconst selectors = parseSelector( selector ),\n\t\tresult = [];\n\t\n\tscope.forEach( node =>\n\t{\n\t\tif ( matchesSelectorList( scope, node, selectors ) )\n\t\t{\n\t\t\tresult.push( node );\n\t\t\tif ( !all ) return false;\n\t\t}\n\t} );\n\t\n\treturn (all ? result : (result[0] || null));\n}\n\nexport function closest( scope, selector )\n{\n\tconst selectors = parseSelector( selector );\n\tlet node = scope;\n\t\n\twhile ( node != null && node[NODE_TYPE] === Node.ELEMENT_NODE )\n\t{\n\t\tif ( matchesSelectorList( scope, node, selectors ) )\n\t\t\treturn node;\n\t\tnode = node[PARENT_NODE];\n\t}\n\t\n\treturn null;\n}\n\nexport function matches( scope, selector )\n{\n\treturn matchesSelectorList( scope, scope, parseSelector( selector ) );\n}\n\nfunction matchesSelectorList( scope, node, selectors, relative = false )\n{\n\tvar currentNode;\n\t\nList:\n\tfor ( let i = 0; i < selectors.length; i++ )\n\t{\n\t\tconst complex = selectors[i];\n\t\tlet state = STATE_INITIAL;\n\t\t\n\t\tif ( relative && complex[0] instanceof Array && !isRelativeSimpleSelector( complex[0][0] ) )\n\t\t\tcontinue;\n\t\t\n\t\tcurrentNode = node;\n\t\t\n\tComplex:\n\t\tfor ( let x = (relative ? 0 : complex.length - 1);\n\t\t\t(relative ? x < complex.length : x >= 0);\n\t\t\t(relative ? x++ : x--) )\n\t\t{\n\t\t\tif ( stateTransitions.hasOwnProperty( complex[x] ) )\n\t\t\t\tstate = stateTransitions[complex[x]];\n\t\t\telse switch ( state )\n\t\t\t{\n\t\t\t\tcase STATE_INITIAL:\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tstate = STATE_DESCENDANT_COMBINATOR;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_DESCENDANT_COMBINATOR:\n\t\t\t\t\twhile ( currentNode = currentNode[PARENT_NODE] )\n\t\t\t\t\t\tif ( matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\t\tcontinue Complex;\n\t\t\t\t\tcontinue List;\n\t\t\t\t\t\n\t\t\t\tcase STATE_CHILD_COMBINATOR:\n\t\t\t\t\tcurrentNode = currentNode[PARENT_NODE];\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_NEXT_SIBLING_COMBINATOR:\n\t\t\t\t{\n\t\t\t\t\tconst nodes = currentNode[PARENT_NODE].childNodes;\n\t\t\t\t\tcurrentNode = nodes[nodes.indexOf( currentNode ) + (relative ? 1 : -1)];\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase STATE_SUBSEQUENT_SIBLING_COMBINATOR:\n\t\t\t\t{\n\t\t\t\t\tconst nodes = currentNode[PARENT_NODE].childNodes;\n\t\t\t\t\tfor ( let k = nodes.indexOf( currentNode ) + (relative ? 1 : -1);\n\t\t\t\t\t\t\t(relative ? k < nodes.length : k >= 0);\n\t\t\t\t\t\t\t(relative ? k++ : k--) )\n\t\t\t\t\t\tif ( matchesCompoundSelector( scope, nodes[k], complex[x] ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrentNode = nodes[k];\n\t\t\t\t\t\t\tcontinue Complex;\n\t\t\t\t\t\t}\n\t\t\t\t\tcontinue List;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction matchesCompoundSelector( scope, node, compound )\n{\n\tif ( !node || node[NODE_TYPE] !== Node.ELEMENT_NODE )\n\t\treturn false;\n\tfor ( let i = 0; i < compound.length; i++ )\n\t{\n\t\tconst simple = compound[i];\n\t\tlet matched;\n\t\t\n\t\tmatched = false;\n\t\tswitch ( simple.type )\n\t\t{\n\t\t\tcase \"universal\": return true;\n\t\t\t\n\t\t\tcase \"type\": matched = (node[TAG_NAME] === simple.name); break;\n\t\t\tcase \"id\": matched = (node.id === simple.name); break;\n\t\t\tcase \"class\": matched = node.classList.contains( simple.name ); break;\n\t\t\t\n\t\t\tcase \"attr\":\n\t\t\t\tif ( simple.comparison === \"=\" && (simple.value === true || simple.value === \"\") )\n\t\t\t\t\tmatched = node.hasAttribute( simple.name );\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlet attr = node.getAttribute( simple.name );\n\t\t\t\t\tif ( typeof attr === \"string\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tlet value = (simple.ignoreCase ? simple.value.toLowerCase() : simple.value);\n\t\t\t\t\t\tif ( simple.ignoreCase ) attr = attr.toLowerCase();\n\t\t\t\t\t\tif ( value !== \"\" ) switch ( simple.comparison )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase \"=\": matched = (attr === value); break;\n\t\t\t\t\t\t\tcase \"~=\": matched = attr.split( spacesRE ).indexOf( value ) !== -1; break;\n\t\t\t\t\t\t\tcase \"|=\": matched = (attr === value || attr.startsWith( value +\"-\" )); break;\n\t\t\t\t\t\t\tcase \"^=\": matched = attr.startsWith( value ); break;\n\t\t\t\t\t\t\tcase \"$=\": matched = attr.endsWith( value ); break;\n\t\t\t\t\t\t\tcase \"*=\": matched = attr.indexOf( value ) !== -1; break;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"pseudo-element\": break;\n\t\t\t\n\t\t\tcase \"pseudo-class\":\n\t\t\t\tif ( pseudoClasses.hasOwnProperty( simple.name ) )\n\t\t\t\t\tmatched = !!pseudoClasses[simple.name].call( null, scope, node );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"pseudo-fn\":\n\t\t\t\tif ( pseudoProcs.hasOwnProperty( simple.name ) )\n\t\t\t\t\tmatched = !!pseudoProcs[simple.name].call( null, scope, node, simple.params );\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif ( !matched ) return false;\n\t}\n\treturn true;\n}\n\nfunction isRelativeSimpleSelector( simple )\n{\n\treturn (!!simple && simple.type === \"pseudo-class\" && simple.name === \"scope\");\n}\n\nclass ChildIterator\n{\n\tconstructor( A, B )\n\t{\n\t\tthis.A = parseInt( A, 10 ) | 0;\n\t\tthis.B = parseInt( B, 10 ) | 0;\n\t\tthis.current = 0;\n\t}\n\t\n\tnext()\n\t{\n\t\tif ( this.A === 0 && this.B === 0 )\n\t\t\treturn false;\n\t\t\n\t\tthis.current += 1;\n\t\t\n\t\tlet match = false;\n\t\tif ( this.A === 0 )\n\t\t\tmatch = (this.current === this.B);\n\t\telse if ( (this.A < 0 && this.B >= this.current) || (this.A > 0 && this.current >= this.B) )\n\t\t\tmatch = (((this.current + this.B) % this.A) === 0);\n\t\t\n\t\treturn match;\n\t}\n}","import {PARSER_OPTIONS, nodeTypes, selfClosingTags, getDocument} from \"./utils.js\";\n\nexport function serializeNode( elem )\n{\n\tvar tagName = elem.tagName,\n\t\towner = getDocument( elem ),\n\t\tentities = owner ? owner.entityEncoder : null,\n\t\thtml = \"\";\n\tswitch ( elem.nodeType )\n\t{\n\t\tcase nodeTypes.ELEMENT_NODE:\n\t\t\ttagName = tagName.toLowerCase();\n\t\t\thtml += \"<\"+ tagName;\n\t\t\tfor ( let k in elem.attributes )\n\t\t\t\tif ( elem.attributes.hasOwnProperty( k ) )\n\t\t\t\t{\n\t\t\t\t\tlet attr = elem.attributes[k];\n\t\t\t\t\tif ( attr === true )\n\t\t\t\t\t\tattr = \"\";\n\t\t\t\t\telse if ( entities && owner[PARSER_OPTIONS] )\n\t\t\t\t\t\tattr = encodeEntities( attr, entities, owner[PARSER_OPTIONS] );\n\t\t\t\t\t\n\t\t\t\t\thtml += \" \"+ k;\n\t\t\t\t\tif ( attr !== \"\" )\n\t\t\t\t\t\thtml += '=\"'+ attr +'\"';\n\t\t\t\t}\n\t\t\thtml += \">\";\n\t\t\t\n\t\t\tfor ( let i = 0; i < elem.childNodes.length; i++ )\n\t\t\t\thtml += serializeNode( elem.childNodes[i] );\n\t\t\t\n\t\t\tif ( selfClosingTags[elem.tagName] !== true )\n\t\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.TEXT_NODE:\n\t\t\tif ( entities && owner[PARSER_OPTIONS] &&\n\t\t\t\t(!elem.parentNode || (elem.parentNode.tagName !== \"SCRIPT\" && elem.parentNode.tagName !== \"STYLE\")) )\n\t\t\t\t\thtml += encodeEntities( elem.nodeValue, entities, owner[PARSER_OPTIONS] );\n\t\t\telse html += elem.nodeValue;\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.CDATA_SECTION_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.PROCESSING_INSTRUCTION_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.COMMENT_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.DOCUMENT_TYPE_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t}\n\treturn html;\n}\n\nfunction encodeEntities( text, entities, options )\n{\n\tif ( options.encodeEntities === false )\n\t\treturn text;\n\telse if ( options.encodeEntities === true || !(options.encodeEntities instanceof RegExp) )\n\t\treturn entities.encode( text );\n\treturn entities.encode( text, options.encodeEntities );\n}","import DOM from \"./document.js\";\nimport Parser from \"./html-parser.js\";\nimport EventTarget from \"./event-target.js\";\nimport {createTokenList} from \"./token-list.js\";\nimport {createInlineStyle, updateInlineStyle} from \"./css-style-declaration.js\";\nimport {querySelector, closest, matches} from \"./selectors.js\";\nimport {serializeNode} from \"./serializer.js\";\nimport {DOCTYPE, HEAD, BODY, NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME, PARSER_OPTIONS,\n\tspacesRE, nodeTypes, selfClosingTags, setupDocument, getDocument, detachNodes, setNodeParent} from \"./utils.js\";\n\nconst CLASS_LIST = Symbol( \"classList\" );\nconst INLINE_STYLE = Symbol( \"style\" );\n\nexport const EXTEND_NODE = Symbol( \"extendNode\" );\n\nexport function createNode( nodeType, baseClass = Node )\n{\n\tconst node = Object.create( baseClass.prototype );\n\t\n\tnode[NODE_TYPE] = nodeType;\n\tnode.nodeValue = null;\n\tnode[PARENT_NODE] = null;\n\tnode[OWNER] = null;\n\t\n\tswitch ( nodeType )\n\t{\n\t\tcase Node.ELEMENT_NODE:\n\t\t\tnode[TAG_NAME] = null;\n\t\t\tnode.attributes = {};\n\t\t\t// fallthrough\n\t\t\t\n\t\tcase Node.DOCUMENT_NODE:\n\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\tnode.childNodes = [];\n\t}\n\t\n\treturn node;\n}\n\nexport default class Node extends EventTarget\n{\n\tconstructor()\n\t{\n\t\tsuper();\n\n\t\t// We allow `extend`-ing `class`-es to call super(EXTEND_NODE)\n\t\tif (arguments[0] === EXTEND_NODE) return;\n\n\t\tthrow new Error( \"Cannot directly instantiate Node.\" );\n\t}\n\t\n\tget nodeType() {return this[NODE_TYPE]}\n\t\n\tget nodeName()\n\t{\n\t\tswitch ( this.nodeType )\n\t\t{\n\t\t\tcase Node.ELEMENT_NODE: return this.tagName;\n\t\t\tcase Node.TEXT_NODE: return \"#text\";\n\t\t\tcase Node.CDATA_SECTION_NODE: return \"#cdata-section\";\n\t\t\tcase Node.PROCESSING_INSTRUCTION_NODE: return this.target;\n\t\t\tcase Node.COMMENT_NODE: return \"#comment\";\n\t\t\tcase Node.DOCUMENT_NODE: return \"#document\";\n\t\t\tcase Node.DOCUMENT_TYPE_NODE: return this.name;\n\t\t\tcase Node.DOCUMENT_FRAGMENT_NODE: return \"#document-fragment\";\n\t\t}\n\t}\n\t\n\tget parentNode() {return this[PARENT_NODE]}\n\tget ownerDocument() {return this[OWNER]}\n\tget tagName() {return this[TAG_NAME] || null}\n\t\n\tget firstChild()\n\t{\n\t\tif ( this.childNodes ) return this.childNodes[0] || null;\n\t\treturn null;\n\t}\n\t\n\tget lastChild()\n\t{\n\t\tif ( this.childNodes ) return this.childNodes[this.childNodes.length - 1] || null;\n\t\treturn null;\n\t}\n\t\n\tget previousSibling()\n\t{\n\t\tconst parent = this.parentNode;\n\t\tif ( parent )\n\t\t{\n\t\t\tconst idx = parent.childNodes.indexOf( this );\n\t\t\tif ( idx > 0 ) return parent.childNodes[idx - 1];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget nextSibling()\n\t{\n\t\tconst parent = this.parentNode;\n\t\tif ( parent )\n\t\t{\n\t\t\tconst idx = parent.childNodes.indexOf( this );\n\t\t\tif ( idx > -1 && idx < parent.childNodes.length - 1 ) return parent.childNodes[idx + 1];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget id()\n\t{\n\t\treturn (this.attributes && this.attributes.id) || \"\";\n\t}\n\tset id( id )\n\t{\n\t\tif ( this.attributes )\n\t\t\tthis.attributes.id = id;\n\t}\n\t\n\tget className()\n\t{\n\t\treturn (this.attributes && this.attributes.class) || \"\";\n\t}\n\tset className( val )\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tthis.classList.value = val;\n\t\t\tthis.attributes.class = this[CLASS_LIST].value;\n\t\t}\n\t}\n\t\n\tget classList()\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[CLASS_LIST] )\n\t\t\t\tthis[CLASS_LIST] = createTokenList( this );\n\t\t\treturn this[CLASS_LIST];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget innerHTML()\n\t{\n\t\tif ( this.nodeType === Node.ELEMENT_NODE )\n\t\t{\n\t\t\tlet html = \"\";\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\thtml += serializeNode( this.childNodes[i] );\n\t\t\treturn html;\n\t\t}\n\t\treturn null;\n\t}\n\tset innerHTML( html )\n\t{\n\t\tif ( this.nodeType === Node.ELEMENT_NODE && selfClosingTags[this.tagName] !== true )\n\t\t{\n\t\t\tconst nodes = parseHTML( this, html );\n\t\t\tif ( nodes )\n\t\t\t\taddChildNode( this, nodes, 0, this.childNodes.length );\n\t\t\telse\n\t\t\t{\n\t\t\t\tdetachNodes( this.childNodes );\n\t\t\t\tthis.childNodes.length = 0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tget outerHTML()\n\t{\n\t\treturn serializeNode( this );\n\t}\n\tset outerHTML( html )\n\t{\n\t\tif ( this.parentNode )\n\t\t{\n\t\t\tconst idx = this.parentNode.childNodes.indexOf( this ),\n\t\t\t\tnodes = parseHTML( this, html );\n\t\t\tif ( nodes )\n\t\t\t\taddChildNode( this.parentNode, nodes, idx, 1 );\n\t\t\telse detachNodes( this.parentNode.childNodes.splice( idx, 1 ) );\n\t\t}\n\t}\n\n\tget style()\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[INLINE_STYLE] )\n\t\t\t\tthis[INLINE_STYLE] = createInlineStyle( this );\n\t\t\treturn this[INLINE_STYLE];\n\t\t}\n\t\treturn null;\n\t}\n\tset style( value )\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[INLINE_STYLE] )\n\t\t\t\tthis[INLINE_STYLE] = createInlineStyle( this );\n\n\t\t\tupdateInlineStyle( this[INLINE_STYLE], value );\n\t\t}\n\t}\n\t\n\tget textContent()\n\t{\n\t\tif ( this.childNodes )\n\t\t{\n\t\t\tlet text = \"\";\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t{\n\t\t\t\tif ( this.childNodes[i].nodeType !== Node.COMMENT_NODE &&\n\t\t\t\t\t\tthis.childNodes[i].nodeType !== Node.CDATA_SECTION_NODE &&\n\t\t\t\t\t\tthis.childNodes[i].nodeType !== Node.PROCESSING_INSTRUCTION_NODE )\n\t\t\t\t\ttext += this.childNodes[i].textContent;\n\t\t\t}\n\t\t\treturn text;\n\t\t}\n\t\treturn this.nodeValue;\n\t}\n\tset textContent( text )\n\t{\n\t\tif ( text == null )\n\t\t\ttext = \"\";\n\t\telse if ( typeof text !== \"string\" )\n\t\t\ttext += \"\";\n\t\t\n\t\tif ( this.childNodes )\n\t\t{\n\t\t\tlet node = createNode( Node.TEXT_NODE );\n\t\t\tnode.nodeValue = text;\n\t\t\tsetNodeParent( node, this );\n\t\t\t\n\t\t\tdetachNodes( this.childNodes );\n\t\t\tthis.childNodes.length = 1;\n\t\t\tthis.childNodes[0] = node;\n\t\t}\n\t\telse if ( this.nodeType >= Node.TEXT_NODE && this.nodeType <= Node.COMMENT_NODE )\n\t\t\tthis.nodeValue = text;\n\t}\n\t\n\tgetRootNode()\n\t{\n\t\tlet rootNode = this;\n\t\twhile ( rootNode.parentNode )\n\t\t\trootNode = rootNode.parentNode;\n\t\treturn rootNode;\n\t}\n\t\n\thasAttributes()\n\t{\n\t\tif ( this.attributes ) for ( let k in this.attributes )\n\t\t\tif ( this.attributes.hasOwnProperty( k ) ) return true;\n\t\treturn false;\n\t}\n\t\n\tgetAttributeNames()\n\t{\n\t\tif ( this.attributes )\n\t\t\treturn Object.keys( this.attributes );\n\t\treturn [];\n\t}\n\t\n\tgetAttribute( name )\n\t{\n\t\tvar result;\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t\tresult = this.attributes[lowerAttributeCase( this, name )];\n\t\tif ( result === undefined )\n\t\t\treturn null;\n\t\treturn result;\n\t}\n\t\n\tsetAttribute( name, value )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( name === \"class\" )\n\t\t\t{\n\t\t\t\tif ( value !== true )\n\t\t\t\t\tthis.className = \"\"+ value;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.classList.value = \"\";\n\t\t\t\t\tthis.attributes[name] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( typeof value === \"string\" || value === true )\n\t\t\t\tthis.attributes[name] = value;\n\t\t\telse this.attributes[name] = \"\"+ value;\n\t\t}\n\t}\n\t\n\ttoggleAttribute( name, force )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( !this.attributes.hasOwnProperty( name ) )\n\t\t\t{\n\t\t\t\tif ( arguments.length === 1 || force === true )\n\t\t\t\t\treturn (this.attributes[name] = true);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse if ( arguments.length === 1 || force === false )\n\t\t\t{\n\t\t\t\tdelete this.attributes[name];\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\t\n\tremoveAttribute( name )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( name === \"class\" && this[CLASS_LIST] )\n\t\t\t\tthis[CLASS_LIST].value = null;\n\t\t\tdelete this.attributes[name];\n\t\t}\n\t}\n\t\n\thasAttribute( name )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t\treturn this.attributes.hasOwnProperty( lowerAttributeCase( this, name ) );\n\t\treturn false;\n\t}\n\t\n\thasChildNodes()\n\t{\n\t\treturn (!!this.childNodes && this.childNodes.length > 0);\n\t}\n\t\n\tappendChild( child )\n\t{\n\t\treturn this.insertBefore( child, null );\n\t}\n\t\n\tinsertBefore( newChild, refChild )\n\t{\n\t\tif ( this.childNodes && newChild instanceof Node && arguments.length > 1 )\n\t\t{\n\t\t\tlet idx = -1;\n\t\t\t\n\t\t\tif ( refChild == null )\n\t\t\t\tidx = this.childNodes.length;\n\t\t\telse if ( refChild instanceof Node && refChild.parentNode === this )\n\t\t\t\tidx = this.childNodes.indexOf( refChild );\n\t\t\t\n\t\t\tif ( idx !== -1 )\n\t\t\t\treturn addChildNode( this, newChild, idx );\n\t\t}\n\t\treturn null;\n\t}\n\t\n\treplaceChild( newChild, oldChild )\n\t{\n\t\tif ( this.childNodes && oldChild instanceof Node && newChild instanceof Node &&\n\t\t\toldChild.parentNode === this && oldChild !== newChild )\n\t\t{\n\t\t\taddChildNode( this, newChild, this.childNodes.indexOf( oldChild ), 1 );\n\t\t\treturn oldChild;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tremoveChild( child )\n\t{\n\t\tif ( this.childNodes && child instanceof Node && child.parentNode === this )\n\t\t{\n\t\t\tconst idx = this.childNodes.indexOf( child ),\n\t\t\t\towner = getDocument( this );\n\t\t\t\n\t\t\tif ( owner && child.parentNode === owner.documentElement && tagNameProp.hasOwnProperty( child.tagName ) )\n\t\t\t\towner[tagNameProp[child.tagName]] = null;\n\t\t\t\n\t\t\tdetachNodes( this.childNodes.splice( idx, 1 ) );\n\t\t\treturn child;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tcloneNode( deep )\n\t{\n\t\tvar clone;\n\t\t\n\t\tif ( this.nodeType === Node.DOCUMENT_NODE || this.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t\t\tclone = new DOM( null, this[PARSER_OPTIONS] );\n\t\telse clone = createNode( this.nodeType );\n\t\t\n\t\tswitch ( this.nodeType )\n\t\t{\n\t\t\tcase Node.ELEMENT_NODE:\n\t\t\t\tclone[TAG_NAME] = this.tagName;\n\t\t\t\tclone.attributes = Object.assign( clone.attributes, this.attributes );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.TEXT_NODE:\n\t\t\tcase Node.CDATA_SECTION_NODE:\n\t\t\tcase Node.PROCESSING_INSTRUCTION_NODE:\n\t\t\tcase Node.COMMENT_NODE:\n\t\t\t\tclone.nodeValue = this.nodeValue;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.DOCUMENT_NODE:\n\t\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\t\tclone[NODE_TYPE] = this.nodeType;\n\t\t\t\tclone.entityEncoder.entities = this.entityEncoder;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.DOCUMENT_TYPE_NODE:\n\t\t\t\tclone.name = this.name;\n\t\t\t\tclone.publicId = this.publicId;\n\t\t\t\tclone.systemId = this.systemId;\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif ( deep === true && this.childNodes && this.childNodes.length > 0 )\n\t\t{\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\tclone.appendChild( this.childNodes[i].cloneNode( true ) );\n\t\t\t\n\t\t\tif ( clone.nodeType === Node.DOCUMENT_NODE || clone.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t\t\t\tsetupDocument( clone );\n\t\t}\n\t\t\n\t\treturn clone;\n\t}\n\t\n\tgetElementById( id )\n\t{\n\t\tvar elem = null;\n\t\tif ( id && typeof id === \"string\" && this.childNodes )\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( node.id === id )\n\t\t\t\t{\n\t\t\t\t\telem = node;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} );\n\t\treturn elem;\n\t}\n\t\n\tgetElementsByClassName( className )\n\t{\n\t\tvar nodeList = [];\n\t\tif ( className && typeof className === \"string\" )\n\t\t{\n\t\t\tconst classList = className.trim().split( spacesRE );\n\t\t\tif ( classList.length > 1 || classList[0] !== \"\" ) this.forEach( node =>\n\t\t\t{\n\t\t\t\tfor ( let i = 0; i < classList.length; i++ )\n\t\t\t\t\tif ( !node.classList.contains( classList[i] ) )\n\t\t\t\t\t\treturn;\n\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\t}\n\t\treturn nodeList;\n\t}\n\t\n\tgetElementsByTagName( tagName )\n\t{\n\t\tvar nodeList = [];\n\t\tif ( tagName && typeof tagName === \"string\" )\n\t\t{\n\t\t\ttagName = tagName.toUpperCase();\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( tagName === \"*\" || node.tagName === tagName )\n\t\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\t}\n\t\treturn nodeList;\n\t}\n\t\n\tclosest( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn closest( this, selector );\n\t\telse return null;\n\t}\n\t\n\tmatches( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn matches( this, selector );\n\t\telse return false;\n\t}\n\t\n\tquerySelector( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn querySelector( this, selector, false );\n\t\telse return null;\n\t}\n\t\n\tquerySelectorAll( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn querySelector( this, selector, true );\n\t\telse return [];\n\t}\n\t\n\t// Non-standard\n\t\n\tforEach( callback, type = nodeTypes.ELEMENT_NODE )\n\t{\n\t\t// This unrolled recursive function is about 1.45x faster in Node than its\n\t\t// equivalent recursive form.\n\t\t\n\t\tlet childNodes = this.childNodes,\n\t\t\tcurrent = this.firstChild,\n\t\t\tidxStack = [],\n\t\t\tidx = 0,\n\t\t\tparent, nextSibling;\n\t\t\n\t\twhile ( current )\n\t\t{\n\t\t\t// 'parent' and 'nextSibling' are stored here so that if callback() changes\n\t\t\t// the document, we can maintain our place in the overall list of nodes by\n\t\t\t// looking for insertions, deletions, or replacements within the 'current'\n\t\t\t// node's list of siblings.\n\t\t\tparent = current[PARENT_NODE];\n\t\t\tnextSibling = childNodes[idx + 1];\n\t\t\t\n\t\t\tif ( (type === null || current.nodeType === type) &&\n\t\t\t\tcallback( current, parent ) === false )\n\t\t\t\t\treturn;\n\t\t\t\n\t\t\t// If the parent of 'current' changes during callback(), we no longer want to\n\t\t\t// look at the children of 'current' here as it was either moved or removed.\n\t\t\tif ( current[PARENT_NODE] === parent && current.childNodes && current.childNodes.length > 0 )\n\t\t\t{\n\t\t\t\tidxStack.push( idx );\n\t\t\t\tchildNodes = current.childNodes;\n\t\t\t\tcurrent = childNodes[idx = 0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( nextSibling )\n\t\t\t\t{\n\t\t\t\t\tidx += 1;\n\t\t\t\t\t// If callback() changed the number of nodes that come before the\n\t\t\t\t\t// previously found 'nextSibling', 'idx' needs to be updated so we\n\t\t\t\t\t// don't skip over or repeat visits to any nodes.\n\t\t\t\t\tif ( nextSibling !== childNodes[idx] )\n\t\t\t\t\t\tidx = parent.childNodes.indexOf( nextSibling );\n\t\t\t\t}\n\t\t\t\telse idx = childNodes.length;\n\t\t\t\t\n\t\t\t\twhile ( childNodes[idx] == null )\n\t\t\t\t{\n\t\t\t\t\tcurrent = parent;\n\t\t\t\t\tparent = current[PARENT_NODE];\n\t\t\t\t\tif ( current && current !== this )\n\t\t\t\t\t{\n\t\t\t\t\t\tchildNodes = parent.childNodes;\n\t\t\t\t\t\tidx = idxStack.pop() + 1;\n\t\t\t\t\t}\n\t\t\t\t\telse return;\n\t\t\t\t}\n\t\t\t\tcurrent = childNodes[idx];\n\t\t\t}\n\t\t}\n\t}\n}\n\nObject.defineProperties( Node,\n{\n\tELEMENT_NODE: {value: nodeTypes.ELEMENT_NODE},\n\t//ATTRIBUTE_NODE: {value: nodeTypes.ATTRIBUTE_NODE},\n\tTEXT_NODE: {value: nodeTypes.TEXT_NODE},\n\tCDATA_SECTION_NODE: {value: nodeTypes.CDATA_SECTION_NODE},\n\t//ENTITY_REFERENCE_NODE: {value: nodeTypes.ENTITY_REFERENCE_NODE},\n\t//ENTITY_NODE: {value: nodeTypes.ENTITY_NODE},\n\tPROCESSING_INSTRUCTION_NODE: {value: nodeTypes.PROCESSING_INSTRUCTION_NODE},\n\tCOMMENT_NODE: {value: nodeTypes.COMMENT_NODE},\n\tDOCUMENT_NODE: {value: nodeTypes.DOCUMENT_NODE},\n\tDOCUMENT_TYPE_NODE: {value: nodeTypes.DOCUMENT_TYPE_NODE},\n\tDOCUMENT_FRAGMENT_NODE: {value: nodeTypes.DOCUMENT_FRAGMENT_NODE},\n\t//NOTATION_NODE: {value: nodeTypes.NOTATION_NODE},\n} );\n\nconst tagNameProp = {\n\tHEAD,\n\tBODY,\n\tFRAMESET: BODY\n};\n\nfunction addChildNode( parent, node, index, removalCount = 0 )\n{\n\tif ( !parent ||\n\t\t(parent.nodeType !== Node.ELEMENT_NODE &&\n\t \t\tparent.nodeType !== Node.DOCUMENT_NODE &&\n\t \t\tparent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) ||\n\t\t(parent.nodeType === Node.ELEMENT_NODE && selfClosingTags[parent.tagName] === true) )\n\t\t\treturn node;\n\t\n\tif ( node.nodeType <= Node.COMMENT_NODE )\n\t{\n\t\tif ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE )\n\t\t{\n\t\t\tif ( tagNameProp.hasOwnProperty( node.tagName ) )\n\t\t\t{\n\t\t\t\tconst prop = tagNameProp[node.tagName];\n\t\t\t\tif ( parent.parentNode[prop] && removalCount === 0 )\n\t\t\t\t\treturn node;\n\t\t\t\tparent.parentNode[prop] = node;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ( node.parentNode )\n\t\t\tnode.parentNode.removeChild( node );\n\t\tsetNodeParent( node, parent );\n\t\tdetachNodes( parent.childNodes.splice( index, removalCount, node ) );\n\t}\n\telse if ( node.nodeType === Node.DOCUMENT_TYPE_NODE &&\n\t\t(parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) )\n\t{\n\t\tconst owner = node.parentNode;\n\t\tif ( owner && (owner.nodeType === Node.DOCUMENT_NODE || owner.nodeType === Node.DOCUMENT_FRAGMENT_NODE) )\n\t\t{\n\t\t\towner.removeChild( node );\n\t\t\towner[DOCTYPE] = null;\n\t\t}\n\t\tsetNodeParent( node, parent );\n\t\tdetachNodes( parent.childNodes.splice( index, removalCount, node ) );\n\t\tparent[DOCTYPE] = node;\n\t}\n\telse if ( node.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t{\n\t\tif ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE )\n\t\t{\n\t\t\tif ( removalCount > 0 )\n\t\t\t\tdetachNodes( parent.childNodes.splice( index, removalCount ) );\n\t\t\tfor ( let i = node.childNodes.length - 1; i >= 0; i-- )\n\t\t\t{\n\t\t\t\tconst child = node.childNodes[i];\n\t\t\t\tif ( tagNameProp.hasOwnProperty( child.tagName ) )\n\t\t\t\t{\n\t\t\t\t\tconst prop = tagNameProp[child.tagName];\n\t\t\t\t\tif ( parent.parentNode[prop] && removalCount === 0 )\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tparent.parentNode[prop] = child;\n\t\t\t\t}\n\t\t\t\tsetNodeParent( child, parent );\n\t\t\t\tparent.childNodes.splice( index, 0, child );\n\t\t\t\tnode.childNodes.splice( i, 1 );\n\t\t\t}\n\t\t}\n\t\telse if ( node !== getDocument( parent ) )\n\t\t{\n\t\t\tfor ( let i = 0; i < node.childNodes.length; i++ )\n\t\t\t\tsetNodeParent( node.childNodes[i], parent );\n\t\t\tdetachNodes( parent.childNodes.splice( index, removalCount, ...node.childNodes ) );\n\t\t\tnode.childNodes.length = 0;\n\t\t}\n\t}\n\t\n\treturn node;\n}\n\nfunction parseHTML( parent, html )\n{\n\tif ( html && typeof html === \"string\" )\n\t{\n\t\tconst owner = getDocument( parent );\n\t\treturn new Parser( html, owner ? owner[PARSER_OPTIONS] : null, owner ? owner.entityEncoder : null ).parseHTML();\n\t}\n}\n\nfunction lowerAttributeCase( node, name )\n{\n\tconst owner = getDocument( node );\n\tif ( owner && owner[PARSER_OPTIONS].lowerAttributeCase )\n\t\treturn name.toLowerCase();\n\treturn name;\n}","import {Lexer, EOF} from \"./lexer.js\";\nimport Node, {createNode} from \"./node.js\";\nimport {NODE_TYPE, TAG_NAME, PARSER_OPTIONS, spacesRE, selfClosingTags, setNodeParent, globalizeRegExp} from \"./utils.js\";\n\nconst toLowerCase = String.prototype.toLowerCase,\n\ttoUpperCase = String.prototype.toUpperCase,\n\t\n\tdefaultOptions = {\n\t\tallowCustomRootElement: false,\n\t\tallowSelfClosingSyntax: false,\n\t\tallowCDATA: false,\n\t\tallowProcessingInstructions: false,\n\t\tdecodeEntities: false,\n\t\tencodeEntities: false,\n\t\tcollapseWhitespace: false,\n\t\ttrimWhitespace: false,\n\t\tlowerAttributeCase: false\n\t},\n\t\n\tSTATE_START_TAG = 0,\n\tSTATE_ATTRIBUTE = 1,\n\tSTATE_END_TAG = 2,\n\t\n\t// '12.1.2.3 Attributes' from HTML5 spec.\n\tattributeNameExclusions = {\n\t\t//\"\\0\": true, // This is caught by the lexer in isWhiteSpace().\n\t\t//'\"': true, // Disabled to better match browser behaviour.\n\t\t//\"'\": true, // Disabled to better match browser behaviour.\n\t\t\">\": true,\n\t\t\"/\": true,\n\t\t\"=\": true\n\t},\n\t\n\tpTagBoundary = {P: true},\n\tdefinitionTagBoundary = {DT: true, DD: true},\n\ttableStructureTagBoundary = {TBODY: true, THEAD: true, TFOOT: true},\n\ttableCellTagBoundary = {TD: true, TH: true},\n\tformElementTagBoundary = {BUTTON: true, DATALIST: true, OPTGROUP: true, OPTION: true, PROGRESS: true, SELECT: true, TEXTAREA: true},\n\t\n\t// Largely based on '8.1.2.4 Optional tags' from the HTML5 spec.\n\t// https://www.w3.org/TR/html50/syntax.html#syntax-tag-omission\n\ttagBoundaries = {\n\t\tADDRESS: pTagBoundary,\n\t\tARTICLE: pTagBoundary,\n\t\tASIDE: pTagBoundary,\n\t\tBLOCKQUOTE: pTagBoundary,\n\t\tDIV: pTagBoundary,\n\t\tFIELDSET: pTagBoundary,\n\t\tFOOTER: pTagBoundary,\n\t\tH1: pTagBoundary,\n\t\tH2: pTagBoundary,\n\t\tH3: pTagBoundary,\n\t\tH4: pTagBoundary,\n\t\tH5: pTagBoundary,\n\t\tH6: pTagBoundary,\n\t\tHEADER: pTagBoundary,\n\t\tHGROUP: pTagBoundary,\n\t\tHR: pTagBoundary,\n\t\tMAIN: pTagBoundary,\n\t\tNAV: pTagBoundary,\n\t\tP: pTagBoundary,\n\t\tPRE: pTagBoundary,\n\t\tSECTION: pTagBoundary,\n\t\t\n\t\tBODY: {HEAD: true, TITLE: true},\n\t\t\n\t\t// Definitions\n\t\tDL: pTagBoundary,\n\t\tDD: definitionTagBoundary,\n\t\tDT: definitionTagBoundary,\n\t\t\n\t\t// Tables\n\t\tTABLE: pTagBoundary,\n\t\tTBODY: tableStructureTagBoundary,\n\t\tTHEAD: tableStructureTagBoundary,\n\t\tTD: tableCellTagBoundary,\n\t\tTFOOT: tableStructureTagBoundary,\n\t\tTH: tableCellTagBoundary,\n\t\tTR: {TR: true},\n\t\t\n\t\t// Lists\n\t\tLI: {LI: true},\n\t\tOL: pTagBoundary,\n\t\tUL: pTagBoundary,\n\t\t\n\t\t// Forms\n\t\tBUTTON: formElementTagBoundary,\n\t\tDATALIST: formElementTagBoundary,\n\t\tFORM: pTagBoundary,\n\t\tINPUT: formElementTagBoundary,\n\t\tOPTGROUP: {OPTGROUP: true, OPTION: true},\n\t\tOPTION: {OPTION: true},\n\t\tOUTPUT: formElementTagBoundary,\n\t\tPROGRESS: formElementTagBoundary,\n\t\tSELECT: formElementTagBoundary,\n\t\tTEXTAREA: formElementTagBoundary,\n\t};\n\nexport default class Parser\n{\n\tconstructor( html, options, entityEncoder )\n\t{\n\t\tthis.options = Parser.setupOptions( options );\n\t\tthis.lexer = new Lexer( html );\n\t\tthis.entityEncoder = entityEncoder;\n\t}\n\t\n\tstatic setupOptions( options )\n\t{\n\t\toptions = Object.assign( {}, defaultOptions, options );\n\t\tif ( options.encodeEntities instanceof RegExp )\n\t\t\toptions.encodeEntities = globalizeRegExp( options.encodeEntities );\n\t\treturn Object.freeze( options );\n\t}\n\t\n\tstatic isNameCharStart( chr )\n\t{\n\t\treturn chr === \":\" || chr === \"_\" || (chr >= \"A\" && chr <= \"Z\") || (chr >= \"a\" && chr <= \"z\") ||\n\t\t\t(chr >= \"\\xC0\" && chr <= \"\\xD6\") || (chr >= \"\\xD8\" && chr <= \"\\xF6\") ||\n\t\t\t(chr >= \"\\xF8\" && chr <= \"\\u02FF\") || (chr >= \"\\u0370\" && chr <= \"\\u037D\") ||\n\t\t\t(chr >= \"\\u037F\" && chr <= \"\\u1FFF\") || chr === \"\\u200C\" || chr === \"\\u200D\" ||\n\t\t\t(chr >= \"\\u2070\" && chr <= \"\\u218F\") || (chr >= \"\\u2C00\" && chr <= \"\\u2FEF\") ||\n\t\t\t(chr >= \"\\u3001\" && chr <= \"\\uD7FF\") || (chr >= \"\\uF900\" && chr <= \"\\uFDCF\") ||\n\t\t\t(chr >= \"\\uFDF0\" && chr <= \"\\uFFFD\") || (chr >= \"\\u10000\" && chr <= \"\\uEFFFF\");\n\t}\n\t\n\tstatic isNameChar( chr )\n\t{\n\t\treturn Parser.isNameCharStart( chr ) ||\n\t\t\t(chr >= \"0\" && chr <= \"9\") || chr === \"-\" || chr === \".\" || chr === \"\\xB7\" ||\n\t\t\t(chr >= \"\\u0300\" && chr <= \"\\u036F\") || chr === \"\\u203F\" || chr === \"\\u2040\";\n\t}\n\t\n\tparseHTML()\n\t{\n\t\tvar rootNode = createNode( Node.DOCUMENT_FRAGMENT_NODE ),\n\t\t\tscopeChain = [rootNode], theChar;\n\t\t\n\t\trootNode[PARSER_OPTIONS] = this.options;\n\t\t\n\t\tif ( this.options.trimWhitespace )\n\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\telse theChar = this.lexer.getChar();\n\t\t\n\t\twhile ( theChar !== EOF && scopeChain.length > 0 )\n\t\t{\n\t\t\tif ( theChar === \"<\" )\n\t\t\t\tthis.parseTag( scopeChain );\n\t\t\telse this.parseText( scopeChain );\n\t\t\t\n\t\t\tif ( this.options.trimWhitespace )\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\telse theChar = this.lexer.getChar();\n\t\t}\n\t\t\n\t\treturn rootNode;\n\t}\n\t\n\tparseTag( scopeChain )\n\t{\n\t\tvar node, name, selfClosing, state = STATE_START_TAG,\n\t\t\ttagStartIdx = this.lexer.index,\n\t\t\ttheChar = this.lexer.getNextChar(),\n\t\t\tstartIdx, endIdx;\n\t\t\n\t\tif ( theChar !== EOF )\n\tMain:\n\t\twhile ( theChar !== \">\" && theChar !== EOF )\n\t\t{\n\t\t\tstartIdx = this.lexer.index;\n\t\t\t\n\t\t\tif ( state === STATE_START_TAG )\n\t\t\t{\n\t\t\t\tif ( theChar === \"!\" || theChar === \"?\" )\n\t\t\t\t{\n\t\t\t\t\tif ( this.options.allowProcessingInstructions && this.lexer.match( \"?\" ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\ttheChar = this.lexer.getChar();\n\t\t\t\t\tPINode:\n\t\t\t\t\t\tif ( Parser.isNameCharStart( theChar ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode = createNode( Node.PROCESSING_INSTRUCTION_NODE );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Find target's name.\n\t\t\t\t\t\t\twhile ( theChar !== EOF && Parser.isNameChar( theChar ) )\n\t\t\t\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// If we have a non-whitespace character here that isn't EOF or\n\t\t\t\t\t\t\t// the end '?>', then we've come across an invalid name character\n\t\t\t\t\t\t\t// in the target name and this tag should be treated as a comment.\n\t\t\t\t\t\t\tif ( !this.lexer.isWhiteSpace( theChar ) && theChar !== EOF &&\n\t\t\t\t\t\t\t\t\t!(theChar === \"?\" && this.lexer.peek() === \">\") )\n\t\t\t\t\t\t\t\tbreak PINode;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tnode.target = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.lexer.skipWhiteSpace();\n\t\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\t\tthis.lexer.goToString( \"?>\" );\n\t\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\t\tthis.lexer.advance( 1 );\n\t\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Go back to before the first '?' to include everything between the\n\t\t\t\t\t\t// angle brackets in the comment we're going to create from this tag.\n\t\t\t\t\t\tthis.lexer.advance( startIdx - this.lexer.index - 1 );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( this.options.allowCDATA && this.lexer.match( \"![CDATA[\" ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tnode = createNode( Node.CDATA_SECTION_NODE );\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tthis.lexer.goToString( \"]]>\" );\n\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\tthis.lexer.advance( 2 );\n\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( this.lexer.match( \"!DOCTYPE\", false ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.lexer.skipWhiteSpace();\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tthis.lexer.goToString( \">\" );\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet rootNode = scopeChain[scopeChain.length - 1];\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( rootNode.doctype )\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse if ( rootNode.childNodes.length > 0 )\n\t\t\t\t\t\t\tfor ( let i = rootNode.childNodes.length - 1; i >= 0; i-- )\n\t\t\t\t\t\t\t\tif ( rootNode.childNodes[i].nodeType < Node.TEXT_NODE || rootNode.childNodes[i].nodeType > Node.COMMENT_NODE )\n\t\t\t\t\t\t\t\t\tbreak Main;\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet params = this.lexer.str.slice( startIdx, this.lexer.index ).split( spacesRE );\n\t\t\t\t\t\tnode = createNode( Node.DOCUMENT_TYPE_NODE );\n\t\t\t\t\t\tnode.name = toLowerCase.call( params.shift() );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( params.length > 1 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlet idType = toLowerCase.call( params.shift() );\n\t\t\t\t\t\t\tparams = params.join( \" \" ).split( '\"' );\n\t\t\t\t\t\t\tif ( params[0] === \"\" ) switch ( idType )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcase \"public\":\n\t\t\t\t\t\t\t\t\tparams.shift();\n\t\t\t\t\t\t\t\t\tnode.publicId = params.shift();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcase \"system\":\n\t\t\t\t\t\t\t\t\tparams.shift();\n\t\t\t\t\t\t\t\t\tnode.systemId = params.shift();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( !node.publicId ) node.publicId = \"\";\n\t\t\t\t\t\tif ( !node.systemId ) node.systemId = \"\";\n\t\t\t\t\t\t\n\t\t\t\t\t\trootNode.childNodes.push( node );\n\t\t\t\t\t\trootNode.doctype = node;\n\t\t\t\t\t\tsetNodeParent( node, rootNode );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlet endTag;\n\t\t\t\t\t\tif ( this.lexer.match( \"!--\" ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( !this.lexer.match( \">\" ) && !this.lexer.match( \"->\" ) )\n\t\t\t\t\t\t\t\tendTag = \"-->\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( theChar === \"!\" ) // Don't skip question marks that show up here.\n\t\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\tendTag = \">\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tnode = createNode( Node.COMMENT_NODE );\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tif ( endTag ) this.lexer.goToString( endTag );\n\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\tthis.lexer.advance( endTag ? endTag.length - 1 : -1 );\n\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ( theChar === \"/\" )\n\t\t\t\t{\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tstate = STATE_END_TAG;\n\t\t\t\t\tstartIdx += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( state === STATE_ATTRIBUTE )\n\t\t\t{\n\t\t\t\t// Find an attribute name.\n\t\t\t\twhile ( (this.lexer.index === startIdx && theChar === \"=\") ||\n\t\t\t\t\t\t(!this.lexer.isWhiteSpace( theChar ) &&\n \t\t\t\t\t\t!attributeNameExclusions[theChar] &&\n \t\t\t\t\t\ttheChar !== EOF) )\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\tendIdx = this.lexer.index;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Find a tag name.\n\t\t\t\twhile ( ((theChar >= \"a\" && theChar <= \"z\") || (theChar >= \"A\" && theChar <= \"Z\") ||\n\t\t\t\t\t\t(this.lexer.index > startIdx && ((theChar >= \"0\" && theChar <= \"9\") || theChar === \"-\" || theChar === \"_\" || theChar === \":\"))) &&\n\t\t\t\t\t\ttheChar !== EOF )\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\tif ( theChar === EOF )\n\t\t\t\t{\n\t\t\t\t\tthis.addTextNode( scopeChain, tagStartIdx, endIdx, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\n\t\t\t\tif ( state === STATE_END_TAG )\n\t\t\t\t\ttheChar = this.lexer.goToString( \">\" );\n\t\t\t}\n\t\t\t\n\t\t\tif ( startIdx === endIdx )\n\t\t\t{\n\t\t\t\t// Found an illegal character while searching for an attribute or tag name.\n\t\t\t\tif ( this.options.allowSelfClosingSyntax && theChar === \"/\" && this.lexer.peek() === \">\" )\n\t\t\t\t{\n\t\t\t\t\t// If self-closing tag syntax is allowed, and we've found \"/>\", then we\n\t\t\t\t\t// need to close the tag at the top of the scope chain.\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tstate = STATE_END_TAG;\n\t\t\t\t\tname = scopeChain[0][TAG_NAME];\n\t\t\t\t}\n\t\t\t\telse if ( state === STATE_START_TAG )\n\t\t\t\t{\n\t\t\t\t\tthis.lexer.goToString( \"<\" );\n\t\t\t\t\tthis.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false );\n\t\t\t\t\ttagStartIdx = this.lexer.index;\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if ( state === STATE_END_TAG )\n\t\t\t\t{\n\t\t\t\t\tif ( startIdx === this.lexer.index ) break; // This throws \"\" away.\n\t\t\t\t\tnode = this.addTextNode( scopeChain, startIdx, this.lexer.index );\n\t\t\t\t\tnode[NODE_TYPE] = Node.COMMENT_NODE;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// All other illegal characters are simply skipped over, along with any\n\t\t\t\t\t// following whitespace.\n\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tname = this.lexer.str.slice( startIdx, endIdx );\n\t\t\t\tif ( state !== STATE_ATTRIBUTE )\n\t\t\t\t\tname = toUpperCase.call( name );\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t}\n\t\t\t\n\t\t\tswitch ( state )\n\t\t\t{\n\t\t\t\tcase STATE_START_TAG:\n\t\t\t\t\tnode = createNode( Node.ELEMENT_NODE );\n\t\t\t\t\tnode[TAG_NAME] = name;\n\t\t\t\t\twhile ( tagBoundaries.hasOwnProperty( node[TAG_NAME] ) && tagBoundaries[node[TAG_NAME]][scopeChain[0][TAG_NAME]] )\n\t\t\t\t\t\tscopeChain.splice( 0, 1 );\n\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\tstate = STATE_ATTRIBUTE;\n\t\t\t\t\tselfClosing = selfClosingTags[node[TAG_NAME]];\n\t\t\t\t\tif ( selfClosing !== true ) scopeChain.unshift( node );\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_ATTRIBUTE:\n\t\t\t\t\tlet value = true;\n\t\t\t\t\t\n\t\t\t\t\tif ( this.options.lowerAttributeCase )\n\t\t\t\t\t\tname = toLowerCase.call( name );\n\t\t\t\t\t\n\t\t\t\t\tif ( theChar === \"=\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( theChar === '\"' || theChar === \"'\" )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\tthis.lexer.goToString( theChar );\n\t\t\t\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\t\t\t\tstartIdx += 1;\n\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse // Unquoted attribute value\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twhile ( !this.lexer.isWhiteSpace( theChar ) &&\n\t\t\t\t\t\t\t\t\t//!unquotedAttributeExclusions[theChar] &&\n\t\t\t\t\t\t\t\t\ttheChar !== \">\" &&\n\t\t\t\t\t\t\t\t\t(!this.options.allowSelfClosingSyntax || !(theChar === \"/\" && this.lexer.peek() === \">\")) &&\n\t\t\t\t\t\t\t\t\ttheChar !== EOF )\n\t\t\t\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( node.attributes.hasOwnProperty( name ) ) break;\n\t\t\t\t\t\tvalue = this.lexer.str.slice( startIdx, endIdx );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( value === \"\" )\n\t\t\t\t\t\t\tvalue = true;\n\t\t\t\t\t\telse if ( this.options.decodeEntities )\n\t\t\t\t\t\t\tvalue = this.entityEncoder.decode( value );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( node.attributes.hasOwnProperty( name ) ) break;\n\t\t\t\t\t\n\t\t\t\t\tnode.attributes[name] = value;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_END_TAG:\n\t\t\t\t\tfor ( let i = 0; i < scopeChain.length; i++ )\n\t\t\t\t\t\tif ( scopeChain[i][TAG_NAME] === name )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode = scopeChain[i];\n\t\t\t\t\t\t\twhile ( scopeChain.length > 0 && scopeChain[0] !== node )\n\t\t\t\t\t\t\t\tscopeChain.shift();\n\t\t\t\t\t\t\tscopeChain.shift();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse this.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false );\n\t\t\n\t\tthis.lexer.getNextChar();\n\t}\n\t\n\tparseText( scopeChain )\n\t{\n\t\tvar startIdx = this.lexer.index,\n\t\t\tpreserveContent = false;\n\t\t\n\t\tif ( scopeChain[0][TAG_NAME] === \"SCRIPT\" || scopeChain[0][TAG_NAME] === \"STYLE\" )\n\t\t{\n\t\t\tthis.lexer.goToString( \"<\\/\"+ scopeChain[0][TAG_NAME], false );\n\t\t\tpreserveContent = true;\n\t\t}\n\t\telse this.lexer.goToString( \"<\" );\n\t\t\n\t\tthis.addTextNode( scopeChain, startIdx, this.lexer.index, preserveContent );\n\t}\n\t\n\taddTextNode( scopeChain, startIdx, endIdx, preserveContent )\n\t{\n\t\tvar node = createNode( Node.TEXT_NODE ),\n\t\t\tvalue = this.lexer.str.slice( startIdx, endIdx );\n\t\t\n\t\tif ( preserveContent != null )\n\t\t{\n\t\t\tif ( this.options.trimWhitespace )\n\t\t\t\tvalue = value.trim();\n\t\t\telse if ( this.options.collapseWhitespace && !preserveContent )\n\t\t\t\tvalue = value.replace( spacesRE, \" \" );\n\t\t\t\n\t\t\tif ( this.options.decodeEntities && !preserveContent )\n\t\t\t\tvalue = this.entityEncoder.decode( value );\n\t\t}\n\t\t\n\t\tnode.nodeValue = value;\n\t\tscopeChain[0].childNodes.push( node );\n\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\n\t\treturn node;\n\t}\n}","export class ImageData {\n constructor(widthOrData, heightOrWidth, settingsOrHeight, settings) {\n var _a, _b;\n const rgbaArray = (widthOrData instanceof Uint8ClampedArray) ? widthOrData : null;\n let colorSpace = \"srgb\";\n if (rgbaArray) {\n console.log(`[ImageData] Warning: Array initializer support is experimental! ( new ImageData([${rgbaArray.length}b ${(_b = (_a = rgbaArray === null || rgbaArray === void 0 ? void 0 : rgbaArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : \"Array\"}], ${Array.from(arguments).slice(1).join(',')}) )`);\n this.width = heightOrWidth;\n this.height = typeof settingsOrHeight === \"number\" ? settingsOrHeight : undefined;\n colorSpace = (typeof settingsOrHeight === \"object\" ? settingsOrHeight : (typeof settings === \"object\" ? settings : { colorSpace: \"srgb\" })).colorSpace;\n }\n else {\n this.width = widthOrData;\n this.height = heightOrWidth;\n colorSpace = (typeof settingsOrHeight === \"object\" ? settingsOrHeight : { colorSpace: \"srgb\" }).colorSpace;\n }\n if (colorSpace !== \"srgb\") {\n console.log(`[ImageData] Warning: Only the 'srgb' color space is supported! ( new ImageData(${Array.from(arguments).join(',')}) )`);\n throw new Error(`Unsupported colorSpace: ${colorSpace}`);\n }\n // We need to calculate the height based on the array data and width\n if (this.height === undefined) {\n this.height = rgbaArray.length / this.width / 4;\n }\n if (rgbaArray) {\n if (this.width * this.height * 4 !== rgbaArray.length) {\n // TODO: this should be a \"DOMException\"\n throw new Error(`The array dimensions do not match the supplied width or height`);\n }\n this.data = new Uint8ClampedArray(rgbaArray);\n }\n else {\n this.data = new Uint8ClampedArray(this.width * this.height * 4);\n }\n }\n}\n;\n// Export onto the global scope\nif (globalThis && typeof globalThis.ImageData !== \"object\") {\n // @ts-ignore\n globalThis.ImageData = ImageData;\n}\n","// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d\nimport { CANVAS_DATA } from \"./HTMLCanvasElement.js\";\nimport { ImageData } from \"./ImageData.js\";\nconst FILL_STYLE = Symbol(\"fill-style\");\nexport class CanvasRenderingContext2D {\n get fillStyle() {\n return this[FILL_STYLE];\n }\n set fillStyle(newStyle) {\n console.log(`${this}→fillStyle = ${newStyle}`);\n this[FILL_STYLE] = newStyle;\n }\n // CanvasRect\n clearRect(x, y, w, h) {\n throw new Error(\"Not implemented\");\n }\n fillRect(x, y, w, h) {\n const { r, g, b, a } = this.fillStyleRGBA;\n const alpha = a * 255 | 0;\n const data = this.canvas[CANVAS_DATA];\n // Optimization: full-canvas fill\n if (x === 0 && y === 0 && data.length === w * h * 4) {\n for (let i = 0; i < data.length; i += 4) {\n if (i < 100)\n console.log(`→ fill #${i} rgba(${data[i]},${data[i + 1]},${data[i + 2]} @ ${data[i + 3]}) => rgba(${r},${g},${b} @ ${alpha})`);\n data[i + 0] = r;\n data[i + 1] = g;\n data[i + 2] = b;\n data[i + 3] = alpha;\n }\n console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) whole canvas with ${r},${g},${b} @ ${alpha}`);\n console.log(data);\n return;\n }\n for (let row = y; row < y + h; ++row) {\n const startIdx = row * 4 + x;\n const endIdx = row * 4 + x + w;\n for (let i = startIdx; i < endIdx; ++i) {\n data[i + 0] = r;\n data[i + 1] = g;\n data[i + 2] = b;\n data[i + 3] = alpha;\n }\n }\n console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) with ${r},${g},${b} @ ${alpha}`);\n }\n strokeRect(x, y, w, h) {\n throw new Error(\"Not implemented\");\n }\n constructor(parentCanvas) {\n this.canvas = parentCanvas;\n // defaults\n this.fillStyle = \"#000\";\n }\n drawImage(image, x1, y1, w1, h1, x2, y2, w2, h2) {\n if (image instanceof globalThis.HTMLCanvasElement) {\n w1 = w1 !== null && w1 !== void 0 ? w1 : image.width;\n h1 = h1 !== null && h1 !== void 0 ? h1 : image.height;\n if (w1 !== w2 || h1 !== h2) {\n console.log(`${this} Not implemented: image scaling in drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n return;\n }\n const srcImage = image.getContext(\"2d\").getImageData(x1, y1, w1, h1);\n const srcPixels = srcImage.data;\n const dstPixels = this.canvas[CANVAS_DATA];\n const rows = h1;\n const cols = w1;\n for (let row = 0; row < rows; ++row) {\n for (let col = 0; col < cols; ++col) {\n // source pixel\n const si = ((y1 + row) * srcImage.width + x1 + col) * 4;\n const sr = srcPixels[si];\n const sg = srcPixels[si + 1];\n const sb = srcPixels[si + 2];\n const sa = srcPixels[si + 3];\n // destination pixel\n const di = ((y2 + row) * srcImage.width + x2 + col) * 4;\n const dr = dstPixels[di];\n const dg = dstPixels[di + 1];\n const db = dstPixels[di + 2];\n const da = dstPixels[di + 3];\n // blend pixels using premultiplied alpha and the default 'source-over' composition\n // https://drafts.fxtf.org/compositing/#porterduffcompositingoperators_srcover\n const dstcontrib = (1 - sa / 255);\n dstPixels[di + 0] = sr * (sa / 255) + dr * (da / 255) * dstcontrib | 0;\n dstPixels[di + 1] = sg * (sa / 255) + dg * (da / 255) * dstcontrib | 0;\n dstPixels[di + 2] = sb * (sa / 255) + db * (da / 255) * dstcontrib | 0;\n dstPixels[di + 3] = sa + da * dstcontrib | 0;\n if (row === col) {\n console.log(`→ [${row},${col}]: imgdata#${si} rgba(${sr},${sg},${sb} @ ${sa}) + canvas#${di} rgba(${dr},${dg},${db} @ ${da}) => rgba(${dstPixels[di]},${dstPixels[di + 1]},${dstPixels[di + 2]} @ ${dstPixels[di + 3]})`);\n }\n }\n }\n console.log(`${this}→drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n return;\n }\n //let dx,dy,dw,dh;\n //let sx,sy,sw,sh;\n console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n }\n createImageData(widthOrImagedata, height, settings) {\n if (widthOrImagedata instanceof ImageData) {\n return new ImageData(widthOrImagedata.data, widthOrImagedata.width, widthOrImagedata.height);\n }\n return new ImageData(widthOrImagedata, height, settings);\n }\n getImageData(sx, sy, sw, sh, settings) {\n if (sx === 0 && sy === 0 && sw === this.canvas.width && sh === this.canvas.height && !settings) {\n console.log(`${this}→getImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);\n return new ImageData(this.canvas[CANVAS_DATA], this.canvas.width, this.canvas.height);\n }\n console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(', ')} )`);\n const id = new ImageData(sw, sh, settings);\n return id;\n }\n putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) {\n let premultWarnLow, premultWarnZero;\n const canvas = this.canvas[CANVAS_DATA];\n if (dirtyX === undefined) {\n if (dx === 0 && dy === 0 && imagedata.width === this.canvas.width && imagedata.height === this.canvas.height) {\n console.log(`${this}→putImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);\n for (let col = 0; col < imagedata.height; ++col) {\n for (let row = 0; row < imagedata.width; ++row) {\n const idx = (col * imagedata.width + row) * 4;\n const alpha = imagedata.data[idx + 3], r = imagedata.data[idx + 0], g = imagedata.data[idx + 1], b = imagedata.data[idx + 2];\n // Transparent pixels that are not fully black/white have browser inconsistencies\n // Context for these warnings:\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData#data_loss_due_to_browser_optimization\n if (alpha === 0 && (r | g | b) !== 0 && (r & g & b) !== 255) {\n premultWarnZero = true;\n }\n else if (alpha < 255 && (r | g | b) !== 0 && (r & g & b) !== 255) {\n premultWarnLow = true;\n }\n canvas[idx + 0] = r;\n canvas[idx + 1] = g;\n canvas[idx + 2] = b;\n canvas[idx + 3] = alpha; //a\n }\n }\n if (premultWarnLow) {\n console.log(`${this} Compat warning: image contained colored non-opaque pixels (alpha<255), the result be inconsistent with observed browser behavior.`);\n }\n if (premultWarnZero) {\n console.log(`${this} Compat warning: image contained fully transparent colored pixels (alpha=0), the result of this operation may differ from browser behavior.`);\n }\n return;\n }\n console.log(`${this} Not implemented: non-whole-canvas putImageData( ${Array.from(arguments).join(', ')} )`);\n return;\n }\n console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(', ')} )`);\n }\n setTransform(matrixOrA, b, c, d, e, f) {\n console.log(`${this} Not implemented: context2d.setTransform( ${Array.from(arguments).join(', ')} )`);\n }\n // Stringifies the context object with its canvas & unique ID to ease debugging\n get [Symbol.toStringTag]() {\n return `${this.canvas[Symbol.toStringTag]}::context2d`;\n }\n // https://developer.mozilla.org/en-US/docs/Web/CSS/color_value\n get fillStyleRGBA() {\n let c;\n let r = 0, g = 0, b = 0, a = 1;\n // Named color ('white', 'black', etc)\n if (CSS_NAMED_COLORS.has(this.fillStyle)) {\n c = HTMLColorToRGBA(CSS_NAMED_COLORS.get(this.fillStyle));\n if (c)\n return c;\n }\n // HTML color (#aaa, #bbccdd, #rrggbbaa)\n c = HTMLColorToRGBA(this.fillStyle);\n if (c)\n return c;\n // rgb() color definition\n c = HTMLColorToRGBA(this.fillStyle);\n if (c)\n return c;\n return { r, g, b, a };\n }\n}\nexport class ImageBitmapRenderingContext {\n}\n// TODO: these are only the basic colors\nconst CSS_NAMED_COLORS = new Map([\n [\"black\", \"#000000\"],\n [\"silver\", \"#c0c0c0\"],\n [\"gray\", \"#808080\"],\n [\"white\", \"#ffffff\"],\n [\"maroon\", \"#800000\"],\n [\"red\", \"#ff0000\"],\n [\"purple\", \"#800080\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"green\", \"#008000\"],\n [\"lime\", \"#00ff00\"],\n [\"olive\", \"#808000\"],\n [\"yellow\", \"#ffff00\"],\n [\"navy\", \"#000080\"],\n [\"blue\", \"#0000ff\"],\n [\"teal\", \"#008080\"],\n [\"aqua\", \"#00ffff\"],\n]);\nfunction HTMLColorToRGBA(color) {\n var _a, _b;\n let r = 0, g = 0, b = 0, a = 0;\n let matched, wasMatched;\n // Match longform\n matched = (_a = color.match(/^#(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/)) === null || _a === void 0 ? void 0 : _a.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n r = parseInt(matched.r, 16);\n g = parseInt(matched.g, 16);\n b = parseInt(matched.b, 16);\n a = matched.a ? parseInt(matched.a, 10) : 1.0;\n wasMatched = true;\n }\n // Match short form\n matched = (_b = color.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/)) === null || _b === void 0 ? void 0 : _b.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n r = parseInt(matched.r, 16);\n g = parseInt(matched.g, 16);\n b = parseInt(matched.b, 16);\n a = matched.a ? parseInt(matched.a, 10) : 1.0;\n wasMatched = true;\n }\n if (!wasMatched) {\n console.log(`Not a HTML color string: ${color}`);\n return null;\n }\n return { r, g, b, a };\n}\nfunction CSSRGBColorToRGBA(color) {\n var _a;\n let matched = (_a = color.match(/rgb\\((?\\d{1,3})\\s+(?\\d{1,3})\\s+(?\\d{1,3})(\\s*\\/\\s*(?\\d{1,3})%)?/)) === null || _a === void 0 ? void 0 : _a.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n let r = parseInt(matched.r, 10);\n let g = parseInt(matched.g, 10);\n let b = parseInt(matched.b, 10);\n let a = matched.a ? parseInt(matched.a, 10) / 100 : 1.0;\n return { r, g, b, a };\n }\n console.log(`Not a CSS color definition': ${color}`);\n return null;\n}\n","// https://html.spec.whatwg.org/multipage/canvas.html#the-canvas-element\nimport Node, { EXTEND_NODE } from '../node.js';\nimport { CanvasRenderingContext2D,\n// ImageBitmaps currently unsupported\n// https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap\n//ImageBitmapRenderingContext, ImageBitmapRenderingContextSettings,\n } from './RenderingContext.js';\n// Implementation\nconst WIDTH = Symbol(\"canvas-width\");\nconst HEIGHT = Symbol(\"canvas-height\");\nconst CONTEXT = Symbol(\"canvas-context\");\nconst EID = Symbol(\"element-id\");\n// Access canvas data (for the Context or testing/debugging)\nexport const CANVAS_DATA = Symbol(\"accesscanvas-data\");\nexport class HTMLCanvasElement extends Node {\n get width() {\n console.debug(`${this}→width? (${this[WIDTH]})`);\n return this[WIDTH];\n }\n get height() {\n console.debug(`${this}→height? (${this[HEIGHT]})`);\n return this[HEIGHT];\n }\n set width(width) {\n console.debug(`${this}→width = ${width}`);\n this[WIDTH] = width;\n this.resize(this[WIDTH], this[HEIGHT]);\n }\n set height(height) {\n console.debug(`${this}→height = ${height}`);\n this[HEIGHT] = height;\n this.resize(this[WIDTH], this[HEIGHT]);\n }\n //getContext(contextId: \"bitmaprenderer\", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null;\n //getContext(contextId: string, options?: any): RenderingContext | null;\n getContext(contextId, _options) {\n if (contextId != \"2d\")\n throw new Error(`Not implemented: ${contextId}`);\n this[CONTEXT] = this[CONTEXT] || new CanvasRenderingContext2D(this);\n if (!(this[CONTEXT] instanceof CanvasRenderingContext2D))\n throw new Error(`Context invalid`);\n return this[CONTEXT];\n }\n toDataURL(_type = \"image/png\", _quality) {\n throw new Error(\"Not implemented\");\n }\n toBlob(_callback, _type = \"image/png\", _quality) {\n throw new Error(\"Not implemented\");\n }\n get clientWidth() {\n return this.width;\n }\n get clientHeight() {\n return this.height;\n }\n constructor() {\n super(EXTEND_NODE);\n // Assign a new pseudo-random element ID\n this[EID] = (Math.random() * (Math.pow(36, 6)) | 0).toString(36);\n // The default size of a new canvas in most implementations\n this.resize(300, 150);\n }\n // Stringifies the object including its unique element tag\n get [Symbol.toStringTag]() {\n return `HTMLCanvasElement#${this[EID]}`;\n }\n resize(width, height) {\n this[WIDTH] = width;\n this[HEIGHT] = height;\n this[CANVAS_DATA] = new Uint8ClampedArray(this[WIDTH] * this[HEIGHT] * 4);\n console.debug(`${this}→reset, new size: ${this[WIDTH]}x${this[HEIGHT]} (${this[CANVAS_DATA].length}b)`);\n }\n}\n;\n// Export onto the global scope\nif (globalThis && typeof globalThis.HTMLCanvasElement !== \"object\") {\n // @ts-ignore\n globalThis.HTMLCanvasElement = HTMLCanvasElement;\n}\n","import Node, {createNode} from \"./node.js\";\nimport {HTMLCanvasElement} from \"./js-canvas/HTMLCanvasElement.js\";\nimport {NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME} from \"./utils.js\";\n\nexport function createCanvasNode( nodeType )\n{\n\tconst node = new HTMLCanvasElement()\n\n\tnode[NODE_TYPE] = nodeType;\n\tnode.nodeValue = null;\n\tnode[PARENT_NODE] = null;\n\tnode[OWNER] = null;\n\t\n\tswitch ( nodeType )\n\t{\n\t\tcase Node.ELEMENT_NODE:\n\t\t\tnode[TAG_NAME] = null;\n\t\t\tnode.attributes = {};\n\t\t\t// fallthrough\n\t\t\t\n\t\tcase Node.DOCUMENT_NODE:\n\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\tnode.childNodes = [];\n\t}\n\t\n\treturn node;\n}\n","import {globalizeRegExp} from \"./utils.js\";\n\nconst decodingRE = /&(#\\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,\n\t\n\t// From 'SyntaxCharacter' in section 21.2.1 (Patterns) of the ECMAScript 6.0 spec.\n\tregExpEscapeRE = /[\\^$\\\\.*+?()[\\]{}|]/g,\n\t\n\t_defaultEntities = processEntities( {\n\t\t\"amp\": \"&\",\n\t\t\"apos\": \"'\",\n\t\t\"copy\": 169,\n\t\t\"gt\": \">\",\n\t\t\"lt\": \"<\",\n\t\t\"nbsp\": 160,\n\t\t\"quot\": '\"'\n\t} );\n\nlet defaultEntities = _defaultEntities;\n\nexport default class EntityEncoder\n{\n\tconstructor( entities )\n\t{\n\t\tthis.entities = entities || \"default\";\n\t}\n\t\n\tencode( string, what )\n\t{\n\t\tif ( !this.encodingReplacements ) return string;\n\t\treturn string.replace( what instanceof RegExp ? globalizeRegExp( what ) : this.encodingRE, chr => this.encodingReplacements[chr] || chr );\n\t}\n\t\n\tdecode( string )\n\t{\n\t\tif ( !this.decodingReplacements ) return string;\n\t\treturn string.replace( decodingRE, ( _, m ) =>\n\t\t{\n\t\t\tif ( m[0] === \"#\" )\n\t\t\t{\n\t\t\t\tif ( m[1] === \"x\" || m[1] === \"X\" )\n\t\t\t\t\tm = parseInt( m.slice( 2 ), 16 ) | 0;\n\t\t\t\telse m = m.slice( 1 ) | 0;\n\t\t\t\treturn String.fromCodePoint( m );\n\t\t\t}\n\t\t\treturn this.decodingReplacements[m] || this.decodingReplacements[m.toLowerCase()] || _;\n\t\t} );\n\t}\n\t\n\tset entities( entities )\n\t{\n\t\tif ( entities === \"default\" )\n\t\t\tentities = defaultEntities;\n\t\telse if ( !entities || !(entities.encodingRE instanceof RegExp) )\n\t\t\tentities = processEntities( entities );\n\t\t\n\t\tthis.encodingRE = entities.encodingRE;\n\t\tthis.encodingReplacements = entities.encodingReplacements;\n\t\tthis.decodingReplacements = entities.decodingReplacements;\n\t}\n\t\n\tstatic set defaultEntities( entities )\n\t{\n\t\tif ( entities && typeof entities === \"object\" )\n\t\t\tdefaultEntities = processEntities( Object.assign( {}, entities ) );\n\t\telse defaultEntities = _defaultEntities;\n\t}\n}\n\nfunction processEntities( entities )\n{\n\tvar result = {\n\t\t\tencodingRE: null,\n\t\t\tencodingReplacements: null,\n\t\t\tdecodingReplacements: null\n\t\t};\n\t\n\tif ( entities && typeof entities === \"object\" )\n\t{\n\t\tconst escapes = {},\n\t\t\tunescapes = {},\n\t\t\tentityList = [];\n\t\t\n\t\tfor ( let k in entities )\n\t\t\tif ( entities.hasOwnProperty( k ) )\n\t\t\t{\n\t\t\t\tlet entity = entities[k];\n\t\t\t\t\n\t\t\t\tif ( Number.isFinite( entity ) )\n\t\t\t\t\tentity = String.fromCodePoint( entity );\n\t\t\t\telse if ( typeof entity !== \"string\" || entity === \"\" )\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\tentityList.push( entity.replace( regExpEscapeRE, \"\\\\$&\" ) );\n\t\t\t\tif ( !escapes.hasOwnProperty( entity ) || (k.length + 2) < escapes[entity].length )\n\t\t\t\t\tescapes[entity] = \"&\"+ k +\";\";\n\t\t\t\tunescapes[k] = entity;\n\t\t\t}\n\t\t\n\t\tif ( entityList.length > 0 )\n\t\t{\n\t\t\tresult.encodingRE = new RegExp( entityList.join( \"|\" ), \"g\" );\n\t\t\tresult.encodingReplacements = escapes;\n\t\t\tresult.decodingReplacements = unescapes;\n\t\t}\n\t}\n\t\n\tif ( !result.encodingRE )\n\t\tresult.encodingRE = new RegExp( \"(?:)\", \"g\" );\n\t\n\treturn result;\n}","import \"./polyfills.js\";\n\nimport Parser from \"./html-parser.js\";\nimport Node, {createNode} from \"./node.js\";\nimport {createCanvasNode} from \"./canvas-node.js\";\nimport {serializeNode} from \"./serializer.js\";\nimport EntityEncoder from \"./entity-encoder.js\";\nimport {DOCTYPE, HEAD, BODY, DOCUMENT_ELEMENT, NODE_TYPE, TAG_NAME, PARSER_OPTIONS,\n\tsetupDocument, detachNodes, setNodeParent} from \"./utils.js\";\n\n/* @START_UNIT_TESTS */\nimport {parseSelector} from \"./selector-parser.js\";\n/* @END_UNIT_TESTS */\n\nconst ENTITY_ENCODER = Symbol( \"entityEncoder\" );\n\nexport default class DOM extends Node\n{\n\tconstructor( html, options )\n\t{\n\t\tconst node = createNode( Node.DOCUMENT_FRAGMENT_NODE, DOM );\n\t\tnode[PARSER_OPTIONS] = Parser.setupOptions( options );\n\t\tnode[ENTITY_ENCODER] = new EntityEncoder( node[PARSER_OPTIONS].entities );\n\t\tnode.innerHTML = html;\n\t\treturn node;\n\t}\n\t\n\tget documentElement() {return this[DOCUMENT_ELEMENT] || null}\n\t\n\tget innerHTML()\n\t{\n\t\tlet html = \"\";\n\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\thtml += serializeNode( this.childNodes[i] );\n\t\treturn html;\n\t}\n\tset innerHTML( html )\n\t{\n\t\tthis[NODE_TYPE] = Node.DOCUMENT_FRAGMENT_NODE;\n\t\tif ( html && typeof html === \"string\" )\n\t\t{\n\t\t\tconst rootNode = new Parser( html, this[PARSER_OPTIONS], this[ENTITY_ENCODER] ).parseHTML();\n\t\t\t\n\t\t\tdetachNodes( this.childNodes );\n\t\t\t\n\t\t\tif ( rootNode.doctype )\n\t\t\t\tthis[DOCTYPE] = rootNode.doctype;\n\t\t\telse this[DOCTYPE] = null;\n\t\t\t\n\t\t\tthis.childNodes = rootNode.childNodes;\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\tsetNodeParent( this.childNodes[i], this );\n\t\t\t\n\t\t\tsetupDocument( this );\n\t\t}\n\t\telse this.childNodes.length = 0;\n\t}\n\t\n\tget outerHTML() {return null}\n\tset outerHTML( v ) {}\n\t\n\tget doctype()\n\t{\n\t\treturn this[DOCTYPE] || null;\n\t}\n\tset doctype( val )\n\t{\n\t\tif ( val )\n\t\t{\n\t\t\tlet doctype = this[DOCTYPE];\n\t\t\tif ( val instanceof Node )\n\t\t\t{\n\t\t\t\tif ( val.nodeType === Node.DOCUMENT_TYPE_NODE && val !== doctype )\n\t\t\t\t{\n\t\t\t\t\tthis[DOCTYPE] = val;\n\t\t\t\t\tif ( doctype ) this.replaceChild( val, doctype );\n\t\t\t\t\telse this.insertBefore( val, this.firstChild );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( typeof val === \"object\" )\n\t\t\t{\n\t\t\t\tif ( !doctype )\n\t\t\t\t\tthis[DOCTYPE] = this.insertBefore( this.createDocumentType( val.name, val.publicId, val.systemId ), this.firstChild );\n\t\t\t\telse setupDocumentType( doctype, val.name, val.publicId, val.systemId );\n\t\t\t}\n\t\t}\n\t\telse if ( val === null && this[DOCTYPE] )\n\t\t{\n\t\t\tthis.removeChild( this[DOCTYPE] );\n\t\t\tthis[DOCTYPE] = null;\n\t\t}\n\t}\n\t\n\tget head()\n\t{\n\t\treturn this[HEAD] || null;\n\t}\n\t\n\tget title()\n\t{\n\t\tconst head = this.head;\n\t\tif ( head )\n\t\t{\n\t\t\tconst title = head.getElementsByTagName( \"title\" );\n\t\t\tif ( title.length > 0 )\n\t\t\t\treturn title[0].textContent;\n\t\t}\n\t\treturn \"\";\n\t}\n\tset title( val )\n\t{\n\t\tconst head = this.head;\n\t\tif ( head )\n\t\t{\n\t\t\tlet title = head.getElementsByTagName( \"title\" );\n\t\t\tif ( title.length <= 0 )\n\t\t\t\ttitle = head.appendChild( this.createElement( \"title\" ) );\n\t\t\telse title = title[0];\n\t\t\ttitle.textContent = val;\n\t\t}\n\t}\n\t\n\tget body()\n\t{\n\t\treturn this[BODY] || null;\n\t}\n\tset body( val )\n\t{\n\t\tif ( val instanceof Node && val.nodeType === Node.ELEMENT_NODE &&\n\t\t\t(val.tagName === \"BODY\" || val.tagName === \"FRAMESET\") &&\n\t\t\tval !== this[BODY] && this[DOCUMENT_ELEMENT] )\n\t\t{\n\t\t\tif ( this[BODY] ) this[BODY].parentNode.replaceChild( val, this[BODY] );\n\t\t\telse this[DOCUMENT_ELEMENT].appendChild( val );\n\t\t}\n\t}\n\n\tget entityEncoder()\n\t{\n\t\treturn this[ENTITY_ENCODER];\n\t}\n\n\tcreateElement( tagName )\n\t{\n\t\tif ( tagName && typeof tagName === \"string\" )\n\t\t{\n\t\t\tconst node = createNodeForTagName( tagName );\n\t\t\tnode[TAG_NAME] = tagName.toUpperCase();\n\t\t\treturn node;\n\t\t}\n\t}\n\n\tcreateTextNode( text )\n\t{\n\t\treturn createTextBasedNode( Node.TEXT_NODE, text );\n\t}\n\n\tcreateComment( data )\n\t{\n\t\treturn createTextBasedNode( Node.COMMENT_NODE, data );\n\t}\n\n\tcreateCDATASection( data )\n\t{\n\t\treturn createTextBasedNode( Node.CDATA_SECTION_NODE, data, \"]]>\" );\n\t}\n\n\tcreateProcessingInstruction( target, data )\n\t{\n\tNewNode:\n\t\tif ( target && typeof target === \"string\" )\n\t\t{\n\t\t\tif ( Parser.isNameCharStart( target[0] ) )\n\t\t\t\tfor ( let i = 1; i < target.length; i++ )\n\t\t\t\t{\n\t\t\t\t\tif ( !Parser.isNameChar( target[i] ) )\n\t\t\t\t\t\tbreak NewNode;\n\t\t\t\t}\n\t\t\telse break NewNode;\n\t\t\t\n\t\t\tconst node = createTextBasedNode( Node.PROCESSING_INSTRUCTION_NODE, data, \"?>\" );\n\t\t\tnode.target = target;\n\t\t\treturn node;\n\t\t}\n\t\tthrow new Error( \"Invalid target name \"+ JSON.stringify( target ) +\".\" );\n\t}\n\n\tcreateDocumentType( name, publicId, systemId )\n\t{\n\t\treturn setupDocumentType( createNode( Node.DOCUMENT_TYPE_NODE ), name, publicId, systemId );\n\t}\n\n\tgetElementsByName( name )\n\t{\n\t\tconst nodeList = [];\n\t\tif ( name && typeof name === \"string\" )\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( node.attributes && node.attributes.name === name )\n\t\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\treturn nodeList;\n\t}\n}\n\nfunction createTextBasedNode( type, text, disallowed = false )\n{\n\tconst node = createNode( type );\n\tnode.nodeValue = \"\";\n\tif ( text && typeof text === \"string\" )\n\t{\n\t\tif ( disallowed && typeof disallowed === \"string\" && text.indexOf( disallowed ) !== -1 )\n\t\t\tthrow new Error( \"The data provided ('\"+ text +\"') contains '\"+ disallowed +\"'.\" );\n\t\tnode.nodeValue += text;\n\t}\n\treturn node;\n}\n\nfunction setupDocumentType( doctype, name, publicId, systemId )\n{\n\tif ( name && typeof name === \"string\" )\n\t{\n\t\tdoctype.name = name.toLowerCase();\n\t\t\n\t\tif ( publicId && typeof publicId === \"string\" )\n\t\t\tdoctype.publicId = publicId;\n\t\telse doctype.publicId = \"\";\n\t\t\n\t\tif ( systemId && typeof systemId === \"string\" )\n\t\t\tdoctype.systemId = systemId;\n\t\telse doctype.systemId = \"\";\n\t}\n\telse doctype.name = doctype.publicId = doctype.systemId = \"\";\n\t\n\treturn doctype;\n}\n\nfunction createNodeForTagName( tagName )\n{\n\tswitch ( tagName.toLowerCase() )\n\t{\n\t\tcase 'canvas':\n\t\t\treturn createCanvasNode( Node.ELEMENT_NODE );\n\t\tdefault:\n\t\t\treturn createNode( Node.ELEMENT_NODE );\n\t}\n}\n\n/* @START_UNIT_TESTS */\nDOM.parseSelector = parseSelector;\n/* @END_UNIT_TESTS */\n\nDOM.Node = Node;\nDOM.EntityEncoder = EntityEncoder;\n"],"names":["ELEMENT"],"mappings":";;AAAA,MAAM,OAAO,GAAG,EAAE;AAClB,CAAC,WAAW,GAAG,EAAE;AACjB,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE;AACnE,CAAC,GAAG,GAAG,IAAI,CAAC;AAGZ;AACO,MAAM,KAAK;AAClB;AACA,CAAC,WAAW,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d464..d856083 100644 --- a/lib/fauxdom-with-canvas.js +++ b/lib/fauxdom-with-canvas.js @@ -1,3 +1,3 @@ var DOM=function(){"use strict";const e=Object.prototype.hasOwnProperty,t=Array.prototype.slice;window.Symbol||(window.Symbol=function(e){return"@@"+e+"_"+Math.floor(4294967295*Math.random()).toString(16)}),Object.assign||(Object.assign=function(t){if(null==t)return t;t=Object(t);for(let s=1;s1114111?t.push(65533):e<65535?t.push(e):(e-=65536,t.push(e>>10|55296,1023&e|56320));return String.fromCharCode.apply(null,t)}),Function.prototype.bind||(Function.prototype.bind=function(e){var i=this,s=t.call(arguments,1);if("function"!=typeof i)throw new TypeError("Bind must be called on a function");return function(){return i.apply(e,s.concat(t.call(arguments)))}});const i={},s={},r=Object.prototype.hasOwnProperty.bind(s),n=null;class o{constructor(e){if(this.index=0,this.str=e,this.scanChar=this.str[this.index],!r(" ")){for(let e=0;e<=32;e++)s[String.fromCharCode(e)]=null;for(let e=128;e<=159;e++)s[String.fromCharCode(e)]=null}}isWhiteSpace(e){return e!==n&&r(e)}goToString(e,t){if(!1!==t)this.index=this.str.indexOf(e,this.index);else{i[e]||(i[e]=new RegExp(e,"ig")),i[e].lastIndex=this.index;const t=i[e].exec(this.str);this.index=t?t.index:-1}this.index>-1?this.scanChar=this.str[this.index]:(this.index=this.str.length,this.scanChar=n)}goToIndex(e){this.scanChar=this.str[this.index=e]}advance(e){return this.index+=e,this.index>this.str.length?(this.index=this.str.length,this.scanChar=n):this.scanChar=this.str[this.index]}match(e,t){var i=this.str.substr(this.index,e.length);return!1===t&&(e=e.toLowerCase(),i=i.toLowerCase()),i===e&&(this.index+=e.length-1,this.getNextChar(),!0)}peek(){return this.str[this.index+1]}getChar(){return this.scanChar}getNextChar(){return this.index+1e.callback===t&&e.capturing===r?i:void 0)).reverse().forEach((e=>{void 0!==e&&s.splice(e,1)}))}dispatchEvent(e){let t=!0;if(!this[a])return t;const i=this[a].get(e.type)??[];return i?.forEach((({callback:i})=>{i(e),e.defaultPrevented&&(t=!1)})),t}}const h=Symbol("doctype"),c=Symbol("head"),d=Symbol("body"),u=Symbol("documentElement"),p=Symbol("nodeType"),f=Symbol("parentNode"),N=Symbol("ownerDocument"),g=Symbol("tagName"),E=Symbol("parserOptions"),T=/\s+/g,m=/[gimsuy]*$/,O={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11},y={AREA:!0,BASE:!0,BR:!0,COL:!0,COMMAND:!0,EMBED:!0,HR:!0,IMG:!0,INPUT:!0,KEYGEN:!0,LINK:!0,META:!0,PARAM:!0,SOURCE:!0,TRACK:!0,WBR:!0};function x(e){var t=-1,i=-1,s="HTML";e[h]&&e[E].allowCustomRootElement&&(s=e[h].name.toUpperCase());for(let r=0,n=e.childNodes.length;r0)for(let t=0;t{e[N]=i}),null),e[f]=t,e[N]=i}function w(e){if(!e.global){let t=e.flags;void 0===t&&(t=e.toString().match(m)[0]),e=new RegExp(e.source,t+"g")}return e}const S=Symbol("element"),_=Symbol("length"),A=/^\S+$/,I=Array.prototype.indexOf,M=Array.prototype.join,v=Array.prototype.splice;class R{constructor(){throw new Error("Cannot directly instantiate DOMTokenList.")}get length(){return this[_]}set length(e){}get value(){return M.call(this," ")}set value(e){if(this[_]>0)for(let t in this)this.hasOwnProperty(t)&&isFinite(t)&&delete this[t];this[_]=0,"string"==typeof e?this.add.apply(this,e.split(T)):delete this[S].attributes.class}add(){for(let e=0;e=0&&e=0&&this.supports(t))&&(-1===I.call(this,t)?this[i]=t:(v.call(this,i,1),this[_]--),this[S].attributes.class=this.value,!0)}supports(e){return!(!e||"string"!=typeof e)&&e.match(A)}}const L=Symbol("element");function U(e){return e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}function P(e){return"string"==typeof e&&(!!e.match(/^\-?[a-z_-]*[a-z]$/)||(!!e.match(/^\-\-[A-Za-z_-]*[A-Za-z0-9]$/)||!!e.match(/^[a-zA-Z]+$/)))}function k(e=""){return new Map(e.split(/\s*;\s*/g).filter((e=>e.length)).map((e=>e.trim().match(/^([a-z-]+)\s*:\s*(.*)$/).slice(1))))}function $(e){return Array.from(e?.entries()??[]).map((e=>e.join(": "))).join("; ")}function j(e){return new Proxy({[L]:e},{get(t,i){if(i===L)return e;if(!P(i))return;const s=U(i);return k(e.attributes.style).get(s)},set(t,i,s){if(!P(i))return!0;const r=U(i),n=k(e.attributes.style);return e.attributes.style=$(n.set(r,s)),!0},deleteProperty(t,i){if(!P(i))return;const s=U(i),r=k(e.attributes.style);e.attributes.style=$(r.delete(s))}})}const W=/\r\n|\r|\f/g,G=/\(\s*(even|odd|(?:(?:([+-]?\d*)n)\s*(?:([+-])\s*(\d+))?|([+-]?\d+)))\s*/g,B={Selectors:0,Identifier:1,Iterator:2,IteratorOf:3},H={is:B.Selectors,not:B.Selectors,where:B.Selectors,has:B.Selectors,lang:B.Identifier,dir:B.Identifier,"nth-child":B.IteratorOf,"nth-last-child":B.IteratorOf,"nth-of-type":B.Iterator,"nth-last-of-type":B.Iterator,"nth-col":B.Iterator,"nth-last-col":B.Iterator};function F(e){return Y(new o(e.replace(W,"\n")))}function Y(e,t=n,i=!1){for(var s=e.skipWhiteSpace(),r={},o=[],a=[o],l=[a];s!==n&&s!==t;){switch(s){case"*":if(o.length>0)throw V("Universal selectors must come before all other simple selectors.",e);r.type="universal",o.push(r),r={};break;case"#":case".":{e.getNextChar();const t=z(e);if(!t)throw V("Expected an identifier.",e);r.type="#"===s?"id":"class",r.name=t,o.push(r),r={};break}case"[":{e.getNextAfterWhiteSpace();const t=z(e);if(!t)throw V("Expected an identifier.",e);if(r.type="attr",r.name=t,r.comparison="=",r.value=!0,r.ignoreCase=!1,"]"!==(s=e.getNextAfterWhiteSpace())){switch(s){case"=":break;case"~":case"|":case"^":case"$":case"*":if("="!==e.peek())throw V("Expected '='.",e,1);r.comparison=s+r.comparison,e.getNextChar();break;default:throw V("Unexpected character '"+(s===n?"END_OF_INPUT":s)+"'.",e)}if("'"===(s=e.getNextAfterWhiteSpace())||'"'===s){const t=s;for(r.value="",s=e.getNextChar();s!==n&&s!==t&&"\n"!==s;)"\\"===s?(r.value+=X(e),s=e.getChar()):(r.value+=s,s=e.getNextChar())}else{const t=z(e);if(!t)throw V("Expected an identifier.",e);r.value=t}if("]"!==e.getNextAfterWhiteSpace()){const t=z(e);if("i"===t||"I"===t)r.ignoreCase=!0;else if("s"===t||"S"===t)r.ignoreCase=!1;else if(t)throw V("Unexpected identifier '"+t+"'.",e,1-t.length);if("]"!==e.getNextAfterWhiteSpace())throw V("Expected ']'.",e,-1+t.length)}}o.push(r),r={};break}case":":if(e.getNextChar(),e.match(":")){const t=z(e);if(!t)throw V("Expected a pseudo-element name.",e);r.type="pseudo-element",r.name=t}else{const t=z(e);if(!t)throw V("Expected a pseudo-class name.",e);r.type="pseudo-class",r.name=t;const i=H[t];if(null!=i){if(r.type="pseudo-fn","("!==e.getNextChar())throw V("Expected '('.",e);switch(i){case B.IteratorOf:case B.Iterator:let t,s=0,n=0;G.lastIndex=e.index;const o=G.exec(e.str);if(!o)throw V("Invalid parameter.",e,1);if(e.advance(o[0].length),i===B.IteratorOf){e.skipWhiteSpace();const i=e.index;if("of"===z(e).toLowerCase()){const i=e.getNextChar();if(")"!==i&&!e.isWhiteSpace(i))throw V("Expected whitespace.",e);if(t=Y(e,")"),!(t instanceof Array)||0===t.length)throw V("Expected at least one selector.",e)}else e.goToIndex(i)}if(")"!==e.skipWhiteSpace())throw V("Expected ')'.",e);"even"===o[1]||"odd"===o[1]?(s=2,"odd"===o[1]&&(n=1)):o[5]?n=parseInt(o[5],10):(s="-"===o[2]?-1:o[2]&&"+"!==o[2]?parseInt(o[2],10):1,o[3]&&(n=parseInt(o[3]+o[4],10))),r.params=[s,n],t&&r.params.push(t);break;case B.Selectors:if(e.getNextChar(),r.params=Y(e,")",!0),0===r.params.length)throw V("Expected at least one selector.",e);break;case B.Identifier:if(!Z(e.getNextAfterWhiteSpace()))throw V("Expected an identifier.",e);r.params=[z(e)],e.getNextChar()}if(")"!==e.skipWhiteSpace())throw V("Expected ')'.",e)}else"before"!==t&&"after"!==t&&"first-line"!==t&&"first-letter"!==t||(r.type="pseudo-element")}o.push(r),r={};break;case"+":case">":case"~":if(0===o.length){if(1===a.length){if(!i)throw V("Absolute selectors cannot start with a combinator.",e);a.unshift([{type:"pseudo-class",name:"scope"}])}else if("string"==typeof a[a.length-2])throw V("Cannot have multiple combinators in a row.",e);a.splice(a.length-1,0,s)}else a.push(s,o=[]);break;case",":if(0===o.length){if(a.length>1){if(a.pop(),"string"==typeof a[a.length-1])throw V("Complex selectors are not allowed to end with a combinator.",e,-1);l.push(a=[o])}}else l.push(a=[o=[]]);e.skipWhiteSpace();break;default:if(e.isWhiteSpace(s))o.length>0&&a.push(o=[]),e.skipWhiteSpace(),e.advance(-1);else{if(!Z(s))throw V("Unexpected character '"+s+"'.",e);if(o.length>0)throw V("Type (tag name) selectors must come before all other simple selectors.",e);r.type="type",r.name=z(e).toUpperCase(),o.push(r),r={}}}s=e.getNextChar()}if(0===o.length&&(1===a.length?(l.pop(),a=l[l.length-1]):a.pop()),a&&"string"==typeof a[a.length-1])throw V("Complex selectors are not allowed to end with a combinator.",e,-1);return l}function V(e,t,i=0){var s=new SyntaxError(e),r=t.index+i;return s.stack="SyntaxError: "+e+"\n\n"+t.str+"\n"+" ".repeat(r)+"^\n at index "+r,s}function z(e){var t="",i=e.getChar();if(Z(i)){do{"\\"===i?(t+=X(e),i=e.getChar()):(t+=i,i=e.getNextChar())}while(i!==n&&(Z(i)||i>="0"&&i<="9"||"-"===i));e.advance(-1)}return t}function X(e){var t=e.getNextChar();if(q(t)){let i="";for(let s=5;s>=0&&q(t);s--)i+=t,t=e.getNextChar();return e.isWhiteSpace(t)&&e.getNextChar(),i=0|parseInt(i,16),0===i||i>=55296&&i<=57343||i>1114111?"�":String.fromCodePoint(i)}return t===n?"�":(e.getNextChar(),t)}function q(e){return e!==n&&(e>="0"&&e<="9"||e>="A"&&e<="F"||e>="a"&&e<="f")}function Z(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"||"_"===e||e>="€"||"\\"===e}const K=0,J=1,Q=2,ee=3,te=4,ie={">":Q,"+":ee,"~":te},se={is:(e,t,i)=>oe(e,t,i),not:(e,t,i)=>!oe(e,t,i),has(e,t,i){var s=!1;for(let r=0;r0&&t.forEach((e=>{if(oe(t,e,i))return s=!0,!1})),s},"nth-child"(e,t,i){const s=t[f],r=s.childNodes,n=new he(i[0],i[1]);for(let o=0;o=0;o--)if(r[o][p]===ge.ELEMENT_NODE&&(!i[2]||oe(s,r[o],i[2]))){const e=n.next();if(r[o]===t)return e}return!1},"nth-of-type"(e,t,i){const s=t[f].childNodes,r=new he(i[0],i[1]),n=t[g];for(let o=0;o=0;o--)if(s[o][g]===n){const e=r.next();if(s[o]===t)return e}}},re={scope:(e,t)=>t===e,enabled(e,t){switch(t[g]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return!t.hasAttribute("disabled")}return!1},disabled(e,t){switch(t[g]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return t.hasAttribute("disabled")}return!1},checked(e,t){if("INPUT"===t[g]){const e=t.getAttribute("type");if("checkbox"===e||"radio"===e)return t.hasAttribute("checked")}else if("OPTION"===t[g])return t.hasAttribute("selected");return!1},required(e,t){switch(t[g]){case"INPUT":case"SELECT":case"TEXTAREA":return t.hasAttribute("required")}return!1},optional(e,t){switch(t[g]){case"INPUT":case"SELECT":case"TEXTAREA":return!t.hasAttribute("required")}return!1},root(e,t){const i=b(e);return!!i&&i.documentElement===t},empty:(e,t)=>0===t.childNodes.length,"first-child"(e,t){const i=t[f].childNodes;for(let s=0;s=0;s--)if(i[s][p]===ge.ELEMENT_NODE)return i[s]===t},"only-child"(e,t){const i=t[f].childNodes;let s,r;for(let n=0,o=i.length-1;o>=0&&(!s||!r);n++,o--)s||i[n][p]!==ge.ELEMENT_NODE||(s=i[n]),r||i[o][p]!==ge.ELEMENT_NODE||(r=i[o]);return s===r&&s===t},"first-of-type"(e,t){const i=t[f].childNodes,s=t[g];for(let r=0;r=0;r--)if(i[r][g]===s)return i[r]===t},"only-of-type"(e,t){const i=t[f].childNodes,s=t[g];let r,n;for(let o=0,a=i.length-1;a>=0&&(!r||!n);o++,a--)r||i[o][g]!==s||(r=i[o]),n||i[a][g]!==s||(n=i[a]);return r===n&&r===t}};function ne(e,t,i){const s=F(t),r=[];return e.forEach((t=>{if(oe(e,t,s)&&(r.push(t),!i))return!1})),i?r:r[0]||null}function oe(e,t,i,s=!1){var r;e:for(let n=0;n=0;s?t++:t--)if(ie.hasOwnProperty(o[t]))a=ie[o[t]];else switch(a){case K:if(!ae(e,r,o[t]))continue e;a=J;break;case J:for(;r=r[f];)if(ae(e,r,o[t]))continue t;continue e;case Q:if(!ae(e,r=r[f],o[t]))continue e;break;case ee:{const i=r[f].childNodes;if(!ae(e,r=i[i.indexOf(r)+(s?1:-1)],o[t]))continue e;break}case te:{const i=r[f].childNodes;for(let n=i.indexOf(r)+(s?1:-1);s?n=0;s?n++:n--)if(ae(e,i[n],o[t])){r=i[n];continue t}continue e}}return!0}}return!1}function ae(e,t,i){if(!t||t[p]!==ge.ELEMENT_NODE)return!1;for(let s=0;s=this.current||this.A>0&&this.current>=this.B)&&(e=(this.current+this.B)%this.A==0),e}}function ce(e){var t=e.tagName,i=b(e),s=i?i.entityEncoder:null,r="";switch(e.nodeType){case O.ELEMENT_NODE:r+="<"+(t=t.toLowerCase());for(let t in e.attributes)if(e.attributes.hasOwnProperty(t)){let n=e.attributes[t];!0===n?n="":s&&i[E]&&(n=de(n,s,i[E])),r+=" "+t,""!==n&&(r+='="'+n+'"')}r+=">";for(let t=0;t");break;case O.TEXT_NODE:s&&i[E]&&(!e.parentNode||"SCRIPT"!==e.parentNode.tagName&&"STYLE"!==e.parentNode.tagName)?r+=de(e.nodeValue,s,i[E]):r+=e.nodeValue;break;case O.CDATA_SECTION_NODE:r+="";break;case O.PROCESSING_INSTRUCTION_NODE:r+="";break;case O.COMMENT_NODE:r+="\x3c!--"+e.nodeValue+"--\x3e";break;case O.DOCUMENT_TYPE_NODE:r+=""}return r}function de(e,t,i){return!1===i.encodeEntities?e:!0!==i.encodeEntities&&i.encodeEntities instanceof RegExp?t.encode(e,i.encodeEntities):t.encode(e)}const ue=Symbol("classList"),pe=Symbol("style"),fe=Symbol("extendNode");function Ne(e,t=ge){const i=Object.create(t.prototype);switch(i[p]=e,i.nodeValue=null,i[f]=null,i[N]=null,e){case ge.ELEMENT_NODE:i[g]=null,i.attributes={};case ge.DOCUMENT_NODE:case ge.DOCUMENT_FRAGMENT_NODE:i.childNodes=[]}return i}class ge extends l{constructor(){if(super(),arguments[0]!==fe)throw new Error("Cannot directly instantiate Node.")}get nodeType(){return this[p]}get nodeName(){switch(this.nodeType){case ge.ELEMENT_NODE:return this.tagName;case ge.TEXT_NODE:return"#text";case ge.CDATA_SECTION_NODE:return"#cdata-section";case ge.PROCESSING_INSTRUCTION_NODE:return this.target;case ge.COMMENT_NODE:return"#comment";case ge.DOCUMENT_NODE:return"#document";case ge.DOCUMENT_TYPE_NODE:return this.name;case ge.DOCUMENT_FRAGMENT_NODE:return"#document-fragment"}}get parentNode(){return this[f]}get ownerDocument(){return this[N]}get tagName(){return this[g]||null}get firstChild(){return this.childNodes&&this.childNodes[0]||null}get lastChild(){return this.childNodes&&this.childNodes[this.childNodes.length-1]||null}get previousSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>0)return e.childNodes[t-1]}return null}get nextSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>-1&&t=ge.TEXT_NODE&&this.nodeType<=ge.COMMENT_NODE&&(this.nodeValue=e)}getRootNode(){let e=this;for(;e.parentNode;)e=e.parentNode;return e}hasAttributes(){if(this.attributes)for(let e in this.attributes)if(this.attributes.hasOwnProperty(e))return!0;return!1}getAttributeNames(){return this.attributes?Object.keys(this.attributes):[]}getAttribute(e){var t;return this.attributes&&e&&"string"==typeof e&&(t=this.attributes[Oe(this,e)]),void 0===t?null:t}setAttribute(e,t){this.attributes&&e&&"string"==typeof e&&("class"===(e=Oe(this,e))?!0!==t?this.className=""+t:(this.classList.value="",this.attributes[e]=!0):this.attributes[e]="string"==typeof t||!0===t?t:""+t)}toggleAttribute(e,t){if(this.attributes&&e&&"string"==typeof e)return e=Oe(this,e),this.attributes.hasOwnProperty(e)?1!==arguments.length&&!1!==t||(delete this.attributes[e],!1):(1===arguments.length||!0===t)&&(this.attributes[e]=!0)}removeAttribute(e){this.attributes&&e&&"string"==typeof e&&("class"===(e=Oe(this,e))&&this[ue]&&(this[ue].value=null),delete this.attributes[e])}hasAttribute(e){return!(!this.attributes||!e||"string"!=typeof e)&&this.attributes.hasOwnProperty(Oe(this,e))}hasChildNodes(){return!!this.childNodes&&this.childNodes.length>0}appendChild(e){return this.insertBefore(e,null)}insertBefore(e,t){if(this.childNodes&&e instanceof ge&&arguments.length>1){let i=-1;if(null==t?i=this.childNodes.length:t instanceof ge&&t.parentNode===this&&(i=this.childNodes.indexOf(t)),-1!==i)return Te(this,e,i)}return null}replaceChild(e,t){return this.childNodes&&t instanceof ge&&e instanceof ge&&t.parentNode===this&&t!==e?(Te(this,e,this.childNodes.indexOf(t),1),t):null}removeChild(e){if(this.childNodes&&e instanceof ge&&e.parentNode===this){const t=this.childNodes.indexOf(e),i=b(this);return i&&e.parentNode===i.documentElement&&Ee.hasOwnProperty(e.tagName)&&(i[Ee[e.tagName]]=null),C(this.childNodes.splice(t,1)),e}return null}cloneNode(e){var t;switch(t=this.nodeType===ge.DOCUMENT_NODE||this.nodeType===ge.DOCUMENT_FRAGMENT_NODE?new Ze(null,this[E]):Ne(this.nodeType),this.nodeType){case ge.ELEMENT_NODE:t[g]=this.tagName,t.attributes=Object.assign(t.attributes,this.attributes);break;case ge.TEXT_NODE:case ge.CDATA_SECTION_NODE:case ge.PROCESSING_INSTRUCTION_NODE:case ge.COMMENT_NODE:t.nodeValue=this.nodeValue;break;case ge.DOCUMENT_NODE:case ge.DOCUMENT_FRAGMENT_NODE:t[p]=this.nodeType,t.entityEncoder.entities=this.entityEncoder;break;case ge.DOCUMENT_TYPE_NODE:t.name=this.name,t.publicId=this.publicId,t.systemId=this.systemId}if(!0===e&&this.childNodes&&this.childNodes.length>0){for(let e=0;e{if(i.id===e)return t=i,!1})),t}getElementsByClassName(e){var t=[];if(e&&"string"==typeof e){const i=e.trim().split(T);(i.length>1||""!==i[0])&&this.forEach((e=>{for(let t=0;t{"*"!==e&&i.tagName!==e||t.push(i)}))),t}closest(e){return e&&"string"==typeof e?function(e,t){const i=F(t);let s=e;for(;null!=s&&s[p]===ge.ELEMENT_NODE;){if(oe(e,s,i))return s;s=s[f]}return null}(this,e):null}matches(e){return!(!e||"string"!=typeof e)&&function(e,t){return oe(e,e,F(t))}(this,e)}querySelector(e){return e&&"string"==typeof e?ne(this,e,!1):null}querySelectorAll(e){return e&&"string"==typeof e?ne(this,e,!0):[]}forEach(e,t=O.ELEMENT_NODE){let i,s,r=this.childNodes,n=this.firstChild,o=[],a=0;for(;n;){if(i=n[f],s=r[a+1],(null===t||n.nodeType===t)&&!1===e(n,i))return;if(n[f]===i&&n.childNodes&&n.childNodes.length>0)o.push(a),r=n.childNodes,n=r[a=0];else{for(s?(a+=1,s!==r[a]&&(a=i.childNodes.indexOf(s))):a=r.length;null==r[a];){if(n=i,i=n[f],!n||n===this)return;r=i.childNodes,a=o.pop()+1}n=r[a]}}}}Object.defineProperties(ge,{ELEMENT_NODE:{value:O.ELEMENT_NODE},TEXT_NODE:{value:O.TEXT_NODE},CDATA_SECTION_NODE:{value:O.CDATA_SECTION_NODE},PROCESSING_INSTRUCTION_NODE:{value:O.PROCESSING_INSTRUCTION_NODE},COMMENT_NODE:{value:O.COMMENT_NODE},DOCUMENT_NODE:{value:O.DOCUMENT_NODE},DOCUMENT_TYPE_NODE:{value:O.DOCUMENT_TYPE_NODE},DOCUMENT_FRAGMENT_NODE:{value:O.DOCUMENT_FRAGMENT_NODE}});const Ee={HEAD:c,BODY:d,FRAMESET:d};function Te(e,t,i,s=0){if(!e||e.nodeType!==ge.ELEMENT_NODE&&e.nodeType!==ge.DOCUMENT_NODE&&e.nodeType!==ge.DOCUMENT_FRAGMENT_NODE||e.nodeType===ge.ELEMENT_NODE&&!0===y[e.tagName])return t;if(t.nodeType<=ge.COMMENT_NODE){if(e.parentNode&&e.parentNode.nodeType===ge.DOCUMENT_NODE&&Ee.hasOwnProperty(t.tagName)){const i=Ee[t.tagName];if(e.parentNode[i]&&0===s)return t;e.parentNode[i]=t}t.parentNode&&t.parentNode.removeChild(t),D(t,e),C(e.childNodes.splice(i,s,t))}else if(t.nodeType!==ge.DOCUMENT_TYPE_NODE||e.nodeType!==ge.DOCUMENT_NODE&&e.nodeType!==ge.DOCUMENT_FRAGMENT_NODE){if(t.nodeType===ge.DOCUMENT_FRAGMENT_NODE)if(e.parentNode&&e.parentNode.nodeType===ge.DOCUMENT_NODE){s>0&&C(e.childNodes.splice(i,s));for(let r=t.childNodes.length-1;r>=0;r--){const n=t.childNodes[r];if(Ee.hasOwnProperty(n.tagName)){const t=Ee[n.tagName];if(e.parentNode[t]&&0===s)continue;e.parentNode[t]=n}D(n,e),e.childNodes.splice(i,0,n),t.childNodes.splice(r,1)}}else if(t!==b(e)){for(let i=0;i":!0,"/":!0,"=":!0},De={P:!0},we={DT:!0,DD:!0},Se={TBODY:!0,THEAD:!0,TFOOT:!0},_e={TD:!0,TH:!0},Ae={BUTTON:!0,DATALIST:!0,OPTGROUP:!0,OPTION:!0,PROGRESS:!0,SELECT:!0,TEXTAREA:!0},Ie={ADDRESS:De,ARTICLE:De,ASIDE:De,BLOCKQUOTE:De,DIV:De,FIELDSET:De,FOOTER:De,H1:De,H2:De,H3:De,H4:De,H5:De,H6:De,HEADER:De,HGROUP:De,HR:De,MAIN:De,NAV:De,P:De,PRE:De,SECTION:De,BODY:{HEAD:!0,TITLE:!0},DL:De,DD:we,DT:we,TABLE:De,TBODY:Se,THEAD:Se,TD:_e,TFOOT:Se,TH:_e,TR:{TR:!0},LI:{LI:!0},OL:De,UL:De,BUTTON:Ae,DATALIST:Ae,FORM:De,INPUT:Ae,OPTGROUP:{OPTGROUP:!0,OPTION:!0},OPTION:{OPTION:!0},OUTPUT:Ae,PROGRESS:Ae,SELECT:Ae,TEXTAREA:Ae};class Me{constructor(e,t,i){this.options=Me.setupOptions(t),this.lexer=new o(e),this.entityEncoder=i}static setupOptions(e){return(e=Object.assign({},be,e)).encodeEntities instanceof RegExp&&(e.encodeEntities=w(e.encodeEntities)),Object.freeze(e)}static isNameCharStart(e){return":"===e||"_"===e||e>="A"&&e<="Z"||e>="a"&&e<="z"||e>="À"&&e<="Ö"||e>="Ø"&&e<="ö"||e>="ø"&&e<="˿"||e>="Ͱ"&&e<="ͽ"||e>="Ϳ"&&e<="῿"||"‌"===e||"‍"===e||e>="⁰"&&e<="↏"||e>="Ⰰ"&&e<="⿯"||e>="、"&&e<="퟿"||e>="豈"&&e<="﷏"||e>="ﷰ"&&e<="�"||e>="က0"&&e<="F"}static isNameChar(e){return Me.isNameCharStart(e)||e>="0"&&e<="9"||"-"===e||"."===e||"·"===e||e>="̀"&&e<="ͯ"||"‿"===e||"⁀"===e}parseHTML(){var e,t=Ne(ge.DOCUMENT_FRAGMENT_NODE),i=[t];for(t[E]=this.options,e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();e!==n&&i.length>0;)"<"===e?this.parseTag(i):this.parseText(i),e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();return t}parseTag(e){var t,i,s,r,o=0,a=this.lexer.index,l=this.lexer.getNextChar();if(l!==n)e:for(;">"!==l&&l!==n;){if(s=this.lexer.index,0===o){if("!"===l||"?"===l){if(this.options.allowProcessingInstructions&&this.lexer.match("?")){s=this.lexer.index,l=this.lexer.getChar();t:if(Me.isNameCharStart(l)){for(t=Ne(ge.PROCESSING_INSTRUCTION_NODE);l!==n&&Me.isNameChar(l);)l=this.lexer.getNextChar();if(!this.lexer.isWhiteSpace(l)&&l!==n&&("?"!==l||">"!==this.lexer.peek()))break t;t.target=this.lexer.str.slice(s,this.lexer.index),this.lexer.skipWhiteSpace(),s=this.lexer.index,this.lexer.goToString("?>"),t.nodeValue=this.lexer.str.slice(s,this.lexer.index),this.lexer.advance(1),e[0].childNodes.push(t),D(t,e[0]);break}this.lexer.advance(s-this.lexer.index-1)}if(this.options.allowCDATA&&this.lexer.match("![CDATA[")){t=Ne(ge.CDATA_SECTION_NODE),s=this.lexer.index,this.lexer.goToString("]]>"),t.nodeValue=this.lexer.str.slice(s,this.lexer.index),this.lexer.advance(2),e[0].childNodes.push(t),D(t,e[0]);break}if(this.lexer.match("!DOCTYPE",!1)){this.lexer.skipWhiteSpace(),s=this.lexer.index,this.lexer.goToString(">");let i=e[e.length-1];if(i.doctype)break;if(i.childNodes.length>0)for(let e=i.childNodes.length-1;e>=0;e--)if(i.childNodes[e].nodeTypege.COMMENT_NODE)break e;let r=this.lexer.str.slice(s,this.lexer.index).split(T);if((t=Ne(ge.DOCUMENT_TYPE_NODE)).name=ye.call(r.shift()),r.length>1){let e=ye.call(r.shift());if(r=r.join(" ").split('"'),""===r[0])switch(e){case"public":r.shift(),t.publicId=r.shift();case"system":r.shift(),t.systemId=r.shift()}}t.publicId||(t.publicId=""),t.systemId||(t.systemId=""),i.childNodes.push(t),i.doctype=t,D(t,i);break}{let i;this.lexer.match("!--")?this.lexer.match(">")||this.lexer.match("->")||(i="--\x3e"):("!"===l&&this.lexer.getNextChar(),i=">"),t=Ne(ge.COMMENT_NODE),s=this.lexer.index,i&&this.lexer.goToString(i),t.nodeValue=this.lexer.str.slice(s,this.lexer.index),this.lexer.advance(i?i.length-1:-1),e[0].childNodes.push(t),D(t,e[0]);break}}"/"===l&&(l=this.lexer.getNextChar(),o=2,s+=1)}if(1===o){for(;this.lexer.index===s&&"="===l||!this.lexer.isWhiteSpace(l)&&!Ce[l]&&l!==n;)l=this.lexer.getNextChar();r=this.lexer.index}else{for(;(l>="a"&&l<="z"||l>="A"&&l<="Z"||this.lexer.index>s&&(l>="0"&&l<="9"||"-"===l||"_"===l||":"===l))&&l!==n;)l=this.lexer.getNextChar();if(r=this.lexer.index,l===n)return void this.addTextNode(e,a,r,!1);l=this.lexer.skipWhiteSpace(),2===o&&(l=this.lexer.goToString(">"))}if(s===r){if(!this.options.allowSelfClosingSyntax||"/"!==l||">"!==this.lexer.peek()){if(0===o){this.lexer.goToString("<"),this.addTextNode(e,a,this.lexer.index,!1),a=this.lexer.index,l=this.lexer.getNextChar();continue}if(2===o){if(s===this.lexer.index)break;(t=this.addTextNode(e,s,this.lexer.index))[p]=ge.COMMENT_NODE;break}this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();continue}l=this.lexer.getNextChar(),o=2,i=e[0][g]}else i=this.lexer.str.slice(s,r),1!==o&&(i=xe.call(i)),l=this.lexer.skipWhiteSpace();switch(o){case 0:for((t=Ne(ge.ELEMENT_NODE))[g]=i;Ie.hasOwnProperty(t[g])&&Ie[t[g]][e[0][g]];)e.splice(0,1);e[0].childNodes.push(t),D(t,e[0]),o=1,!0!==y[t[g]]&&e.unshift(t);break;case 1:let a=!0;if(this.options.lowerAttributeCase&&(i=ye.call(i)),"="===l){if(this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace(),s=this.lexer.index,'"'===l||"'"===l)this.lexer.getNextChar(),this.lexer.goToString(l),r=this.lexer.index,s+=1,this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();else{for(;!(this.lexer.isWhiteSpace(l)|| //!unquotedAttributeExclusions[theChar] && -">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===n);)l=this.lexer.getNextChar();r=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(i))break;a=this.lexer.str.slice(s,r),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(i))break;t.attributes[i]=a;break;case 2:for(let s=0;s0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,i=!1;"SCRIPT"===e[0][g]||"STYLE"===e[0][g]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,i,s,r),c=h.data,d=this.canvas[Ge],u=r,p=s;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,i){return e instanceof ve?new ve(e.data,e.width,e.height):new ve(e,t,i)}getImageData(e,t,i,s,r){if(0===e&&0===t&&i===this.canvas.width&&s===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new ve(this.canvas[Ge],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new ve(i,s,r)}putImageData(e,t,i,s,r,n,o){let a,l;const h=this.canvas[Ge];if(void 0!==s)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===i&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==s?void 0:s.r)&&(null==s?void 0:s.g)&&(null==s?void 0:s.b)&&(n=parseInt(s.r,16),o=parseInt(s.g,16),a=parseInt(s.b,16),l=s.a?parseInt(s.a,10):1,r=!0),s=null===(i=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===i?void 0:i.groups,(null==s?void 0:s.r)&&(null==s?void 0:s.g)&&(null==s?void 0:s.b)&&(n=parseInt(s.r,16),o=parseInt(s.g,16),a=parseInt(s.b,16),l=s.a?parseInt(s.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const ke=Symbol("canvas-width"),$e=Symbol("canvas-height"),je=Symbol("canvas-context"),We=Symbol("element-id"),Ge=Symbol("accesscanvas-data");class Be extends ge{get width(){return console.debug(`${this}→width? (${this[ke]})`),this[ke]}get height(){return console.debug(`${this}→height? (${this[$e]})`),this[$e]}set width(e){console.debug(`${this}→width = ${e}`),this[ke]=e,this.resize(this[ke],this[$e])}set height(e){console.debug(`${this}→height = ${e}`),this[$e]=e,this.resize(this[ke],this[$e])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[je]=this[je]||new Le(this),!(this[je]instanceof Le))throw new Error("Context invalid");return this[je]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",i){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(fe),this[We]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[We]}`}resize(e,t){this[ke]=e,this[$e]=t,this[Ge]=new Uint8ClampedArray(this[ke]*this[$e]*4),console.debug(`${this}→reset, new size: ${this[ke]}x${this[$e]} (${this[Ge].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=Be);const He=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,Fe=/[\^$\\.*+?()[\]{}|]/g,Ye=Xe({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let Ve=Ye;class ze{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?w(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(He,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=Ve:e&&e.encodingRE instanceof RegExp||(e=Xe(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){Ve=e&&"object"==typeof e?Xe(Object.assign({},e)):Ye}}function Xe(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const i={},s={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(Fe,"\\$&")),(!i.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=i,t.decodingReplacements=s)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const qe=Symbol("entityEncoder");class Ze extends ge{constructor(e,t){const i=Ne(ge.DOCUMENT_FRAGMENT_NODE,Ze);return i[E]=Me.setupOptions(t),i[qe]=new ze(i[E].entities),i.innerHTML=e,i}get documentElement(){return this[u]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let i=t.getElementsByTagName("title");i=i.length<=0?t.appendChild(this.createElement("title")):i[0],i.textContent=e}}get body(){return this[d]||null}set body(e){e instanceof ge&&e.nodeType===ge.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[d]&&this[u]&&(this[d]?this[d].parentNode.replaceChild(e,this[d]):this[u].appendChild(e))}get entityEncoder(){return this[qe]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new Be;switch(t[p]=e,t.nodeValue=null,t[f]=null,t[N]=null,e){case ge.ELEMENT_NODE:t[g]=null,t.attributes={};case ge.DOCUMENT_NODE:case ge.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(ge.ELEMENT_NODE);return Ne(ge.ELEMENT_NODE)}(e);return t[g]=e.toUpperCase(),t}}createTextNode(e){return Ke(ge.TEXT_NODE,e)}createComment(e){return Ke(ge.COMMENT_NODE,e)}createCDATASection(e){return Ke(ge.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!Me.isNameCharStart(e[0]))break e;for(let t=1;t");return i.target=e,i}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,i){return Je(Ne(ge.DOCUMENT_TYPE_NODE),e,t,i)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((i=>{i.attributes&&i.attributes.name===e&&t.push(i)})),t}}function Ke(e,t,i=!1){const s=Ne(e);if(s.nodeValue="",t&&"string"==typeof t){if(i&&"string"==typeof i&&-1!==t.indexOf(i))throw new Error("The data provided ('"+t+"') contains '"+i+"'.");s.nodeValue+=t}return s}function Je(e,t,i,s){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=i&&"string"==typeof i?i:"",e.systemId=s&&"string"==typeof s?s:""):e.name=e.publicId=e.systemId="",e}return Ze.Node=ge,Ze.EntityEncoder=ze,Ze}(); +">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===n);)l=this.lexer.getNextChar();r=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(i))break;a=this.lexer.str.slice(s,r),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(i))break;t.attributes[i]=a;break;case 2:for(let s=0;s0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,i=!1;"SCRIPT"===e[0][g]||"STYLE"===e[0][g]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,i,s,r),c=h.data,d=this.canvas[Ge],u=r,p=s;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,i){return e instanceof ve?new ve(e.data,e.width,e.height):new ve(e,t,i)}getImageData(e,t,i,s,r){if(0===e&&0===t&&i===this.canvas.width&&s===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new ve(this.canvas[Ge],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new ve(i,s,r)}putImageData(e,t,i,s,r,n,o){let a,l;const h=this.canvas[Ge];if(void 0!==s)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===i&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==s?void 0:s.r)&&(null==s?void 0:s.g)&&(null==s?void 0:s.b)&&(n=parseInt(s.r,16),o=parseInt(s.g,16),a=parseInt(s.b,16),l=s.a?parseInt(s.a,10):1,r=!0),s=null===(i=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===i?void 0:i.groups,(null==s?void 0:s.r)&&(null==s?void 0:s.g)&&(null==s?void 0:s.b)&&(n=parseInt(s.r,16),o=parseInt(s.g,16),a=parseInt(s.b,16),l=s.a?parseInt(s.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const ke=Symbol("canvas-width"),$e=Symbol("canvas-height"),je=Symbol("canvas-context"),We=Symbol("element-id"),Ge=Symbol("accesscanvas-data");class Be extends ge{get width(){return console.debug(`${this}→width? (${this[ke]})`),this[ke]}get height(){return console.debug(`${this}→height? (${this[$e]})`),this[$e]}set width(e){console.debug(`${this}→width = ${e}`),this[ke]=e,this.resize(this[ke],this[$e])}set height(e){console.debug(`${this}→height = ${e}`),this[$e]=e,this.resize(this[ke],this[$e])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[je]=this[je]||new Le(this),!(this[je]instanceof Le))throw new Error("Context invalid");return this[je]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",i){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(fe),this[We]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[We]}`}resize(e,t){this[ke]=e,this[$e]=t,this[Ge]=new Uint8ClampedArray(this[ke]*this[$e]*4),console.debug(`${this}→reset, new size: ${this[ke]}x${this[$e]} (${this[Ge].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=Be);const He=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,Fe=/[\^$\\.*+?()[\]{}|]/g,Ye=Xe({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let Ve=Ye;class ze{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?w(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(He,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=Ve:e&&e.encodingRE instanceof RegExp||(e=Xe(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){Ve=e&&"object"==typeof e?Xe(Object.assign({},e)):Ye}}function Xe(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const i={},s={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(Fe,"\\$&")),(!i.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=i,t.decodingReplacements=s)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const qe=Symbol("entityEncoder");class Ze extends ge{constructor(e,t){const i=Ne(ge.DOCUMENT_FRAGMENT_NODE,Ze);return i[E]=Me.setupOptions(t),i[qe]=new ze(i[E].entities),i.innerHTML=e,i}get documentElement(){return this[u]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let i=t.getElementsByTagName("title");i=i.length<=0?t.appendChild(this.createElement("title")):i[0],i.textContent=e}}get body(){return this[d]||null}set body(e){e instanceof ge&&e.nodeType===ge.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[d]&&this[u]&&(this[d]?this[d].parentNode.replaceChild(e,this[d]):this[u].appendChild(e))}get entityEncoder(){return this[qe]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new Be;switch(t[p]=e,t.nodeValue=null,t[f]=null,t[N]=null,e){case ge.ELEMENT_NODE:t[g]=null,t.attributes={};case ge.DOCUMENT_NODE:case ge.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(ge.ELEMENT_NODE);return Ne(ge.ELEMENT_NODE)}(e);return t[g]=e.toUpperCase(),t}}createTextNode(e){return Ke(ge.TEXT_NODE,e)}createComment(e){return Ke(ge.COMMENT_NODE,e)}createCDATASection(e){return Ke(ge.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!Me.isNameCharStart(e[0]))break e;for(let t=1;t");return i.target=e,i}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,i){return Je(Ne(ge.DOCUMENT_TYPE_NODE),e,t,i)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((i=>{i.attributes&&i.attributes.name===e&&t.push(i)})),t}}function Ke(e,t,i=!1){const s=Ne(e);if(s.nodeValue="",t&&"string"==typeof t){if(i&&"string"==typeof i&&-1!==t.indexOf(i))throw new Error("The data provided ('"+t+"') contains '"+i+"'.");s.nodeValue+=t}return s}function Je(e,t,i,s){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=i&&"string"==typeof i?i:"",e.systemId=s&&"string"==typeof s?s:""):e.name=e.publicId=e.systemId="",e}return Ze.Node=ge,Ze.EntityEncoder=ze,Ze}(); diff --git a/lib/fauxdom-with-canvas.mjs b/lib/fauxdom-with-canvas.mjs index 6dd5fbb..f6924a3 100644 --- a/lib/fauxdom-with-canvas.mjs +++ b/lib/fauxdom-with-canvas.mjs @@ -1,3 +1,3 @@ const e={},t={},s=Object.prototype.hasOwnProperty.bind(t),i=null;class r{constructor(e){if(this.index=0,this.str=e,this.scanChar=this.str[this.index],!s(" ")){for(let e=0;e<=32;e++)t[String.fromCharCode(e)]=null;for(let e=128;e<=159;e++)t[String.fromCharCode(e)]=null}}isWhiteSpace(e){return e!==i&&s(e)}goToString(t,s){if(!1!==s)this.index=this.str.indexOf(t,this.index);else{e[t]||(e[t]=new RegExp(t,"ig")),e[t].lastIndex=this.index;const s=e[t].exec(this.str);this.index=s?s.index:-1}this.index>-1?this.scanChar=this.str[this.index]:(this.index=this.str.length,this.scanChar=i)}goToIndex(e){this.scanChar=this.str[this.index=e]}advance(e){return this.index+=e,this.index>this.str.length?(this.index=this.str.length,this.scanChar=i):this.scanChar=this.str[this.index]}match(e,t){var s=this.str.substr(this.index,e.length);return!1===t&&(e=e.toLowerCase(),s=s.toLowerCase()),s===e&&(this.index+=e.length-1,this.getNextChar(),!0)}peek(){return this.str[this.index+1]}getChar(){return this.scanChar}getNextChar(){return this.index+1e.callback===t&&e.capturing===r?s:void 0)).reverse().forEach((e=>{void 0!==e&&i.splice(e,1)}))}dispatchEvent(e){let t=!0;if(!this[n])return t;const s=this[n].get(e.type)??[];return s?.forEach((({callback:s})=>{s(e),e.defaultPrevented&&(t=!1)})),t}}const a=Symbol("doctype"),l=Symbol("head"),h=Symbol("body"),c=Symbol("documentElement"),d=Symbol("nodeType"),u=Symbol("parentNode"),p=Symbol("ownerDocument"),N=Symbol("tagName"),f=Symbol("parserOptions"),g=/\s+/g,E={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11},T={AREA:!0,BASE:!0,BR:!0,COL:!0,COMMAND:!0,EMBED:!0,HR:!0,IMG:!0,INPUT:!0,KEYGEN:!0,LINK:!0,META:!0,PARAM:!0,SOURCE:!0,TRACK:!0,WBR:!0};function m(e){var t=-1,s=-1,i="HTML";e[a]&&e[f].allowCustomRootElement&&(i=e[a].name.toUpperCase());for(let r=0,n=e.childNodes.length;r0)for(let t=0;t{e[p]=s}),null),e[u]=t,e[p]=s}function C(e){if(!e.global){let t=e.flags;e=new RegExp(e.source,t+"g")}return e}const b=Symbol("element"),D=Symbol("length"),w=/^\S+$/,S=Array.prototype.indexOf,_=Array.prototype.join,A=Array.prototype.splice;class I{constructor(){throw new Error("Cannot directly instantiate DOMTokenList.")}get length(){return this[D]}set length(e){}get value(){return _.call(this," ")}set value(e){if(this[D]>0)for(let e in this)this.hasOwnProperty(e)&&isFinite(e)&&delete this[e];this[D]=0,"string"==typeof e?this.add.apply(this,e.split(g)):delete this[b].attributes.class}add(){for(let e=0;e=0&&e=0&&this.supports(t))&&(-1===S.call(this,t)?this[s]=t:(A.call(this,s,1),this[D]--),this[b].attributes.class=this.value,!0)}supports(e){return!(!e||"string"!=typeof e)&&e.match(w)}}const M=Symbol("element");function v(e){return e.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}function R(e){return"string"==typeof e&&(!!e.match(/^\-?[a-z_-]*[a-z]$/)||(!!e.match(/^\-\-[A-Za-z_-]*[A-Za-z0-9]$/)||!!e.match(/^[a-zA-Z]+$/)))}function L(e=""){return new Map(e.split(/\s*;\s*/g).filter((e=>e.length)).map((e=>e.trim().match(/^([a-z-]+)\s*:\s*(.*)$/).slice(1))))}function U(e){return Array.from(e?.entries()??[]).map((e=>e.join(": "))).join("; ")}function k(e){return new Proxy({[M]:e},{get(t,s){if(s===M)return e;if(!R(s))return;const i=v(s);return L(e.attributes.style).get(i)},set(t,s,i){if(!R(s))return!0;const r=v(s),n=L(e.attributes.style);return e.attributes.style=U(n.set(r,i)),!0},deleteProperty(t,s){if(!R(s))return;const i=v(s),r=L(e.attributes.style);e.attributes.style=U(r.delete(i))}})}const P=/\r\n|\r|\f/g,$=/\(\s*(even|odd|(?:(?:([+-]?\d*)n)\s*(?:([+-])\s*(\d+))?|([+-]?\d+)))\s*/g,W={Selectors:0,Identifier:1,Iterator:2,IteratorOf:3},G={is:W.Selectors,not:W.Selectors,where:W.Selectors,has:W.Selectors,lang:W.Identifier,dir:W.Identifier,"nth-child":W.IteratorOf,"nth-last-child":W.IteratorOf,"nth-of-type":W.Iterator,"nth-last-of-type":W.Iterator,"nth-col":W.Iterator,"nth-last-col":W.Iterator};function j(e){return B(new r(e.replace(P,"\n")))}function B(e,t=i,s=!1){for(var r=e.skipWhiteSpace(),n={},o=[],a=[o],l=[a];r!==i&&r!==t;){switch(r){case"*":if(o.length>0)throw H("Universal selectors must come before all other simple selectors.",e);n.type="universal",o.push(n),n={};break;case"#":case".":{e.getNextChar();const t=F(e);if(!t)throw H("Expected an identifier.",e);n.type="#"===r?"id":"class",n.name=t,o.push(n),n={};break}case"[":{e.getNextAfterWhiteSpace();const t=F(e);if(!t)throw H("Expected an identifier.",e);if(n.type="attr",n.name=t,n.comparison="=",n.value=!0,n.ignoreCase=!1,"]"!==(r=e.getNextAfterWhiteSpace())){switch(r){case"=":break;case"~":case"|":case"^":case"$":case"*":if("="!==e.peek())throw H("Expected '='.",e,1);n.comparison=r+n.comparison,e.getNextChar();break;default:throw H("Unexpected character '"+(r===i?"END_OF_INPUT":r)+"'.",e)}if("'"===(r=e.getNextAfterWhiteSpace())||'"'===r){const t=r;for(n.value="",r=e.getNextChar();r!==i&&r!==t&&"\n"!==r;)"\\"===r?(n.value+=Y(e),r=e.getChar()):(n.value+=r,r=e.getNextChar())}else{const t=F(e);if(!t)throw H("Expected an identifier.",e);n.value=t}if("]"!==e.getNextAfterWhiteSpace()){const t=F(e);if("i"===t||"I"===t)n.ignoreCase=!0;else if("s"===t||"S"===t)n.ignoreCase=!1;else if(t)throw H("Unexpected identifier '"+t+"'.",e,1-t.length);if("]"!==e.getNextAfterWhiteSpace())throw H("Expected ']'.",e,-1+t.length)}}o.push(n),n={};break}case":":if(e.getNextChar(),e.match(":")){const t=F(e);if(!t)throw H("Expected a pseudo-element name.",e);n.type="pseudo-element",n.name=t}else{const t=F(e);if(!t)throw H("Expected a pseudo-class name.",e);n.type="pseudo-class",n.name=t;const s=G[t];if(null!=s){if(n.type="pseudo-fn","("!==e.getNextChar())throw H("Expected '('.",e);switch(s){case W.IteratorOf:case W.Iterator:let t,i=0,r=0;$.lastIndex=e.index;const o=$.exec(e.str);if(!o)throw H("Invalid parameter.",e,1);if(e.advance(o[0].length),s===W.IteratorOf){e.skipWhiteSpace();const s=e.index;if("of"===F(e).toLowerCase()){const s=e.getNextChar();if(")"!==s&&!e.isWhiteSpace(s))throw H("Expected whitespace.",e);if(t=B(e,")"),!(t instanceof Array)||0===t.length)throw H("Expected at least one selector.",e)}else e.goToIndex(s)}if(")"!==e.skipWhiteSpace())throw H("Expected ')'.",e);"even"===o[1]||"odd"===o[1]?(i=2,"odd"===o[1]&&(r=1)):o[5]?r=parseInt(o[5],10):(i="-"===o[2]?-1:o[2]&&"+"!==o[2]?parseInt(o[2],10):1,o[3]&&(r=parseInt(o[3]+o[4],10))),n.params=[i,r],t&&n.params.push(t);break;case W.Selectors:if(e.getNextChar(),n.params=B(e,")",!0),0===n.params.length)throw H("Expected at least one selector.",e);break;case W.Identifier:if(!X(e.getNextAfterWhiteSpace()))throw H("Expected an identifier.",e);n.params=[F(e)],e.getNextChar()}if(")"!==e.skipWhiteSpace())throw H("Expected ')'.",e)}else"before"!==t&&"after"!==t&&"first-line"!==t&&"first-letter"!==t||(n.type="pseudo-element")}o.push(n),n={};break;case"+":case">":case"~":if(0===o.length){if(1===a.length){if(!s)throw H("Absolute selectors cannot start with a combinator.",e);a.unshift([{type:"pseudo-class",name:"scope"}])}else if("string"==typeof a[a.length-2])throw H("Cannot have multiple combinators in a row.",e);a.splice(a.length-1,0,r)}else a.push(r,o=[]);break;case",":if(0===o.length){if(a.length>1){if(a.pop(),"string"==typeof a[a.length-1])throw H("Complex selectors are not allowed to end with a combinator.",e,-1);l.push(a=[o])}}else l.push(a=[o=[]]);e.skipWhiteSpace();break;default:if(e.isWhiteSpace(r))o.length>0&&a.push(o=[]),e.skipWhiteSpace(),e.advance(-1);else{if(!X(r))throw H("Unexpected character '"+r+"'.",e);if(o.length>0)throw H("Type (tag name) selectors must come before all other simple selectors.",e);n.type="type",n.name=F(e).toUpperCase(),o.push(n),n={}}}r=e.getNextChar()}if(0===o.length&&(1===a.length?(l.pop(),a=l[l.length-1]):a.pop()),a&&"string"==typeof a[a.length-1])throw H("Complex selectors are not allowed to end with a combinator.",e,-1);return l}function H(e,t,s=0){var i=new SyntaxError(e),r=t.index+s;return i.stack="SyntaxError: "+e+"\n\n"+t.str+"\n"+" ".repeat(r)+"^\n at index "+r,i}function F(e){var t="",s=e.getChar();if(X(s)){do{"\\"===s?(t+=Y(e),s=e.getChar()):(t+=s,s=e.getNextChar())}while(s!==i&&(X(s)||s>="0"&&s<="9"||"-"===s));e.advance(-1)}return t}function Y(e){var t=e.getNextChar();if(V(t)){let s="";for(let i=5;i>=0&&V(t);i--)s+=t,t=e.getNextChar();return e.isWhiteSpace(t)&&e.getNextChar(),s=0|parseInt(s,16),0===s||s>=55296&&s<=57343||s>1114111?"�":String.fromCodePoint(s)}return t===i?"�":(e.getNextChar(),t)}function V(e){return e!==i&&(e>="0"&&e<="9"||e>="A"&&e<="F"||e>="a"&&e<="f")}function X(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"||"_"===e||e>="€"||"\\"===e}const z=0,q=1,Z=2,K=3,J=4,Q={">":Z,"+":K,"~":J},ee={is:(e,t,s)=>ie(e,t,s),not:(e,t,s)=>!ie(e,t,s),has(e,t,s){var i=!1;for(let e=0;e0&&t.forEach((e=>{if(ie(t,e,s))return i=!0,!1})),i},"nth-child"(e,t,s){const i=t[u],r=i.childNodes,n=new oe(s[0],s[1]);for(let e=0;e=0;e--)if(r[e][d]===pe.ELEMENT_NODE&&(!s[2]||ie(i,r[e],s[2]))){const s=n.next();if(r[e]===t)return s}return!1},"nth-of-type"(e,t,s){const i=t[u].childNodes,r=new oe(s[0],s[1]),n=t[N];for(let e=0;e=0;e--)if(i[e][N]===n){const s=r.next();if(i[e]===t)return s}}},te={scope:(e,t)=>t===e,enabled(e,t){switch(t[N]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return!t.hasAttribute("disabled")}return!1},disabled(e,t){switch(t[N]){case"BUTTON":case"INPUT":case"SELECT":case"TEXTAREA":case"OPTGROUP":case"OPTION":case"FIELDSET":return t.hasAttribute("disabled")}return!1},checked(e,t){if("INPUT"===t[N]){const e=t.getAttribute("type");if("checkbox"===e||"radio"===e)return t.hasAttribute("checked")}else if("OPTION"===t[N])return t.hasAttribute("selected");return!1},required(e,t){switch(t[N]){case"INPUT":case"SELECT":case"TEXTAREA":return t.hasAttribute("required")}return!1},optional(e,t){switch(t[N]){case"INPUT":case"SELECT":case"TEXTAREA":return!t.hasAttribute("required")}return!1},root(e,t){const s=O(e);return!!s&&s.documentElement===t},empty:(e,t)=>0===t.childNodes.length,"first-child"(e,t){const s=t[u].childNodes;for(let e=0;e=0;e--)if(s[e][d]===pe.ELEMENT_NODE)return s[e]===t},"only-child"(e,t){const s=t[u].childNodes;let i,r;for(let e=0,t=s.length-1;t>=0&&(!i||!r);e++,t--)i||s[e][d]!==pe.ELEMENT_NODE||(i=s[e]),r||s[t][d]!==pe.ELEMENT_NODE||(r=s[t]);return i===r&&i===t},"first-of-type"(e,t){const s=t[u].childNodes,i=t[N];for(let e=0;e=0;e--)if(s[e][N]===i)return s[e]===t},"only-of-type"(e,t){const s=t[u].childNodes,i=t[N];let r,n;for(let e=0,t=s.length-1;t>=0&&(!r||!n);e++,t--)r||s[e][N]!==i||(r=s[e]),n||s[t][N]!==i||(n=s[t]);return r===n&&r===t}};function se(e,t,s){const i=j(t),r=[];return e.forEach((t=>{if(ie(e,t,i)&&(r.push(t),!s))return!1})),s?r:r[0]||null}function ie(e,t,s,i=!1){var r;e:for(let n=0;n=0;i?t++:t--)if(Q.hasOwnProperty(o[t]))a=Q[o[t]];else switch(a){case z:if(!re(e,r,o[t]))continue e;a=q;break;case q:for(;r=r[u];)if(re(e,r,o[t]))continue t;continue e;case Z:if(!re(e,r=r[u],o[t]))continue e;break;case K:{const s=r[u].childNodes;if(!re(e,r=s[s.indexOf(r)+(i?1:-1)],o[t]))continue e;break}case J:{const s=r[u].childNodes;for(let n=s.indexOf(r)+(i?1:-1);i?n=0;i?n++:n--)if(re(e,s[n],o[t])){r=s[n];continue t}continue e}}return!0}}return!1}function re(e,t,s){if(!t||t[d]!==pe.ELEMENT_NODE)return!1;for(let i=0;i=this.current||this.A>0&&this.current>=this.B)&&(e=(this.current+this.B)%this.A==0),e}}function ae(e){var t=e.tagName,s=O(e),i=s?s.entityEncoder:null,r="";switch(e.nodeType){case E.ELEMENT_NODE:r+="<"+(t=t.toLowerCase());for(let t in e.attributes)if(e.attributes.hasOwnProperty(t)){let n=e.attributes[t];!0===n?n="":i&&s[f]&&(n=le(n,i,s[f])),r+=" "+t,""!==n&&(r+='="'+n+'"')}r+=">";for(let t=0;t");break;case E.TEXT_NODE:i&&s[f]&&(!e.parentNode||"SCRIPT"!==e.parentNode.tagName&&"STYLE"!==e.parentNode.tagName)?r+=le(e.nodeValue,i,s[f]):r+=e.nodeValue;break;case E.CDATA_SECTION_NODE:r+="";break;case E.PROCESSING_INSTRUCTION_NODE:r+="";break;case E.COMMENT_NODE:r+="\x3c!--"+e.nodeValue+"--\x3e";break;case E.DOCUMENT_TYPE_NODE:r+=""}return r}function le(e,t,s){return!1===s.encodeEntities?e:!0!==s.encodeEntities&&s.encodeEntities instanceof RegExp?t.encode(e,s.encodeEntities):t.encode(e)}const he=Symbol("classList"),ce=Symbol("style"),de=Symbol("extendNode");function ue(e,t=pe){const s=Object.create(t.prototype);switch(s[d]=e,s.nodeValue=null,s[u]=null,s[p]=null,e){case pe.ELEMENT_NODE:s[N]=null,s.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:s.childNodes=[]}return s}class pe extends o{constructor(){if(super(),arguments[0]!==de)throw new Error("Cannot directly instantiate Node.")}get nodeType(){return this[d]}get nodeName(){switch(this.nodeType){case pe.ELEMENT_NODE:return this.tagName;case pe.TEXT_NODE:return"#text";case pe.CDATA_SECTION_NODE:return"#cdata-section";case pe.PROCESSING_INSTRUCTION_NODE:return this.target;case pe.COMMENT_NODE:return"#comment";case pe.DOCUMENT_NODE:return"#document";case pe.DOCUMENT_TYPE_NODE:return this.name;case pe.DOCUMENT_FRAGMENT_NODE:return"#document-fragment"}}get parentNode(){return this[u]}get ownerDocument(){return this[p]}get tagName(){return this[N]||null}get firstChild(){return this.childNodes&&this.childNodes[0]||null}get lastChild(){return this.childNodes&&this.childNodes[this.childNodes.length-1]||null}get previousSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>0)return e.childNodes[t-1]}return null}get nextSibling(){const e=this.parentNode;if(e){const t=e.childNodes.indexOf(this);if(t>-1&&t=pe.TEXT_NODE&&this.nodeType<=pe.COMMENT_NODE&&(this.nodeValue=e)}getRootNode(){let e=this;for(;e.parentNode;)e=e.parentNode;return e}hasAttributes(){if(this.attributes)for(let e in this.attributes)if(this.attributes.hasOwnProperty(e))return!0;return!1}getAttributeNames(){return this.attributes?Object.keys(this.attributes):[]}getAttribute(e){var t;return this.attributes&&e&&"string"==typeof e&&(t=this.attributes[Ee(this,e)]),void 0===t?null:t}setAttribute(e,t){this.attributes&&e&&"string"==typeof e&&("class"===(e=Ee(this,e))?!0!==t?this.className=""+t:(this.classList.value="",this.attributes[e]=!0):this.attributes[e]="string"==typeof t||!0===t?t:""+t)}toggleAttribute(e,t){if(this.attributes&&e&&"string"==typeof e)return e=Ee(this,e),this.attributes.hasOwnProperty(e)?1!==arguments.length&&!1!==t||(delete this.attributes[e],!1):(1===arguments.length||!0===t)&&(this.attributes[e]=!0)}removeAttribute(e){this.attributes&&e&&"string"==typeof e&&("class"===(e=Ee(this,e))&&this[he]&&(this[he].value=null),delete this.attributes[e])}hasAttribute(e){return!(!this.attributes||!e||"string"!=typeof e)&&this.attributes.hasOwnProperty(Ee(this,e))}hasChildNodes(){return!!this.childNodes&&this.childNodes.length>0}appendChild(e){return this.insertBefore(e,null)}insertBefore(e,t){if(this.childNodes&&e instanceof pe&&arguments.length>1){let s=-1;if(null==t?s=this.childNodes.length:t instanceof pe&&t.parentNode===this&&(s=this.childNodes.indexOf(t)),-1!==s)return fe(this,e,s)}return null}replaceChild(e,t){return this.childNodes&&t instanceof pe&&e instanceof pe&&t.parentNode===this&&t!==e?(fe(this,e,this.childNodes.indexOf(t),1),t):null}removeChild(e){if(this.childNodes&&e instanceof pe&&e.parentNode===this){const t=this.childNodes.indexOf(e),s=O(this);return s&&e.parentNode===s.documentElement&&Ne.hasOwnProperty(e.tagName)&&(s[Ne[e.tagName]]=null),x(this.childNodes.splice(t,1)),e}return null}cloneNode(e){var t;switch(t=this.nodeType===pe.DOCUMENT_NODE||this.nodeType===pe.DOCUMENT_FRAGMENT_NODE?new Xe(null,this[f]):ue(this.nodeType),this.nodeType){case pe.ELEMENT_NODE:t[N]=this.tagName,t.attributes=Object.assign(t.attributes,this.attributes);break;case pe.TEXT_NODE:case pe.CDATA_SECTION_NODE:case pe.PROCESSING_INSTRUCTION_NODE:case pe.COMMENT_NODE:t.nodeValue=this.nodeValue;break;case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t[d]=this.nodeType,t.entityEncoder.entities=this.entityEncoder;break;case pe.DOCUMENT_TYPE_NODE:t.name=this.name,t.publicId=this.publicId,t.systemId=this.systemId}if(!0===e&&this.childNodes&&this.childNodes.length>0){for(let e=0;e{if(s.id===e)return t=s,!1})),t}getElementsByClassName(e){var t=[];if(e&&"string"==typeof e){const s=e.trim().split(g);(s.length>1||""!==s[0])&&this.forEach((e=>{for(let t=0;t{"*"!==e&&s.tagName!==e||t.push(s)}))),t}closest(e){return e&&"string"==typeof e?function(e,t){const s=j(t);let i=e;for(;null!=i&&i[d]===pe.ELEMENT_NODE;){if(ie(e,i,s))return i;i=i[u]}return null}(this,e):null}matches(e){return!(!e||"string"!=typeof e)&&function(e,t){return ie(e,e,j(t))}(this,e)}querySelector(e){return e&&"string"==typeof e?se(this,e,!1):null}querySelectorAll(e){return e&&"string"==typeof e?se(this,e,!0):[]}forEach(e,t=E.ELEMENT_NODE){let s,i,r=this.childNodes,n=this.firstChild,o=[],a=0;for(;n;){if(s=n[u],i=r[a+1],(null===t||n.nodeType===t)&&!1===e(n,s))return;if(n[u]===s&&n.childNodes&&n.childNodes.length>0)o.push(a),r=n.childNodes,n=r[a=0];else{for(i?(a+=1,i!==r[a]&&(a=s.childNodes.indexOf(i))):a=r.length;null==r[a];){if(n=s,s=n[u],!n||n===this)return;r=s.childNodes,a=o.pop()+1}n=r[a]}}}}Object.defineProperties(pe,{ELEMENT_NODE:{value:E.ELEMENT_NODE},TEXT_NODE:{value:E.TEXT_NODE},CDATA_SECTION_NODE:{value:E.CDATA_SECTION_NODE},PROCESSING_INSTRUCTION_NODE:{value:E.PROCESSING_INSTRUCTION_NODE},COMMENT_NODE:{value:E.COMMENT_NODE},DOCUMENT_NODE:{value:E.DOCUMENT_NODE},DOCUMENT_TYPE_NODE:{value:E.DOCUMENT_TYPE_NODE},DOCUMENT_FRAGMENT_NODE:{value:E.DOCUMENT_FRAGMENT_NODE}});const Ne={HEAD:l,BODY:h,FRAMESET:h};function fe(e,t,s,i=0){if(!e||e.nodeType!==pe.ELEMENT_NODE&&e.nodeType!==pe.DOCUMENT_NODE&&e.nodeType!==pe.DOCUMENT_FRAGMENT_NODE||e.nodeType===pe.ELEMENT_NODE&&!0===T[e.tagName])return t;if(t.nodeType<=pe.COMMENT_NODE){if(e.parentNode&&e.parentNode.nodeType===pe.DOCUMENT_NODE&&Ne.hasOwnProperty(t.tagName)){const s=Ne[t.tagName];if(e.parentNode[s]&&0===i)return t;e.parentNode[s]=t}t.parentNode&&t.parentNode.removeChild(t),y(t,e),x(e.childNodes.splice(s,i,t))}else if(t.nodeType!==pe.DOCUMENT_TYPE_NODE||e.nodeType!==pe.DOCUMENT_NODE&&e.nodeType!==pe.DOCUMENT_FRAGMENT_NODE){if(t.nodeType===pe.DOCUMENT_FRAGMENT_NODE)if(e.parentNode&&e.parentNode.nodeType===pe.DOCUMENT_NODE){i>0&&x(e.childNodes.splice(s,i));for(let r=t.childNodes.length-1;r>=0;r--){const n=t.childNodes[r];if(Ne.hasOwnProperty(n.tagName)){const t=Ne[n.tagName];if(e.parentNode[t]&&0===i)continue;e.parentNode[t]=n}y(n,e),e.childNodes.splice(s,0,n),t.childNodes.splice(r,1)}}else if(t!==O(e)){for(let s=0;s":!0,"/":!0,"=":!0},ye={P:!0},Ce={DT:!0,DD:!0},be={TBODY:!0,THEAD:!0,TFOOT:!0},De={TD:!0,TH:!0},we={BUTTON:!0,DATALIST:!0,OPTGROUP:!0,OPTION:!0,PROGRESS:!0,SELECT:!0,TEXTAREA:!0},Se={ADDRESS:ye,ARTICLE:ye,ASIDE:ye,BLOCKQUOTE:ye,DIV:ye,FIELDSET:ye,FOOTER:ye,H1:ye,H2:ye,H3:ye,H4:ye,H5:ye,H6:ye,HEADER:ye,HGROUP:ye,HR:ye,MAIN:ye,NAV:ye,P:ye,PRE:ye,SECTION:ye,BODY:{HEAD:!0,TITLE:!0},DL:ye,DD:Ce,DT:Ce,TABLE:ye,TBODY:be,THEAD:be,TD:De,TFOOT:be,TH:De,TR:{TR:!0},LI:{LI:!0},OL:ye,UL:ye,BUTTON:we,DATALIST:we,FORM:ye,INPUT:we,OPTGROUP:{OPTGROUP:!0,OPTION:!0},OPTION:{OPTION:!0},OUTPUT:we,PROGRESS:we,SELECT:we,TEXTAREA:we};class _e{constructor(e,t,s){this.options=_e.setupOptions(t),this.lexer=new r(e),this.entityEncoder=s}static setupOptions(e){return(e=Object.assign({},Oe,e)).encodeEntities instanceof RegExp&&(e.encodeEntities=C(e.encodeEntities)),Object.freeze(e)}static isNameCharStart(e){return":"===e||"_"===e||e>="A"&&e<="Z"||e>="a"&&e<="z"||e>="À"&&e<="Ö"||e>="Ø"&&e<="ö"||e>="ø"&&e<="˿"||e>="Ͱ"&&e<="ͽ"||e>="Ϳ"&&e<="῿"||"‌"===e||"‍"===e||e>="⁰"&&e<="↏"||e>="Ⰰ"&&e<="⿯"||e>="、"&&e<="퟿"||e>="豈"&&e<="﷏"||e>="ﷰ"&&e<="�"||e>="က0"&&e<="F"}static isNameChar(e){return _e.isNameCharStart(e)||e>="0"&&e<="9"||"-"===e||"."===e||"·"===e||e>="̀"&&e<="ͯ"||"‿"===e||"⁀"===e}parseHTML(){var e,t=ue(pe.DOCUMENT_FRAGMENT_NODE),s=[t];for(t[f]=this.options,e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();e!==i&&s.length>0;)"<"===e?this.parseTag(s):this.parseText(s),e=this.options.trimWhitespace?this.lexer.skipWhiteSpace():this.lexer.getChar();return t}parseTag(e){var t,s,r,n,o=0,a=this.lexer.index,l=this.lexer.getNextChar();if(l!==i)e:for(;">"!==l&&l!==i;){if(r=this.lexer.index,0===o){if("!"===l||"?"===l){if(this.options.allowProcessingInstructions&&this.lexer.match("?")){r=this.lexer.index,l=this.lexer.getChar();t:if(_e.isNameCharStart(l)){for(t=ue(pe.PROCESSING_INSTRUCTION_NODE);l!==i&&_e.isNameChar(l);)l=this.lexer.getNextChar();if(!this.lexer.isWhiteSpace(l)&&l!==i&&("?"!==l||">"!==this.lexer.peek()))break t;t.target=this.lexer.str.slice(r,this.lexer.index),this.lexer.skipWhiteSpace(),r=this.lexer.index,this.lexer.goToString("?>"),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(1),e[0].childNodes.push(t),y(t,e[0]);break}this.lexer.advance(r-this.lexer.index-1)}if(this.options.allowCDATA&&this.lexer.match("![CDATA[")){t=ue(pe.CDATA_SECTION_NODE),r=this.lexer.index,this.lexer.goToString("]]>"),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(2),e[0].childNodes.push(t),y(t,e[0]);break}if(this.lexer.match("!DOCTYPE",!1)){this.lexer.skipWhiteSpace(),r=this.lexer.index,this.lexer.goToString(">");let s=e[e.length-1];if(s.doctype)break;if(s.childNodes.length>0)for(let e=s.childNodes.length-1;e>=0;e--)if(s.childNodes[e].nodeTypepe.COMMENT_NODE)break e;let i=this.lexer.str.slice(r,this.lexer.index).split(g);if((t=ue(pe.DOCUMENT_TYPE_NODE)).name=Te.call(i.shift()),i.length>1){let e=Te.call(i.shift());if(i=i.join(" ").split('"'),""===i[0])switch(e){case"public":i.shift(),t.publicId=i.shift();case"system":i.shift(),t.systemId=i.shift()}}t.publicId||(t.publicId=""),t.systemId||(t.systemId=""),s.childNodes.push(t),s.doctype=t,y(t,s);break}{let s;this.lexer.match("!--")?this.lexer.match(">")||this.lexer.match("->")||(s="--\x3e"):("!"===l&&this.lexer.getNextChar(),s=">"),t=ue(pe.COMMENT_NODE),r=this.lexer.index,s&&this.lexer.goToString(s),t.nodeValue=this.lexer.str.slice(r,this.lexer.index),this.lexer.advance(s?s.length-1:-1),e[0].childNodes.push(t),y(t,e[0]);break}}"/"===l&&(l=this.lexer.getNextChar(),o=2,r+=1)}if(1===o){for(;this.lexer.index===r&&"="===l||!this.lexer.isWhiteSpace(l)&&!xe[l]&&l!==i;)l=this.lexer.getNextChar();n=this.lexer.index}else{for(;(l>="a"&&l<="z"||l>="A"&&l<="Z"||this.lexer.index>r&&(l>="0"&&l<="9"||"-"===l||"_"===l||":"===l))&&l!==i;)l=this.lexer.getNextChar();if(n=this.lexer.index,l===i)return void this.addTextNode(e,a,n,!1);l=this.lexer.skipWhiteSpace(),2===o&&(l=this.lexer.goToString(">"))}if(r===n){if(!this.options.allowSelfClosingSyntax||"/"!==l||">"!==this.lexer.peek()){if(0===o){this.lexer.goToString("<"),this.addTextNode(e,a,this.lexer.index,!1),a=this.lexer.index,l=this.lexer.getNextChar();continue}if(2===o){if(r===this.lexer.index)break;(t=this.addTextNode(e,r,this.lexer.index))[d]=pe.COMMENT_NODE;break}this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();continue}l=this.lexer.getNextChar(),o=2,s=e[0][N]}else s=this.lexer.str.slice(r,n),1!==o&&(s=me.call(s)),l=this.lexer.skipWhiteSpace();switch(o){case 0:for((t=ue(pe.ELEMENT_NODE))[N]=s;Se.hasOwnProperty(t[N])&&Se[t[N]][e[0][N]];)e.splice(0,1);e[0].childNodes.push(t),y(t,e[0]),o=1,!0!==T[t[N]]&&e.unshift(t);break;case 1:let a=!0;if(this.options.lowerAttributeCase&&(s=Te.call(s)),"="===l){if(this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace(),r=this.lexer.index,'"'===l||"'"===l)this.lexer.getNextChar(),this.lexer.goToString(l),n=this.lexer.index,r+=1,this.lexer.getNextChar(),l=this.lexer.skipWhiteSpace();else{for(;!(this.lexer.isWhiteSpace(l)|| //!unquotedAttributeExclusions[theChar] && -">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===i);)l=this.lexer.getNextChar();n=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(s))break;a=this.lexer.str.slice(r,n),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(s))break;t.attributes[s]=a;break;case 2:for(let i=0;i0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,s=!1;"SCRIPT"===e[0][N]||"STYLE"===e[0][N]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,s,i,r),c=h.data,d=this.canvas[$e],u=r,p=i;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,s){return e instanceof Ae?new Ae(e.data,e.width,e.height):new Ae(e,t,s)}getImageData(e,t,s,i,r){if(0===e&&0===t&&s===this.canvas.width&&i===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new Ae(this.canvas[$e],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new Ae(s,i,r)}putImageData(e,t,s,i,r,n,o){let a,l;const h=this.canvas[$e];if(void 0!==i)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===s&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),i=null===(s=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===s?void 0:s.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const Le=Symbol("canvas-width"),Ue=Symbol("canvas-height"),ke=Symbol("canvas-context"),Pe=Symbol("element-id"),$e=Symbol("accesscanvas-data");class We extends pe{get width(){return console.debug(`${this}→width? (${this[Le]})`),this[Le]}get height(){return console.debug(`${this}→height? (${this[Ue]})`),this[Ue]}set width(e){console.debug(`${this}→width = ${e}`),this[Le]=e,this.resize(this[Le],this[Ue])}set height(e){console.debug(`${this}→height = ${e}`),this[Ue]=e,this.resize(this[Le],this[Ue])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[ke]=this[ke]||new Me(this),!(this[ke]instanceof Me))throw new Error("Context invalid");return this[ke]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",s){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(de),this[Pe]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[Pe]}`}resize(e,t){this[Le]=e,this[Ue]=t,this[$e]=new Uint8ClampedArray(this[Le]*this[Ue]*4),console.debug(`${this}→reset, new size: ${this[Le]}x${this[Ue]} (${this[$e].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=We);const Ge=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,je=/[\^$\\.*+?()[\]{}|]/g,Be=Ye({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let He=Be;class Fe{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?C(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(Ge,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=He:e&&e.encodingRE instanceof RegExp||(e=Ye(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){He=e&&"object"==typeof e?Ye(Object.assign({},e)):Be}}function Ye(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const s={},i={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(je,"\\$&")),(!s.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=s,t.decodingReplacements=i)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const Ve=Symbol("entityEncoder");class Xe extends pe{constructor(e,t){const s=ue(pe.DOCUMENT_FRAGMENT_NODE,Xe);return s[f]=_e.setupOptions(t),s[Ve]=new Fe(s[f].entities),s.innerHTML=e,s}get documentElement(){return this[c]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let s=t.getElementsByTagName("title");s=s.length<=0?t.appendChild(this.createElement("title")):s[0],s.textContent=e}}get body(){return this[h]||null}set body(e){e instanceof pe&&e.nodeType===pe.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[h]&&this[c]&&(this[h]?this[h].parentNode.replaceChild(e,this[h]):this[c].appendChild(e))}get entityEncoder(){return this[Ve]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new We;switch(t[d]=e,t.nodeValue=null,t[u]=null,t[p]=null,e){case pe.ELEMENT_NODE:t[N]=null,t.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(pe.ELEMENT_NODE);return ue(pe.ELEMENT_NODE)}(e);return t[N]=e.toUpperCase(),t}}createTextNode(e){return ze(pe.TEXT_NODE,e)}createComment(e){return ze(pe.COMMENT_NODE,e)}createCDATASection(e){return ze(pe.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!_e.isNameCharStart(e[0]))break e;for(let t=1;t");return s.target=e,s}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,s){return qe(ue(pe.DOCUMENT_TYPE_NODE),e,t,s)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((s=>{s.attributes&&s.attributes.name===e&&t.push(s)})),t}}function ze(e,t,s=!1){const i=ue(e);if(i.nodeValue="",t&&"string"==typeof t){if(s&&"string"==typeof s&&-1!==t.indexOf(s))throw new Error("The data provided ('"+t+"') contains '"+s+"'.");i.nodeValue+=t}return i}function qe(e,t,s,i){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=s&&"string"==typeof s?s:"",e.systemId=i&&"string"==typeof i?i:""):e.name=e.publicId=e.systemId="",e}Xe.Node=pe,Xe.EntityEncoder=Fe;export{Xe as default}; +">"===l||this.options.allowSelfClosingSyntax&&"/"===l&&">"===this.lexer.peek()||l===i);)l=this.lexer.getNextChar();n=this.lexer.index,l=this.lexer.skipWhiteSpace()}if(t.attributes.hasOwnProperty(s))break;a=this.lexer.str.slice(r,n),""===a?a=!0:this.options.decodeEntities&&(a=this.entityEncoder.decode(a))}else if(t.attributes.hasOwnProperty(s))break;t.attributes[s]=a;break;case 2:for(let i=0;i0&&e[0]!==t;)e.shift();e.shift();break}}}else this.addTextNode(e,a,this.lexer.index,!1);this.lexer.getNextChar()}parseText(e){var t=this.lexer.index,s=!1;"SCRIPT"===e[0][N]||"STYLE"===e[0][N]?(this.lexer.goToString(" ${Array.from(arguments).join(", ")} )`);const h=e.getContext("2d").getImageData(t,s,i,r),c=h.data,d=this.canvas[$e],u=r,p=i;for(let e=0;e ${Array.from(arguments).join(", ")} )`)}else console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${e.constructor.name}> ${Array.from(arguments).join(", ")} )`)}createImageData(e,t,s){return e instanceof Ae?new Ae(e.data,e.width,e.height):new Ae(e,t,s)}getImageData(e,t,s,i,r){if(0===e&&0===t&&s===this.canvas.width&&i===this.canvas.height&&!r)return console.log(`${this}→getImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`),new Ae(this.canvas[$e],this.canvas.width,this.canvas.height);console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(", ")} )`);return new Ae(s,i,r)}putImageData(e,t,s,i,r,n,o){let a,l;const h=this.canvas[$e];if(void 0!==i)console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(", ")} )`);else{if(0===t&&0===s&&e.width===this.canvas.width&&e.height===this.canvas.height){console.log(`${this}→putImageData( ${Array.from(arguments).join(", ")} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);for(let t=0;t[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/))||void 0===t?void 0:t.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),i=null===(s=e.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/))||void 0===s?void 0:s.groups,(null==i?void 0:i.r)&&(null==i?void 0:i.g)&&(null==i?void 0:i.b)&&(n=parseInt(i.r,16),o=parseInt(i.g,16),a=parseInt(i.b,16),l=i.a?parseInt(i.a,10):1,r=!0),r?{r:n,g:o,b:a,a:l}:(console.log(`Not a HTML color string: ${e}`),null)}const Le=Symbol("canvas-width"),Ue=Symbol("canvas-height"),ke=Symbol("canvas-context"),Pe=Symbol("element-id"),$e=Symbol("accesscanvas-data");class We extends pe{get width(){return console.debug(`${this}→width? (${this[Le]})`),this[Le]}get height(){return console.debug(`${this}→height? (${this[Ue]})`),this[Ue]}set width(e){console.debug(`${this}→width = ${e}`),this[Le]=e,this.resize(this[Le],this[Ue])}set height(e){console.debug(`${this}→height = ${e}`),this[Ue]=e,this.resize(this[Le],this[Ue])}getContext(e,t){if("2d"!=e)throw new Error(`Not implemented: ${e}`);if(this[ke]=this[ke]||new Me(this),!(this[ke]instanceof Me))throw new Error("Context invalid");return this[ke]}toDataURL(e="image/png",t){throw new Error("Not implemented")}toBlob(e,t="image/png",s){throw new Error("Not implemented")}get clientWidth(){return this.width}get clientHeight(){return this.height}constructor(){super(de),this[Pe]=(Math.random()*Math.pow(36,6)|0).toString(36),this.resize(300,150)}get[Symbol.toStringTag](){return`HTMLCanvasElement#${this[Pe]}`}resize(e,t){this[Le]=e,this[Ue]=t,this[$e]=new Uint8ClampedArray(this[Le]*this[Ue]*4),console.debug(`${this}→reset, new size: ${this[Le]}x${this[Ue]} (${this[$e].length}b)`)}}globalThis&&"object"!=typeof globalThis.HTMLCanvasElement&&(globalThis.HTMLCanvasElement=We);const Ge=/&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,je=/[\^$\\.*+?()[\]{}|]/g,Be=Ye({amp:"&",apos:"'",copy:169,gt:">",lt:"<",nbsp:160,quot:'"'});let He=Be;class Fe{constructor(e){this.entities=e||"default"}encode(e,t){return this.encodingReplacements?e.replace(t instanceof RegExp?C(t):this.encodingRE,(e=>this.encodingReplacements[e]||e)):e}decode(e){return this.decodingReplacements?e.replace(Ge,((e,t)=>"#"===t[0]?(t="x"===t[1]||"X"===t[1]?0|parseInt(t.slice(2),16):0|t.slice(1),String.fromCodePoint(t)):this.decodingReplacements[t]||this.decodingReplacements[t.toLowerCase()]||e)):e}set entities(e){"default"===e?e=He:e&&e.encodingRE instanceof RegExp||(e=Ye(e)),this.encodingRE=e.encodingRE,this.encodingReplacements=e.encodingReplacements,this.decodingReplacements=e.decodingReplacements}static set defaultEntities(e){He=e&&"object"==typeof e?Ye(Object.assign({},e)):Be}}function Ye(e){var t={encodingRE:null,encodingReplacements:null,decodingReplacements:null};if(e&&"object"==typeof e){const s={},i={},r=[];for(let t in e)if(e.hasOwnProperty(t)){let n=e[t];if(Number.isFinite(n))n=String.fromCodePoint(n);else if("string"!=typeof n||""===n)continue;r.push(n.replace(je,"\\$&")),(!s.hasOwnProperty(n)||t.length+20&&(t.encodingRE=new RegExp(r.join("|"),"g"),t.encodingReplacements=s,t.decodingReplacements=i)}return t.encodingRE||(t.encodingRE=new RegExp("(?:)","g")),t}const Ve=Symbol("entityEncoder");class Xe extends pe{constructor(e,t){const s=ue(pe.DOCUMENT_FRAGMENT_NODE,Xe);return s[f]=_e.setupOptions(t),s[Ve]=new Fe(s[f].entities),s.innerHTML=e,s}get documentElement(){return this[c]||null}get innerHTML(){let e="";for(let t=0;t0)return t[0].textContent}return""}set title(e){const t=this.head;if(t){let s=t.getElementsByTagName("title");s=s.length<=0?t.appendChild(this.createElement("title")):s[0],s.textContent=e}}get body(){return this[h]||null}set body(e){e instanceof pe&&e.nodeType===pe.ELEMENT_NODE&&("BODY"===e.tagName||"FRAMESET"===e.tagName)&&e!==this[h]&&this[c]&&(this[h]?this[h].parentNode.replaceChild(e,this[h]):this[c].appendChild(e))}get entityEncoder(){return this[Ve]}createElement(e){if(e&&"string"==typeof e){const t=function(e){if("canvas"===e.toLowerCase())return function(e){const t=new We;switch(t[d]=e,t.nodeValue=null,t[u]=null,t[p]=null,e){case pe.ELEMENT_NODE:t[N]=null,t.attributes={};case pe.DOCUMENT_NODE:case pe.DOCUMENT_FRAGMENT_NODE:t.childNodes=[]}return t}(pe.ELEMENT_NODE);return ue(pe.ELEMENT_NODE)}(e);return t[N]=e.toUpperCase(),t}}createTextNode(e){return ze(pe.TEXT_NODE,e)}createComment(e){return ze(pe.COMMENT_NODE,e)}createCDATASection(e){return ze(pe.CDATA_SECTION_NODE,e,"]]>")}createProcessingInstruction(e,t){e:if(e&&"string"==typeof e){if(!_e.isNameCharStart(e[0]))break e;for(let t=1;t");return s.target=e,s}throw new Error("Invalid target name "+JSON.stringify(e)+".")}createDocumentType(e,t,s){return qe(ue(pe.DOCUMENT_TYPE_NODE),e,t,s)}getElementsByName(e){const t=[];return e&&"string"==typeof e&&this.forEach((s=>{s.attributes&&s.attributes.name===e&&t.push(s)})),t}}function ze(e,t,s=!1){const i=ue(e);if(i.nodeValue="",t&&"string"==typeof t){if(s&&"string"==typeof s&&-1!==t.indexOf(s))throw new Error("The data provided ('"+t+"') contains '"+s+"'.");i.nodeValue+=t}return i}function qe(e,t,s,i){return t&&"string"==typeof t?(e.name=t.toLowerCase(),e.publicId=s&&"string"==typeof s?s:"",e.systemId=i&&"string"==typeof i?i:""):e.name=e.publicId=e.systemId="",e}Xe.Node=pe,Xe.EntityEncoder=Fe;export{Xe as default}; diff --git a/lib/fauxdom-with-canvas.tests.cjs b/lib/fauxdom-with-canvas.tests.cjs new file mode 100644 index 0000000..0e38fe9 --- /dev/null +++ b/lib/fauxdom-with-canvas.tests.cjs @@ -0,0 +1,3399 @@ +'use strict'; + +const reCache = {}, + whitespaces = {}, + isWhiteSpace = Object.prototype.hasOwnProperty.bind( whitespaces ), + EOF = null; + +class Lexer +{ + constructor( str ) + { + this.index = 0; + this.str = str; + this.scanChar = this.str[this.index]; + + if ( !isWhiteSpace( "\x20" ) ) + { + // Unicode C0 & C1 control characters are treated as whitespace, along with the ASCII space character. + for ( let i = 0; i <= 0x20; i++ ) + whitespaces[String.fromCharCode( i )] = null; + for ( let i = 0x80; i <= 0x9f; i++ ) + whitespaces[String.fromCharCode( i )] = null; + } + } + + isWhiteSpace( theChar ) + { + return (theChar !== EOF && isWhiteSpace( theChar )); + } + + goToString( toChar, caseSensitive ) + { + if ( caseSensitive !== false ) + this.index = this.str.indexOf( toChar, this.index ); + else + { + if ( !reCache[toChar] ) + reCache[toChar] = new RegExp( toChar, "ig" ); + + reCache[toChar].lastIndex = this.index; + + const match = reCache[toChar].exec( this.str ); + if ( match ) this.index = match.index; + else this.index = -1; + } + + if ( this.index > -1 ) + this.scanChar = this.str[this.index]; + else + { + this.index = this.str.length; + this.scanChar = EOF; + } + } + + goToIndex( index ) + { + this.scanChar = this.str[this.index = index]; + } + + advance( amount ) + { + this.index += amount; + if ( this.index > this.str.length ) + { + this.index = this.str.length; + return (this.scanChar = EOF); + } + return (this.scanChar = this.str[this.index]); + } + + match( str, caseSensitive ) + { + var chunk = this.str.substr( this.index, str.length ); + if ( caseSensitive === false ) + { + str = str.toLowerCase(); + chunk = chunk.toLowerCase(); + } + if ( chunk === str ) + { + this.index += str.length-1; + this.getNextChar(); + return true; + } + return false; + } + + peek() + { + return this.str[this.index + 1]; + } + + getChar() + { + return this.scanChar; + } + + getNextChar() + { + if ( this.index + 1 < this.str.length ) + return (this.scanChar = this.str[++this.index]); + else + { + this.index = this.str.length; + return (this.scanChar = EOF); + } + } + + getNextAfterWhiteSpace() + { + var theChar; + do theChar = this.getNextChar(); + while ( theChar !== EOF && isWhiteSpace( theChar ) ) + return theChar; + } + + skipWhiteSpace() + { + var theChar = this.scanChar; + + while ( theChar !== EOF && isWhiteSpace( theChar ) ) + theChar = this.getNextChar(); + + return this.scanChar; + } +} + +// Implementation of the HTML EventTarget API +// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget +const EVENT_LISTENERS = Symbol("event-listeners"); + +class EventTarget { + addEventListener( eventType, callback, useCaptureOrOptions ) + { + // Lazily create the event listener map on the node + this[EVENT_LISTENERS] = this[EVENT_LISTENERS] ?? new Map(); + + // Registered listeners for this eventType + let listeners = this[EVENT_LISTENERS].get(eventType); + if (!listeners) { + listeners = []; + this[EVENT_LISTENERS].set(eventType, listeners); + } + + // Capturing and non-capturing listeners need to be removed separately + // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#sect1 + // TODO: handle other options? (once, passive, signal) + // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options + listeners.push({ + callback, + capturing: useCaptureOrOptions === true || !!useCaptureOrOptions?.capture, + options: typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions : { capture: !!useCaptureOrOptions } + }); + } + + removeEventListener( eventType, callback, useCaptureOrOptions ) + { + // There aren't any listeners registered + if (!this[EVENT_LISTENERS]) return; + + // Registered listeners for this eventType + let listeners = this[EVENT_LISTENERS].get(eventType); + if (!listeners) return; + + // Extract the boolean capture value from the different possible argument formats + const captureSetting = !!(typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions.capture : useCaptureOrOptions); + + // Find the indexes of listeners we want to remove, then remove them from the listeners array + // A listener must match the callback object (function) and capture setting (true/false) + // We remove the elements in reverse index order to avoid the indexes changing + listeners.map((listener, i) => { + return listener.callback === callback && listener.capturing === captureSetting ? i : undefined + }) + .reverse() + .forEach(i => { + if (i !== undefined) listeners.splice(i, 1); + }); + } + + dispatchEvent( event ) + { + let notCancelled = true; + + // There aren't any listeners registered + if (!this[EVENT_LISTENERS]) return notCancelled; + + // List active listeners + const listeners = this[EVENT_LISTENERS].get(event.type) ?? []; + + // Dispatch the event for every listener + // TODO: handle 'once', 'passive' options, bubbling & capture + // https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase + listeners?.forEach(({ callback }) => { + callback(event); + + // The event has been canceled through preventDefault() + if (event.defaultPrevented) notCancelled = false; + }); + + return notCancelled; + } + +} + +const DOCTYPE = Symbol( "doctype" ), + HEAD = Symbol( "head" ), + BODY = Symbol( "body" ), + DOCUMENT_ELEMENT = Symbol( "documentElement" ), + NODE_TYPE = Symbol( "nodeType" ), + PARENT_NODE = Symbol( "parentNode" ), + OWNER = Symbol( "ownerDocument" ), + TAG_NAME = Symbol( "tagName" ), + PARSER_OPTIONS = Symbol( "parserOptions" ), + + spacesRE = /\s+/g, + + nodeTypes = { + ELEMENT_NODE: 1, + //ATTRIBUTE_NODE: 2, // Unused + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + //ENTITY_REFERENCE_NODE: 5, // Unused, historical + //ENTITY_NODE: 6, // Unused, historical + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + //NOTATION_NODE: 12 // Unused, historical + }, + + selfClosingTags = { + "AREA": true, + "BASE": true, + "BR": true, + "COL": true, + "COMMAND": true, + "EMBED": true, + "HR": true, + "IMG": true, + "INPUT": true, + "KEYGEN": true, + "LINK": true, + "META": true, + "PARAM": true, + "SOURCE": true, + "TRACK": true, + "WBR": true + }; + +function setupDocument( document ) +{ + var firstElementPosition = -1, + documentElementPosition = -1, + documentTagName = "HTML"; + + if ( document[DOCTYPE] && document[PARSER_OPTIONS].allowCustomRootElement ) + documentTagName = document[DOCTYPE].name.toUpperCase(); + + for ( let i = 0, l = document.childNodes.length; i < l; i++ ) + if ( document.childNodes[i].tagName === documentTagName ) + { + documentElementPosition = i; + + document[NODE_TYPE] = nodeTypes.DOCUMENT_NODE; + document[DOCUMENT_ELEMENT] = document.childNodes[i]; + document[HEAD] = document[BODY] = null; + for ( let k = 0; k < document[DOCUMENT_ELEMENT].childNodes.length; k++ ) + { + const node = document[DOCUMENT_ELEMENT].childNodes[k]; + + switch ( node.tagName ) + { + case "HEAD": document[HEAD] = node; break; + + case "BODY": + case "FRAMESET": + document[BODY] = node; break; + } + + if ( document[HEAD] && document[BODY] ) break; + } + + if ( firstElementPosition !== -1 ) + { + const newParent = document[HEAD] || document[BODY] || document[DOCUMENT_ELEMENT], + count = documentElementPosition - firstElementPosition; + for ( let k = firstElementPosition; k < documentElementPosition; k++ ) + setNodeParent( document.childNodes[k], newParent ); + newParent.childNodes.splice( 0, 0, ...document.childNodes.splice( firstElementPosition, count ) ); + documentElementPosition -= count; + l -= count; + } + + if ( documentElementPosition < l - 1 ) + { + const newParent = document[BODY] || document[HEAD] || document[DOCUMENT_ELEMENT]; + for ( let k = documentElementPosition + 1; k < l; k++ ) + setNodeParent( document.childNodes[k], newParent ); + newParent.childNodes.splice( newParent.childNodes.length, 0, ...document.childNodes.splice( documentElementPosition + 1 ) ); + } + + break; + } + else if ( firstElementPosition === -1 && document.childNodes[i].nodeType === nodeTypes.ELEMENT_NODE ) + firstElementPosition = i; +} + +function getDocument( node ) +{ + const owner = node[OWNER] || node.getRootNode(); + if ( owner[NODE_TYPE] === nodeTypes.DOCUMENT_NODE || owner[NODE_TYPE] === nodeTypes.DOCUMENT_FRAGMENT_NODE ) + return owner; + return null; +} + +function detachNodes( nodes ) +{ + if ( nodes && nodes.length > 0 ) for ( let i = 0; i < nodes.length; i++ ) + setNodeParent( nodes[i], null ); +} + +function setNodeParent( node, parent ) +{ + const owner = (parent !== null ? getDocument( parent ) : null); + + if ( node[OWNER] !== owner && node.hasChildNodes() ) + node.forEach( node => {node[OWNER] = owner;}, null ); + + node[PARENT_NODE] = parent; + node[OWNER] = owner; +} + +function globalizeRegExp( re ) +{ + if ( !re.global ) + { + let flags = re.flags; + re = new RegExp( re.source, flags +"g" ); + } + return re; +} + +const ELEMENT$1 = Symbol( "element" ), + LENGTH = Symbol( "length" ), + + validClassTokenRE = /^\S+$/, + + indexOf = Array.prototype.indexOf, + join = Array.prototype.join, + splice = Array.prototype.splice; + +function createTokenList( elem ) +{ + const list = Object.create( DOMTokenList.prototype ); + + list[LENGTH] = 0; + list[ELEMENT$1] = elem; + const className = elem.className; + if ( className ) list.value = className; + + return list; +} + +class DOMTokenList +{ + constructor() + { + throw new Error( "Cannot directly instantiate DOMTokenList." ); + } + + get length() {return this[LENGTH]} + set length( val ) {} + + get value() + { + return join.call( this, " " ); + } + set value( val ) + { + if ( this[LENGTH] > 0 ) + for ( let k in this ) if ( this.hasOwnProperty( k ) && isFinite( k ) ) + delete this[k]; + this[LENGTH] = 0; + + if ( typeof val === "string" ) + this.add.apply( this, val.split( spacesRE ) ); + else delete this[ELEMENT$1].attributes.class; + } + + add() + { + for ( let i = 0; i < arguments.length; i++ ) + if ( indexOf.call( this, arguments[i] ) === -1 && this.supports( arguments[i] ) ) + this[this[LENGTH]++] = arguments[i]; + this[ELEMENT$1].attributes.class = this.value; + } + + remove() + { + for ( let i = 0, idx; i < arguments.length; i++ ) + { + idx = indexOf.call( this, arguments[i] ); + if ( idx !== -1 ) + { + splice.call( this, idx, 1 ); + this[LENGTH]--; + } + } + this[ELEMENT$1].attributes.class = this.value; + } + + item( v ) + { + if ( typeof v === "number" && v >= 0 && v < this[LENGTH] ) + return this[v]; + } + + toggle( token, force ) + { + var exists = false; + if ( this.supports( token ) ) + { + let idx = indexOf.call( this, token ); + if ( idx !== -1 && force !== true ) + { + splice.call( this, idx, 1 ); + this[LENGTH]--; + } + else if ( force !== false ) + { + exists = true; + if ( idx === -1 ) + this[this[LENGTH]++] = token; + } + this[ELEMENT$1].attributes.class = this.value; + } + return exists; + } + + contains( token ) + { + return (indexOf.call( this, token ) !== -1); + } + + replace( token, newToken ) + { + var idx = indexOf.call( this, token ); + if ( idx >= 0 && this.supports( newToken ) ) + { + if ( indexOf.call( this, newToken ) === -1 ) + this[idx] = newToken; + else + { + splice.call( this, idx, 1 ); + this[LENGTH]--; + } + this[ELEMENT$1].attributes.class = this.value; + return true; + } + return false; + } + + supports( token ) + { + if ( token && typeof token === "string" ) + return token.match( validClassTokenRE ); + return false; + } +} + +// HTML "style" inline CSS property handling +// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style + +// style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; border-bottom-color: hotpink; -moz-animation-iteration-count: 1" +const ELEMENT = Symbol( "element" ); +// Note: dom2prop(dom2prop('camelCaseProp')) will work as expected so it's always safe +// to use dom2prop to canonicalize property names in their kebab case (dashed) form +function dom2prop(cssStyleDeclarationPropertyName) { + return cssStyleDeclarationPropertyName.replace(/[A-Z]/g, (r) => '-'+r.toLowerCase()); +} +// In theory a valid CSS property (identifier) is more permissive, but in practice this covers all property names in use +function valid(propertyName) { + if (typeof propertyName !== 'string') return false; + // Valid css property name + if (propertyName.match(/^\-?[a-z_-]*[a-z]$/)) return true; + // Valid custom property + if (propertyName.match(/^\-\-[A-Za-z_-]*[A-Za-z0-9]$/)) return true; + // Valid DOM-style (camel case) property + if (propertyName.match(/^[a-zA-Z]+$/)) return true; + + return false; +} + +// Parses a style="" attribute into a map of property-value pairs for easier alterations +function styleToMap(styleString = "") { + return new Map(styleString.split(/\s*;\s*/g).filter(s => s.length).map(sd => sd.trim().match(/^([a-z-]+)\s*:\s*(.*)$/).slice(1))); +} + +// Stringifies a map of property-value pairs back into a style="" inline style attribute value +function mapToStyle(styleMap) { + return Array.from(styleMap?.entries() ?? []).map(e => e.join(': ')).join('; '); +} + +function createInlineStyle( elem ) +{ + const styleObject = { + [ELEMENT]: elem + }; + + const styleProxy = new Proxy(styleObject, { + get(target, name) { + if (name === ELEMENT) return elem; + if (!valid(name)) return undefined; + + const prop = dom2prop(name); + + return styleToMap(elem.attributes.style).get(prop); + }, + set(target, name, value) { + // Fail silently (return truthy value to avoid showing an TypeError) + if (!valid(name)) return true; + + const prop = dom2prop(name); + const map = styleToMap(elem.attributes.style); + + elem.attributes.style = mapToStyle(map.set(prop, value)); + return true; + }, + deleteProperty(target, name) { + if (!valid(name)) return; + + const prop = dom2prop(name); + const map = styleToMap(elem.attributes.style); + + elem.attributes.style = mapToStyle(map.delete(prop)); + }, + }); + + return styleProxy; +} + +function updateInlineStyle( style, value ) +{ + // Parse and re-stringify value to validate format + const styleValue = mapToStyle(styleToMap(value)); + + style[ELEMENT].attributes.style = styleValue; +} + +const newLinesRE = /\r\n|\r|\f/g, + anbSyntaxRE = /\(\s*(even|odd|(?:(?:([+-]?\d*)n)\s*(?:([+-])\s*(\d+))?|([+-]?\d+)))\s*/g; + +const ParamTypes = { + Selectors: 0, + Identifier: 1, + Iterator: 2, + IteratorOf: 3 +}; + +const paramExpectations = { + "is": ParamTypes.Selectors, + "not": ParamTypes.Selectors, + "where": ParamTypes.Selectors, // Alias of :is() + "has": ParamTypes.Selectors, + + "lang": ParamTypes.Identifier, // Not implementing + "dir": ParamTypes.Identifier, // Not implementing + + "nth-child": ParamTypes.IteratorOf, + "nth-last-child": ParamTypes.IteratorOf, + + "nth-of-type": ParamTypes.Iterator, + "nth-last-of-type": ParamTypes.Iterator, + "nth-col": ParamTypes.Iterator, // Not implementing + "nth-last-col": ParamTypes.Iterator, // Not implementing +}; + +// https://drafts.csswg.org/selectors-4/ + +function parseSelector( selector ) +{ + return parseSelectorList( new Lexer( selector.replace( newLinesRE, "\n" ) ) ); +} + +function parseSelectorList( lexer, terminator = EOF, relative = false ) +{ + var theChar = lexer.skipWhiteSpace(), + selector = {}, + compound = [], + complex = [compound], + ast = [complex]; + + while ( theChar !== EOF && theChar !== terminator ) + { + switch ( theChar ) + { + case "*": // https://drafts.csswg.org/selectors-4/#universal-selector + if ( compound.length > 0 ) + throw syntaxError( "Universal selectors must come before all other simple selectors.", lexer ); + selector.type = "universal"; + compound.push( selector ); + selector = {}; + break; + + case "#": + case ".": + { + lexer.getNextChar(); + const name = parseIdentifier( lexer ); + if ( !name ) throw syntaxError( "Expected an identifier.", lexer ); + + selector.type = (theChar === "#" ? "id" : "class"); + selector.name = name; + + compound.push( selector ); + selector = {}; + break; + } + case "[": // https://drafts.csswg.org/selectors-4/#attribute-selectors + { + lexer.getNextAfterWhiteSpace(); + const name = parseIdentifier( lexer ); + if ( !name ) throw syntaxError( "Expected an identifier.", lexer ); + + selector.type = "attr"; + selector.name = name; + selector.comparison = "="; + selector.value = true; + selector.ignoreCase = false; + + if ( (theChar = lexer.getNextAfterWhiteSpace()) !== "]" ) + { + switch ( theChar ) + { + case "=": break; + + case "~": + case "|": + case "^": + case "$": + case "*": + if ( lexer.peek() !== "=" ) throw syntaxError( "Expected '='.", lexer, 1 ); + selector.comparison = theChar + selector.comparison; + lexer.getNextChar(); + break; + + default: throw syntaxError( "Unexpected character '"+ (theChar === EOF ? "END_OF_INPUT" : theChar) +"'.", lexer ); + } + + theChar = lexer.getNextAfterWhiteSpace(); + if ( theChar === "'" || theChar === '"' ) + { + // https://drafts.csswg.org/css-syntax-3/#consume-string-token + const quote = theChar; + + selector.value = ""; + theChar = lexer.getNextChar(); + + while ( theChar !== EOF && theChar !== quote && theChar !== "\n" ) + { + if ( theChar === "\\" ) + { + selector.value += parseEscapedCodePoint( lexer ); + theChar = lexer.getChar(); + } + else + { + selector.value += theChar; + theChar = lexer.getNextChar(); + } + } + } + else + { + const name = parseIdentifier( lexer ); + if ( !name ) throw syntaxError( "Expected an identifier.", lexer ); + selector.value = name; + } + + if ( lexer.getNextAfterWhiteSpace() !== "]" ) + { + const ident = parseIdentifier( lexer ); + if ( ident === "i" || ident === "I" ) + selector.ignoreCase = true; + else if ( ident === "s" || ident === "S" ) + selector.ignoreCase = false; + else if ( ident ) + throw syntaxError( "Unexpected identifier '"+ ident +"'.", lexer, -ident.length + 1 ); + + if ( lexer.getNextAfterWhiteSpace() !== "]" ) + throw syntaxError( "Expected ']'.", lexer, -1 + ident.length ); + } + } + + compound.push( selector ); + selector = {}; + break; + } + case ":": + { + lexer.getNextChar(); + if ( lexer.match( ":" ) ) // https://drafts.csswg.org/selectors-4/#pseudo-elements + { + const name = parseIdentifier( lexer ); + if ( !name ) throw syntaxError( "Expected a pseudo-element name.", lexer ); + + selector.type = "pseudo-element"; + selector.name = name; + } + else // https://drafts.csswg.org/selectors-4/#pseudo-classes + { + const name = parseIdentifier( lexer ); + if ( !name ) throw syntaxError( "Expected a pseudo-class name.", lexer ); + + selector.type = "pseudo-class"; + selector.name = name; + + const paramType = paramExpectations[name]; + if ( paramType != null ) + { + selector.type = "pseudo-fn"; + + if ( lexer.getNextChar() !== "(" ) + throw syntaxError( "Expected '('.", lexer ); + + switch ( paramType ) + { + case ParamTypes.IteratorOf: // https://drafts.csswg.org/selectors-4/#nth-child-pseudo + case ParamTypes.Iterator: // https://drafts.csswg.org/css-syntax-3/#anb-microsyntax + let A = 0, B = 0, ofSelector; + + anbSyntaxRE.lastIndex = lexer.index; + const match = anbSyntaxRE.exec( lexer.str ); + if ( !match ) throw syntaxError( "Invalid parameter.", lexer, 1 ); + lexer.advance( match[0].length ); + + if ( paramType === ParamTypes.IteratorOf ) + { + lexer.skipWhiteSpace(); + const savedIdx = lexer.index; + if ( parseIdentifier( lexer ).toLowerCase() === "of" ) + { + const chr = lexer.getNextChar(); + if ( chr !== ")" && !lexer.isWhiteSpace( chr ) ) + throw syntaxError( "Expected whitespace.", lexer ); + + ofSelector = parseSelectorList( lexer, ")" ); + if ( !(ofSelector instanceof Array) || ofSelector.length === 0 ) + throw syntaxError( "Expected at least one selector.", lexer ); + } + else lexer.goToIndex( savedIdx ); + } + + if ( lexer.skipWhiteSpace() !== ")" ) + throw syntaxError( "Expected ')'.", lexer ); + + if ( match[1] === "even" || match[1] === "odd" ) + { + A = 2; + if ( match[1] === "odd" ) B = 1; + } + else if ( match[5] ) // We found just an integer. + B = parseInt( match[5], 10 ); + else + { + if ( match[2] === "-" ) A = -1; + else if ( !match[2] || match[2] === "+" ) A = 1; + else A = parseInt( match[2], 10 ); + + if ( match[3] ) + B = parseInt( match[3] + match[4], 10 ); + } + + selector.params = [A, B]; + if ( ofSelector ) selector.params.push( ofSelector ); + break; + + case ParamTypes.Selectors: + lexer.getNextChar(); + selector.params = parseSelectorList( lexer, ")", true ); + if ( selector.params.length === 0 ) + throw syntaxError( "Expected at least one selector.", lexer ); + break; + + case ParamTypes.Identifier: + if ( isIdentifierStart( lexer.getNextAfterWhiteSpace() ) ) + selector.params = [parseIdentifier( lexer )]; + else throw syntaxError( "Expected an identifier.", lexer ); + lexer.getNextChar(); + break; + } + if ( lexer.skipWhiteSpace() !== ")" ) throw syntaxError( "Expected ')'.", lexer ); + } + // Having this branch here allows custom functional pseudo-classes with + // these names to be defined by the user. + else if ( name === "before" || name === "after" || name === "first-line" || name === "first-letter" ) + selector.type = "pseudo-element"; + } + + compound.push( selector ); + selector = {}; + break; + } + + // https://drafts.csswg.org/selectors-4/#combinators + case "+": + case ">": + case "~": + if ( compound.length === 0 ) + { + if ( complex.length === 1 ) + { + if ( relative ) + complex.unshift( [{type: "pseudo-class", name: "scope"}] ); + else throw syntaxError( "Absolute selectors cannot start with a combinator.", lexer ); + } + else if ( typeof complex[complex.length - 2] === "string" ) + throw syntaxError( "Cannot have multiple combinators in a row.", lexer ); + complex.splice( complex.length - 1, 0, theChar ); + } + else complex.push( theChar, compound = [] ); + break; + + case ",": + if ( compound.length === 0 ) + { + if ( complex.length > 1 ) + { + complex.pop(); + if ( typeof complex[complex.length - 1] === "string" ) + throw syntaxError( "Complex selectors are not allowed to end with a combinator.", lexer, -1 ); + ast.push( complex = [compound] ); + } + } + else ast.push( complex = [compound = []] ); + lexer.skipWhiteSpace(); + break; + + default: + if ( lexer.isWhiteSpace( theChar ) ) + { + if ( compound.length > 0 ) + complex.push( compound = [] ); + lexer.skipWhiteSpace(); + lexer.advance( -1 ); + } + else if ( isIdentifierStart( theChar ) ) + { + if ( compound.length > 0 ) + throw syntaxError( "Type (tag name) selectors must come before all other simple selectors.", lexer ); + + selector.type = "type"; + // We'll always have a valid identifier here, thanks to + // the isIdentifierStart() above. + selector.name = parseIdentifier( lexer ).toUpperCase(); + + compound.push( selector ); + selector = {}; + } + else throw syntaxError( "Unexpected character '"+ theChar +"'.", lexer ); + } + theChar = lexer.getNextChar(); + } + + if ( compound.length === 0 ) + { + if ( complex.length === 1 ) + { + ast.pop(); + complex = ast[ast.length - 1]; + } + else complex.pop(); + } + + if ( complex && typeof complex[complex.length - 1] === "string" ) + throw syntaxError( "Complex selectors are not allowed to end with a combinator.", lexer, -1 ); + + return ast; +} + +function syntaxError( message, lexer, offset = 0 ) +{ + var error = new SyntaxError( message ), + column = lexer.index + offset; + error.stack = "SyntaxError: "+ message +"\n\n"+ lexer.str +"\n"+ " ".repeat( column ) +"^\n at index "+ column; + return error; +} + +// https://drafts.csswg.org/css-syntax-3/#consume-name +function parseIdentifier( lexer ) +{ + var name = "", + theChar = lexer.getChar(); + + if ( isIdentifierStart( theChar ) ) + { + do + { + if ( theChar === "\\" ) + { + name += parseEscapedCodePoint( lexer ); + theChar = lexer.getChar(); + } + else + { + name += theChar; + theChar = lexer.getNextChar(); + } + } + while ( theChar !== EOF && (isIdentifierStart( theChar ) || (theChar >= "0" && theChar <= "9") || theChar === "-") ) + lexer.advance( -1 ); + } + + return name; +} + +// https://drafts.csswg.org/css-syntax-3/#consume-escaped-code-point +function parseEscapedCodePoint( lexer ) +{ + var theChar = lexer.getNextChar(); + + if ( isHexDigit( theChar ) ) + { + let codePoint = ""; + + for ( let i = 5; i >= 0 && isHexDigit( theChar ); i-- ) + { + codePoint += theChar; + theChar = lexer.getNextChar(); + } + + if ( lexer.isWhiteSpace( theChar ) ) + lexer.getNextChar(); + + codePoint = parseInt( codePoint, 16 ) | 0; + if ( codePoint === 0 || + (codePoint >= 0xD800 && codePoint <= 0xDFFF) || // Surrogate + codePoint > 0x10FFFF ) // Maximum allowed code point + return "\uFFFD"; + return String.fromCodePoint( codePoint ); + } + else if ( theChar === EOF ) return "\uFFFD"; + + lexer.getNextChar(); + return theChar; +} + +function isHexDigit( theChar ) +{ + return (theChar !== EOF && ((theChar >= "0" && theChar <= "9") || (theChar >= "A" && theChar <= "F") || (theChar >= "a" && theChar <= "f"))); +} + +function isIdentifierStart( theChar ) +{ + return ((theChar >= "A" && theChar <= "Z") || (theChar >= "a" && theChar <= "z") || theChar === "_" || theChar >= "\u0080" || theChar === "\\"); +} + +const STATE_INITIAL = 0, + STATE_DESCENDANT_COMBINATOR = 1, + STATE_CHILD_COMBINATOR = 2, + STATE_NEXT_SIBLING_COMBINATOR = 3, + STATE_SUBSEQUENT_SIBLING_COMBINATOR = 4, + + stateTransitions = { + ">": STATE_CHILD_COMBINATOR, + "+": STATE_NEXT_SIBLING_COMBINATOR, + "~": STATE_SUBSEQUENT_SIBLING_COMBINATOR + }, + + pseudoProcs = { + is( scope, node, selectors ) + { + return matchesSelectorList( scope, node, selectors ); + }, + not( scope, node, selectors ) + { + return !matchesSelectorList( scope, node, selectors ); + }, + has( scope, node, selectors ) + { + var has = false; + + for ( let i = 0; i < selectors.length; i++ ) + if ( selectors[i][0] instanceof Array && isRelativeSimpleSelector( selectors[i][0][0] ) ) + { + has = matchesSelectorList( node, node, selectors, true ); + break; + } + + if ( !has && node.childNodes.length > 0 ) node.forEach( elem => + { + if ( matchesSelectorList( node, elem, selectors ) ) + { + has = true; + return false; + } + } ); + + return has; + }, + + ["nth-child"]( scope, node, args ) + { + const parent = node[PARENT_NODE], + nodes = parent.childNodes, + iter = new ChildIterator( args[0], args[1] ); + for ( let i = 0; i < nodes.length; i++ ) + if ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE ) + { + if ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) ) + { + const iterMatch = iter.next(); + if ( nodes[i] === node ) + return iterMatch; + } + } + return false; + }, + ["nth-last-child"]( scope, node, args ) + { + const parent = node[PARENT_NODE], + nodes = parent.childNodes, + iter = new ChildIterator( args[0], args[1] ); + for ( let i = nodes.length - 1; i >= 0; i-- ) + if ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE ) + { + if ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) ) + { + const iterMatch = iter.next(); + if ( nodes[i] === node ) + return iterMatch; + } + } + return false; + }, + + ["nth-of-type"]( scope, node, args ) + { + const nodes = node[PARENT_NODE].childNodes, + iter = new ChildIterator( args[0], args[1] ), + tagName = node[TAG_NAME]; + for ( let i = 0; i < nodes.length; i++ ) + if ( nodes[i][TAG_NAME] === tagName ) + { + const iterMatch = iter.next(); + if ( nodes[i] === node ) + return iterMatch; + } + + // For code here to be reachable, 'node' would have to not be inside + // its own parent, or the above test of 'nodes[i] === node' would + // have to be skippable. Since neither of these scenarios is + // possible (for now), an explicit 'return false' here never + // executes and isn't needed. + }, + ["nth-last-of-type"]( scope, node, args ) + { + const nodes = node[PARENT_NODE].childNodes, + iter = new ChildIterator( args[0], args[1] ), + tagName = node[TAG_NAME]; + for ( let i = nodes.length - 1; i >= 0; i-- ) + if ( nodes[i][TAG_NAME] === tagName ) + { + const iterMatch = iter.next(); + if ( nodes[i] === node ) + return iterMatch; + } + + // For code here to be reachable, 'node' would have to not be inside + // its own parent, or the above test of 'nodes[i] === node' would + // have to be skippable. Since neither of these scenarios is + // possible (for now), an explicit 'return false' here never + // executes and isn't needed. + } + }, + pseudoClasses = { + scope( scope, node ) + { + return (node === scope); + }, + + enabled( scope, node ) + { + switch ( node[TAG_NAME] ) + { + case "BUTTON": + case "INPUT": + case "SELECT": + case "TEXTAREA": + case "OPTGROUP": + case "OPTION": + case "FIELDSET": + return !node.hasAttribute( "disabled" ); + } + return false; + }, + disabled( scope, node ) + { + switch ( node[TAG_NAME] ) + { + case "BUTTON": + case "INPUT": + case "SELECT": + case "TEXTAREA": + case "OPTGROUP": + case "OPTION": + case "FIELDSET": + return node.hasAttribute( "disabled" ); + } + return false; + }, + + checked( scope, node ) + { + if ( node[TAG_NAME] === "INPUT" ) + { + const type = node.getAttribute( "type" ); + if ( type === "checkbox" || type === "radio" ) + return node.hasAttribute( "checked" ); + } + else if ( node[TAG_NAME] === "OPTION" ) + return node.hasAttribute( "selected" ); + return false; + }, + + required( scope, node ) + { + switch ( node[TAG_NAME] ) + { + case "INPUT": + case "SELECT": + case "TEXTAREA": + return node.hasAttribute( "required" ); + } + return false; + }, + optional( scope, node ) + { + switch ( node[TAG_NAME] ) + { + case "INPUT": + case "SELECT": + case "TEXTAREA": + return !node.hasAttribute( "required" ); + } + return false; + }, + + root( scope, node ) + { + const document = getDocument( scope ); + return (!!document && document.documentElement === node); + }, + empty( scope, node ) + { + return (node.childNodes.length === 0); + }, + + ["first-child"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes; + for ( let i = 0; i < nodes.length; i++ ) + if ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE ) + return (nodes[i] === node); + + // For code here to be reachable, we would have to be looking at an + // ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes. + // Therefore, an explicit 'return false' here never executes and + // isn't needed. + }, + ["last-child"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes; + for ( let i = nodes.length - 1; i >= 0; i-- ) + if ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE ) + return (nodes[i] === node); + + // For code here to be reachable, we would have to be looking at an + // ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes. + // Therefore, an explicit 'return false' here never executes and + // isn't needed. + }, + ["only-child"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes; + let first, last; + for ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- ) + { + if ( !first && nodes[s][NODE_TYPE] === Node.ELEMENT_NODE ) + first = nodes[s]; + if ( !last && nodes[e][NODE_TYPE] === Node.ELEMENT_NODE ) + last = nodes[e]; + } + return (first === last && first === node); + }, + + ["first-of-type"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes, + tagName = node[TAG_NAME]; + for ( let i = 0; i < nodes.length; i++ ) + if ( nodes[i][TAG_NAME] === tagName ) + return (nodes[i] === node); + + // For code here to be reachable, we would have to be looking at an + // ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes. + // Therefore, an explicit 'return false' here never executes and + // isn't needed. + }, + ["last-of-type"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes, + tagName = node[TAG_NAME]; + for ( let i = nodes.length - 1; i >= 0; i-- ) + if ( nodes[i][TAG_NAME] === tagName ) + return (nodes[i] === node); + + // For code here to be reachable, we would have to be looking at an + // ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes. + // Therefore, an explicit 'return false' here never executes and + // isn't needed. + }, + ["only-of-type"]( scope, node ) + { + const nodes = node[PARENT_NODE].childNodes, + tagName = node[TAG_NAME]; + let first, last; + for ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- ) + { + if ( !first && nodes[s][TAG_NAME] === tagName ) + first = nodes[s]; + if ( !last && nodes[e][TAG_NAME] === tagName ) + last = nodes[e]; + } + return (first === last && first === node); + } + }; + +pseudoProcs.where = pseudoProcs.is; + +function querySelector( scope, selector, all ) +{ + const selectors = parseSelector( selector ), + result = []; + + scope.forEach( node => + { + if ( matchesSelectorList( scope, node, selectors ) ) + { + result.push( node ); + if ( !all ) return false; + } + } ); + + return (all ? result : (result[0] || null)); +} + +function closest( scope, selector ) +{ + const selectors = parseSelector( selector ); + let node = scope; + + while ( node != null && node[NODE_TYPE] === Node.ELEMENT_NODE ) + { + if ( matchesSelectorList( scope, node, selectors ) ) + return node; + node = node[PARENT_NODE]; + } + + return null; +} + +function matches( scope, selector ) +{ + return matchesSelectorList( scope, scope, parseSelector( selector ) ); +} + +function matchesSelectorList( scope, node, selectors, relative = false ) +{ + var currentNode; + +List: + for ( let i = 0; i < selectors.length; i++ ) + { + const complex = selectors[i]; + let state = STATE_INITIAL; + + if ( relative && complex[0] instanceof Array && !isRelativeSimpleSelector( complex[0][0] ) ) + continue; + + currentNode = node; + + Complex: + for ( let x = (relative ? 0 : complex.length - 1); + (relative ? x < complex.length : x >= 0); + (relative ? x++ : x--) ) + { + if ( stateTransitions.hasOwnProperty( complex[x] ) ) + state = stateTransitions[complex[x]]; + else switch ( state ) + { + case STATE_INITIAL: + if ( !matchesCompoundSelector( scope, currentNode, complex[x] ) ) + continue List; + state = STATE_DESCENDANT_COMBINATOR; + break; + + case STATE_DESCENDANT_COMBINATOR: + while ( currentNode = currentNode[PARENT_NODE] ) + if ( matchesCompoundSelector( scope, currentNode, complex[x] ) ) + continue Complex; + continue List; + + case STATE_CHILD_COMBINATOR: + currentNode = currentNode[PARENT_NODE]; + if ( !matchesCompoundSelector( scope, currentNode, complex[x] ) ) + continue List; + break; + + case STATE_NEXT_SIBLING_COMBINATOR: + { + const nodes = currentNode[PARENT_NODE].childNodes; + currentNode = nodes[nodes.indexOf( currentNode ) + (relative ? 1 : -1)]; + if ( !matchesCompoundSelector( scope, currentNode, complex[x] ) ) + continue List; + break; + } + case STATE_SUBSEQUENT_SIBLING_COMBINATOR: + { + const nodes = currentNode[PARENT_NODE].childNodes; + for ( let k = nodes.indexOf( currentNode ) + (relative ? 1 : -1); + (relative ? k < nodes.length : k >= 0); + (relative ? k++ : k--) ) + if ( matchesCompoundSelector( scope, nodes[k], complex[x] ) ) + { + currentNode = nodes[k]; + continue Complex; + } + continue List; + } + } + } + return true; + } + return false; +} + +function matchesCompoundSelector( scope, node, compound ) +{ + if ( !node || node[NODE_TYPE] !== Node.ELEMENT_NODE ) + return false; + for ( let i = 0; i < compound.length; i++ ) + { + const simple = compound[i]; + let matched; + + matched = false; + switch ( simple.type ) + { + case "universal": return true; + + case "type": matched = (node[TAG_NAME] === simple.name); break; + case "id": matched = (node.id === simple.name); break; + case "class": matched = node.classList.contains( simple.name ); break; + + case "attr": + if ( simple.comparison === "=" && (simple.value === true || simple.value === "") ) + matched = node.hasAttribute( simple.name ); + else + { + let attr = node.getAttribute( simple.name ); + if ( typeof attr === "string" ) + { + let value = (simple.ignoreCase ? simple.value.toLowerCase() : simple.value); + if ( simple.ignoreCase ) attr = attr.toLowerCase(); + if ( value !== "" ) switch ( simple.comparison ) + { + case "=": matched = (attr === value); break; + case "~=": matched = attr.split( spacesRE ).indexOf( value ) !== -1; break; + case "|=": matched = (attr === value || attr.startsWith( value +"-" )); break; + case "^=": matched = attr.startsWith( value ); break; + case "$=": matched = attr.endsWith( value ); break; + case "*=": matched = attr.indexOf( value ) !== -1; break; + } + } + } + break; + + case "pseudo-element": break; + + case "pseudo-class": + if ( pseudoClasses.hasOwnProperty( simple.name ) ) + matched = !!pseudoClasses[simple.name].call( null, scope, node ); + break; + + case "pseudo-fn": + if ( pseudoProcs.hasOwnProperty( simple.name ) ) + matched = !!pseudoProcs[simple.name].call( null, scope, node, simple.params ); + break; + } + + if ( !matched ) return false; + } + return true; +} + +function isRelativeSimpleSelector( simple ) +{ + return (!!simple && simple.type === "pseudo-class" && simple.name === "scope"); +} + +class ChildIterator +{ + constructor( A, B ) + { + this.A = parseInt( A, 10 ) | 0; + this.B = parseInt( B, 10 ) | 0; + this.current = 0; + } + + next() + { + if ( this.A === 0 && this.B === 0 ) + return false; + + this.current += 1; + + let match = false; + if ( this.A === 0 ) + match = (this.current === this.B); + else if ( (this.A < 0 && this.B >= this.current) || (this.A > 0 && this.current >= this.B) ) + match = (((this.current + this.B) % this.A) === 0); + + return match; + } +} + +function serializeNode( elem ) +{ + var tagName = elem.tagName, + owner = getDocument( elem ), + entities = owner ? owner.entityEncoder : null, + html = ""; + switch ( elem.nodeType ) + { + case nodeTypes.ELEMENT_NODE: + tagName = tagName.toLowerCase(); + html += "<"+ tagName; + for ( let k in elem.attributes ) + if ( elem.attributes.hasOwnProperty( k ) ) + { + let attr = elem.attributes[k]; + if ( attr === true ) + attr = ""; + else if ( entities && owner[PARSER_OPTIONS] ) + attr = encodeEntities( attr, entities, owner[PARSER_OPTIONS] ); + + html += " "+ k; + if ( attr !== "" ) + html += '="'+ attr +'"'; + } + html += ">"; + + for ( let i = 0; i < elem.childNodes.length; i++ ) + html += serializeNode( elem.childNodes[i] ); + + if ( selfClosingTags[elem.tagName] !== true ) + html += ""; + break; + + case nodeTypes.TEXT_NODE: + if ( entities && owner[PARSER_OPTIONS] && + (!elem.parentNode || (elem.parentNode.tagName !== "SCRIPT" && elem.parentNode.tagName !== "STYLE")) ) + html += encodeEntities( elem.nodeValue, entities, owner[PARSER_OPTIONS] ); + else html += elem.nodeValue; + break; + + case nodeTypes.CDATA_SECTION_NODE: + html += ""; + break; + + case nodeTypes.PROCESSING_INSTRUCTION_NODE: + html += ""; + break; + + case nodeTypes.COMMENT_NODE: + html += ""; + break; + + case nodeTypes.DOCUMENT_TYPE_NODE: + html += ""; + break; + } + return html; +} + +function encodeEntities( text, entities, options ) +{ + if ( options.encodeEntities === false ) + return text; + else if ( options.encodeEntities === true || !(options.encodeEntities instanceof RegExp) ) + return entities.encode( text ); + return entities.encode( text, options.encodeEntities ); +} + +const CLASS_LIST = Symbol( "classList" ); +const INLINE_STYLE = Symbol( "style" ); + +const EXTEND_NODE = Symbol( "extendNode" ); + +function createNode( nodeType, baseClass = Node ) +{ + const node = Object.create( baseClass.prototype ); + + node[NODE_TYPE] = nodeType; + node.nodeValue = null; + node[PARENT_NODE] = null; + node[OWNER] = null; + + switch ( nodeType ) + { + case Node.ELEMENT_NODE: + node[TAG_NAME] = null; + node.attributes = {}; + // fallthrough + + case Node.DOCUMENT_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + node.childNodes = []; + } + + return node; +} + +class Node extends EventTarget +{ + constructor() + { + super(); + + // We allow `extend`-ing `class`-es to call super(EXTEND_NODE) + if (arguments[0] === EXTEND_NODE) return; + + throw new Error( "Cannot directly instantiate Node." ); + } + + get nodeType() {return this[NODE_TYPE]} + + get nodeName() + { + switch ( this.nodeType ) + { + case Node.ELEMENT_NODE: return this.tagName; + case Node.TEXT_NODE: return "#text"; + case Node.CDATA_SECTION_NODE: return "#cdata-section"; + case Node.PROCESSING_INSTRUCTION_NODE: return this.target; + case Node.COMMENT_NODE: return "#comment"; + case Node.DOCUMENT_NODE: return "#document"; + case Node.DOCUMENT_TYPE_NODE: return this.name; + case Node.DOCUMENT_FRAGMENT_NODE: return "#document-fragment"; + } + } + + get parentNode() {return this[PARENT_NODE]} + get ownerDocument() {return this[OWNER]} + get tagName() {return this[TAG_NAME] || null} + + get firstChild() + { + if ( this.childNodes ) return this.childNodes[0] || null; + return null; + } + + get lastChild() + { + if ( this.childNodes ) return this.childNodes[this.childNodes.length - 1] || null; + return null; + } + + get previousSibling() + { + const parent = this.parentNode; + if ( parent ) + { + const idx = parent.childNodes.indexOf( this ); + if ( idx > 0 ) return parent.childNodes[idx - 1]; + } + return null; + } + + get nextSibling() + { + const parent = this.parentNode; + if ( parent ) + { + const idx = parent.childNodes.indexOf( this ); + if ( idx > -1 && idx < parent.childNodes.length - 1 ) return parent.childNodes[idx + 1]; + } + return null; + } + + get id() + { + return (this.attributes && this.attributes.id) || ""; + } + set id( id ) + { + if ( this.attributes ) + this.attributes.id = id; + } + + get className() + { + return (this.attributes && this.attributes.class) || ""; + } + set className( val ) + { + if ( this.attributes ) + { + this.classList.value = val; + this.attributes.class = this[CLASS_LIST].value; + } + } + + get classList() + { + if ( this.attributes ) + { + if ( !this[CLASS_LIST] ) + this[CLASS_LIST] = createTokenList( this ); + return this[CLASS_LIST]; + } + return null; + } + + get innerHTML() + { + if ( this.nodeType === Node.ELEMENT_NODE ) + { + let html = ""; + for ( let i = 0; i < this.childNodes.length; i++ ) + html += serializeNode( this.childNodes[i] ); + return html; + } + return null; + } + set innerHTML( html ) + { + if ( this.nodeType === Node.ELEMENT_NODE && selfClosingTags[this.tagName] !== true ) + { + const nodes = parseHTML( this, html ); + if ( nodes ) + addChildNode( this, nodes, 0, this.childNodes.length ); + else + { + detachNodes( this.childNodes ); + this.childNodes.length = 0; + } + } + } + + get outerHTML() + { + return serializeNode( this ); + } + set outerHTML( html ) + { + if ( this.parentNode ) + { + const idx = this.parentNode.childNodes.indexOf( this ), + nodes = parseHTML( this, html ); + if ( nodes ) + addChildNode( this.parentNode, nodes, idx, 1 ); + else detachNodes( this.parentNode.childNodes.splice( idx, 1 ) ); + } + } + + get style() + { + if ( this.attributes ) + { + if ( !this[INLINE_STYLE] ) + this[INLINE_STYLE] = createInlineStyle( this ); + return this[INLINE_STYLE]; + } + return null; + } + set style( value ) + { + if ( this.attributes ) + { + if ( !this[INLINE_STYLE] ) + this[INLINE_STYLE] = createInlineStyle( this ); + + updateInlineStyle( this[INLINE_STYLE], value ); + } + } + + get textContent() + { + if ( this.childNodes ) + { + let text = ""; + for ( let i = 0; i < this.childNodes.length; i++ ) + { + if ( this.childNodes[i].nodeType !== Node.COMMENT_NODE && + this.childNodes[i].nodeType !== Node.CDATA_SECTION_NODE && + this.childNodes[i].nodeType !== Node.PROCESSING_INSTRUCTION_NODE ) + text += this.childNodes[i].textContent; + } + return text; + } + return this.nodeValue; + } + set textContent( text ) + { + if ( text == null ) + text = ""; + else if ( typeof text !== "string" ) + text += ""; + + if ( this.childNodes ) + { + let node = createNode( Node.TEXT_NODE ); + node.nodeValue = text; + setNodeParent( node, this ); + + detachNodes( this.childNodes ); + this.childNodes.length = 1; + this.childNodes[0] = node; + } + else if ( this.nodeType >= Node.TEXT_NODE && this.nodeType <= Node.COMMENT_NODE ) + this.nodeValue = text; + } + + getRootNode() + { + let rootNode = this; + while ( rootNode.parentNode ) + rootNode = rootNode.parentNode; + return rootNode; + } + + hasAttributes() + { + if ( this.attributes ) for ( let k in this.attributes ) + if ( this.attributes.hasOwnProperty( k ) ) return true; + return false; + } + + getAttributeNames() + { + if ( this.attributes ) + return Object.keys( this.attributes ); + return []; + } + + getAttribute( name ) + { + var result; + if ( this.attributes && name && typeof name === "string" ) + result = this.attributes[lowerAttributeCase( this, name )]; + if ( result === undefined ) + return null; + return result; + } + + setAttribute( name, value ) + { + if ( this.attributes && name && typeof name === "string" ) + { + name = lowerAttributeCase( this, name ); + if ( name === "class" ) + { + if ( value !== true ) + this.className = ""+ value; + else + { + this.classList.value = ""; + this.attributes[name] = true; + } + } + else if ( typeof value === "string" || value === true ) + this.attributes[name] = value; + else this.attributes[name] = ""+ value; + } + } + + toggleAttribute( name, force ) + { + if ( this.attributes && name && typeof name === "string" ) + { + name = lowerAttributeCase( this, name ); + if ( !this.attributes.hasOwnProperty( name ) ) + { + if ( arguments.length === 1 || force === true ) + return (this.attributes[name] = true); + return false; + } + else if ( arguments.length === 1 || force === false ) + { + delete this.attributes[name]; + return false; + } + return true; + } + } + + removeAttribute( name ) + { + if ( this.attributes && name && typeof name === "string" ) + { + name = lowerAttributeCase( this, name ); + if ( name === "class" && this[CLASS_LIST] ) + this[CLASS_LIST].value = null; + delete this.attributes[name]; + } + } + + hasAttribute( name ) + { + if ( this.attributes && name && typeof name === "string" ) + return this.attributes.hasOwnProperty( lowerAttributeCase( this, name ) ); + return false; + } + + hasChildNodes() + { + return (!!this.childNodes && this.childNodes.length > 0); + } + + appendChild( child ) + { + return this.insertBefore( child, null ); + } + + insertBefore( newChild, refChild ) + { + if ( this.childNodes && newChild instanceof Node && arguments.length > 1 ) + { + let idx = -1; + + if ( refChild == null ) + idx = this.childNodes.length; + else if ( refChild instanceof Node && refChild.parentNode === this ) + idx = this.childNodes.indexOf( refChild ); + + if ( idx !== -1 ) + return addChildNode( this, newChild, idx ); + } + return null; + } + + replaceChild( newChild, oldChild ) + { + if ( this.childNodes && oldChild instanceof Node && newChild instanceof Node && + oldChild.parentNode === this && oldChild !== newChild ) + { + addChildNode( this, newChild, this.childNodes.indexOf( oldChild ), 1 ); + return oldChild; + } + return null; + } + + removeChild( child ) + { + if ( this.childNodes && child instanceof Node && child.parentNode === this ) + { + const idx = this.childNodes.indexOf( child ), + owner = getDocument( this ); + + if ( owner && child.parentNode === owner.documentElement && tagNameProp.hasOwnProperty( child.tagName ) ) + owner[tagNameProp[child.tagName]] = null; + + detachNodes( this.childNodes.splice( idx, 1 ) ); + return child; + } + return null; + } + + cloneNode( deep ) + { + var clone; + + if ( this.nodeType === Node.DOCUMENT_NODE || this.nodeType === Node.DOCUMENT_FRAGMENT_NODE ) + clone = new DOM( null, this[PARSER_OPTIONS] ); + else clone = createNode( this.nodeType ); + + switch ( this.nodeType ) + { + case Node.ELEMENT_NODE: + clone[TAG_NAME] = this.tagName; + clone.attributes = Object.assign( clone.attributes, this.attributes ); + break; + + case Node.TEXT_NODE: + case Node.CDATA_SECTION_NODE: + case Node.PROCESSING_INSTRUCTION_NODE: + case Node.COMMENT_NODE: + clone.nodeValue = this.nodeValue; + break; + + case Node.DOCUMENT_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + clone[NODE_TYPE] = this.nodeType; + clone.entityEncoder.entities = this.entityEncoder; + break; + + case Node.DOCUMENT_TYPE_NODE: + clone.name = this.name; + clone.publicId = this.publicId; + clone.systemId = this.systemId; + break; + } + + if ( deep === true && this.childNodes && this.childNodes.length > 0 ) + { + for ( let i = 0; i < this.childNodes.length; i++ ) + clone.appendChild( this.childNodes[i].cloneNode( true ) ); + + if ( clone.nodeType === Node.DOCUMENT_NODE || clone.nodeType === Node.DOCUMENT_FRAGMENT_NODE ) + setupDocument( clone ); + } + + return clone; + } + + getElementById( id ) + { + var elem = null; + if ( id && typeof id === "string" && this.childNodes ) + this.forEach( node => + { + if ( node.id === id ) + { + elem = node; + return false; + } + } ); + return elem; + } + + getElementsByClassName( className ) + { + var nodeList = []; + if ( className && typeof className === "string" ) + { + const classList = className.trim().split( spacesRE ); + if ( classList.length > 1 || classList[0] !== "" ) this.forEach( node => + { + for ( let i = 0; i < classList.length; i++ ) + if ( !node.classList.contains( classList[i] ) ) + return; + nodeList.push( node ); + } ); + } + return nodeList; + } + + getElementsByTagName( tagName ) + { + var nodeList = []; + if ( tagName && typeof tagName === "string" ) + { + tagName = tagName.toUpperCase(); + this.forEach( node => + { + if ( tagName === "*" || node.tagName === tagName ) + nodeList.push( node ); + } ); + } + return nodeList; + } + + closest( selector ) + { + if ( selector && typeof selector === "string" ) + return closest( this, selector ); + else return null; + } + + matches( selector ) + { + if ( selector && typeof selector === "string" ) + return matches( this, selector ); + else return false; + } + + querySelector( selector ) + { + if ( selector && typeof selector === "string" ) + return querySelector( this, selector, false ); + else return null; + } + + querySelectorAll( selector ) + { + if ( selector && typeof selector === "string" ) + return querySelector( this, selector, true ); + else return []; + } + + // Non-standard + + forEach( callback, type = nodeTypes.ELEMENT_NODE ) + { + // This unrolled recursive function is about 1.45x faster in Node than its + // equivalent recursive form. + + let childNodes = this.childNodes, + current = this.firstChild, + idxStack = [], + idx = 0, + parent, nextSibling; + + while ( current ) + { + // 'parent' and 'nextSibling' are stored here so that if callback() changes + // the document, we can maintain our place in the overall list of nodes by + // looking for insertions, deletions, or replacements within the 'current' + // node's list of siblings. + parent = current[PARENT_NODE]; + nextSibling = childNodes[idx + 1]; + + if ( (type === null || current.nodeType === type) && + callback( current, parent ) === false ) + return; + + // If the parent of 'current' changes during callback(), we no longer want to + // look at the children of 'current' here as it was either moved or removed. + if ( current[PARENT_NODE] === parent && current.childNodes && current.childNodes.length > 0 ) + { + idxStack.push( idx ); + childNodes = current.childNodes; + current = childNodes[idx = 0]; + } + else + { + if ( nextSibling ) + { + idx += 1; + // If callback() changed the number of nodes that come before the + // previously found 'nextSibling', 'idx' needs to be updated so we + // don't skip over or repeat visits to any nodes. + if ( nextSibling !== childNodes[idx] ) + idx = parent.childNodes.indexOf( nextSibling ); + } + else idx = childNodes.length; + + while ( childNodes[idx] == null ) + { + current = parent; + parent = current[PARENT_NODE]; + if ( current && current !== this ) + { + childNodes = parent.childNodes; + idx = idxStack.pop() + 1; + } + else return; + } + current = childNodes[idx]; + } + } + } +} + +Object.defineProperties( Node, +{ + ELEMENT_NODE: {value: nodeTypes.ELEMENT_NODE}, + //ATTRIBUTE_NODE: {value: nodeTypes.ATTRIBUTE_NODE}, + TEXT_NODE: {value: nodeTypes.TEXT_NODE}, + CDATA_SECTION_NODE: {value: nodeTypes.CDATA_SECTION_NODE}, + //ENTITY_REFERENCE_NODE: {value: nodeTypes.ENTITY_REFERENCE_NODE}, + //ENTITY_NODE: {value: nodeTypes.ENTITY_NODE}, + PROCESSING_INSTRUCTION_NODE: {value: nodeTypes.PROCESSING_INSTRUCTION_NODE}, + COMMENT_NODE: {value: nodeTypes.COMMENT_NODE}, + DOCUMENT_NODE: {value: nodeTypes.DOCUMENT_NODE}, + DOCUMENT_TYPE_NODE: {value: nodeTypes.DOCUMENT_TYPE_NODE}, + DOCUMENT_FRAGMENT_NODE: {value: nodeTypes.DOCUMENT_FRAGMENT_NODE}, + //NOTATION_NODE: {value: nodeTypes.NOTATION_NODE}, +} ); + +const tagNameProp = { + HEAD, + BODY, + FRAMESET: BODY +}; + +function addChildNode( parent, node, index, removalCount = 0 ) +{ + if ( !parent || + (parent.nodeType !== Node.ELEMENT_NODE && + parent.nodeType !== Node.DOCUMENT_NODE && + parent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) || + (parent.nodeType === Node.ELEMENT_NODE && selfClosingTags[parent.tagName] === true) ) + return node; + + if ( node.nodeType <= Node.COMMENT_NODE ) + { + if ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE ) + { + if ( tagNameProp.hasOwnProperty( node.tagName ) ) + { + const prop = tagNameProp[node.tagName]; + if ( parent.parentNode[prop] && removalCount === 0 ) + return node; + parent.parentNode[prop] = node; + } + } + + if ( node.parentNode ) + node.parentNode.removeChild( node ); + setNodeParent( node, parent ); + detachNodes( parent.childNodes.splice( index, removalCount, node ) ); + } + else if ( node.nodeType === Node.DOCUMENT_TYPE_NODE && + (parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) ) + { + const owner = node.parentNode; + if ( owner && (owner.nodeType === Node.DOCUMENT_NODE || owner.nodeType === Node.DOCUMENT_FRAGMENT_NODE) ) + { + owner.removeChild( node ); + owner[DOCTYPE] = null; + } + setNodeParent( node, parent ); + detachNodes( parent.childNodes.splice( index, removalCount, node ) ); + parent[DOCTYPE] = node; + } + else if ( node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ) + { + if ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE ) + { + if ( removalCount > 0 ) + detachNodes( parent.childNodes.splice( index, removalCount ) ); + for ( let i = node.childNodes.length - 1; i >= 0; i-- ) + { + const child = node.childNodes[i]; + if ( tagNameProp.hasOwnProperty( child.tagName ) ) + { + const prop = tagNameProp[child.tagName]; + if ( parent.parentNode[prop] && removalCount === 0 ) + continue; + parent.parentNode[prop] = child; + } + setNodeParent( child, parent ); + parent.childNodes.splice( index, 0, child ); + node.childNodes.splice( i, 1 ); + } + } + else if ( node !== getDocument( parent ) ) + { + for ( let i = 0; i < node.childNodes.length; i++ ) + setNodeParent( node.childNodes[i], parent ); + detachNodes( parent.childNodes.splice( index, removalCount, ...node.childNodes ) ); + node.childNodes.length = 0; + } + } + + return node; +} + +function parseHTML( parent, html ) +{ + if ( html && typeof html === "string" ) + { + const owner = getDocument( parent ); + return new Parser( html, owner ? owner[PARSER_OPTIONS] : null, owner ? owner.entityEncoder : null ).parseHTML(); + } +} + +function lowerAttributeCase( node, name ) +{ + const owner = getDocument( node ); + if ( owner && owner[PARSER_OPTIONS].lowerAttributeCase ) + return name.toLowerCase(); + return name; +} + +const toLowerCase = String.prototype.toLowerCase, + toUpperCase = String.prototype.toUpperCase, + + defaultOptions = { + allowCustomRootElement: false, + allowSelfClosingSyntax: false, + allowCDATA: false, + allowProcessingInstructions: false, + decodeEntities: false, + encodeEntities: false, + collapseWhitespace: false, + trimWhitespace: false, + lowerAttributeCase: false + }, + + STATE_START_TAG = 0, + STATE_ATTRIBUTE = 1, + STATE_END_TAG = 2, + + // '12.1.2.3 Attributes' from HTML5 spec. + attributeNameExclusions = { + //"\0": true, // This is caught by the lexer in isWhiteSpace(). + //'"': true, // Disabled to better match browser behaviour. + //"'": true, // Disabled to better match browser behaviour. + ">": true, + "/": true, + "=": true + }, + + pTagBoundary = {P: true}, + definitionTagBoundary = {DT: true, DD: true}, + tableStructureTagBoundary = {TBODY: true, THEAD: true, TFOOT: true}, + tableCellTagBoundary = {TD: true, TH: true}, + formElementTagBoundary = {BUTTON: true, DATALIST: true, OPTGROUP: true, OPTION: true, PROGRESS: true, SELECT: true, TEXTAREA: true}, + + // Largely based on '8.1.2.4 Optional tags' from the HTML5 spec. + // https://www.w3.org/TR/html50/syntax.html#syntax-tag-omission + tagBoundaries = { + ADDRESS: pTagBoundary, + ARTICLE: pTagBoundary, + ASIDE: pTagBoundary, + BLOCKQUOTE: pTagBoundary, + DIV: pTagBoundary, + FIELDSET: pTagBoundary, + FOOTER: pTagBoundary, + H1: pTagBoundary, + H2: pTagBoundary, + H3: pTagBoundary, + H4: pTagBoundary, + H5: pTagBoundary, + H6: pTagBoundary, + HEADER: pTagBoundary, + HGROUP: pTagBoundary, + HR: pTagBoundary, + MAIN: pTagBoundary, + NAV: pTagBoundary, + P: pTagBoundary, + PRE: pTagBoundary, + SECTION: pTagBoundary, + + BODY: {HEAD: true, TITLE: true}, + + // Definitions + DL: pTagBoundary, + DD: definitionTagBoundary, + DT: definitionTagBoundary, + + // Tables + TABLE: pTagBoundary, + TBODY: tableStructureTagBoundary, + THEAD: tableStructureTagBoundary, + TD: tableCellTagBoundary, + TFOOT: tableStructureTagBoundary, + TH: tableCellTagBoundary, + TR: {TR: true}, + + // Lists + LI: {LI: true}, + OL: pTagBoundary, + UL: pTagBoundary, + + // Forms + BUTTON: formElementTagBoundary, + DATALIST: formElementTagBoundary, + FORM: pTagBoundary, + INPUT: formElementTagBoundary, + OPTGROUP: {OPTGROUP: true, OPTION: true}, + OPTION: {OPTION: true}, + OUTPUT: formElementTagBoundary, + PROGRESS: formElementTagBoundary, + SELECT: formElementTagBoundary, + TEXTAREA: formElementTagBoundary, + }; + +class Parser +{ + constructor( html, options, entityEncoder ) + { + this.options = Parser.setupOptions( options ); + this.lexer = new Lexer( html ); + this.entityEncoder = entityEncoder; + } + + static setupOptions( options ) + { + options = Object.assign( {}, defaultOptions, options ); + if ( options.encodeEntities instanceof RegExp ) + options.encodeEntities = globalizeRegExp( options.encodeEntities ); + return Object.freeze( options ); + } + + static isNameCharStart( chr ) + { + return chr === ":" || chr === "_" || (chr >= "A" && chr <= "Z") || (chr >= "a" && chr <= "z") || + (chr >= "\xC0" && chr <= "\xD6") || (chr >= "\xD8" && chr <= "\xF6") || + (chr >= "\xF8" && chr <= "\u02FF") || (chr >= "\u0370" && chr <= "\u037D") || + (chr >= "\u037F" && chr <= "\u1FFF") || chr === "\u200C" || chr === "\u200D" || + (chr >= "\u2070" && chr <= "\u218F") || (chr >= "\u2C00" && chr <= "\u2FEF") || + (chr >= "\u3001" && chr <= "\uD7FF") || (chr >= "\uF900" && chr <= "\uFDCF") || + (chr >= "\uFDF0" && chr <= "\uFFFD") || (chr >= "\u10000" && chr <= "\uEFFFF"); + } + + static isNameChar( chr ) + { + return Parser.isNameCharStart( chr ) || + (chr >= "0" && chr <= "9") || chr === "-" || chr === "." || chr === "\xB7" || + (chr >= "\u0300" && chr <= "\u036F") || chr === "\u203F" || chr === "\u2040"; + } + + parseHTML() + { + var rootNode = createNode( Node.DOCUMENT_FRAGMENT_NODE ), + scopeChain = [rootNode], theChar; + + rootNode[PARSER_OPTIONS] = this.options; + + if ( this.options.trimWhitespace ) + theChar = this.lexer.skipWhiteSpace(); + else theChar = this.lexer.getChar(); + + while ( theChar !== EOF && scopeChain.length > 0 ) + { + if ( theChar === "<" ) + this.parseTag( scopeChain ); + else this.parseText( scopeChain ); + + if ( this.options.trimWhitespace ) + theChar = this.lexer.skipWhiteSpace(); + else theChar = this.lexer.getChar(); + } + + return rootNode; + } + + parseTag( scopeChain ) + { + var node, name, selfClosing, state = STATE_START_TAG, + tagStartIdx = this.lexer.index, + theChar = this.lexer.getNextChar(), + startIdx, endIdx; + + if ( theChar !== EOF ) + Main: + while ( theChar !== ">" && theChar !== EOF ) + { + startIdx = this.lexer.index; + + if ( state === STATE_START_TAG ) + { + if ( theChar === "!" || theChar === "?" ) + { + if ( this.options.allowProcessingInstructions && this.lexer.match( "?" ) ) + { + startIdx = this.lexer.index; + theChar = this.lexer.getChar(); + PINode: + if ( Parser.isNameCharStart( theChar ) ) + { + node = createNode( Node.PROCESSING_INSTRUCTION_NODE ); + + // Find target's name. + while ( theChar !== EOF && Parser.isNameChar( theChar ) ) + theChar = this.lexer.getNextChar(); + + // If we have a non-whitespace character here that isn't EOF or + // the end '?>', then we've come across an invalid name character + // in the target name and this tag should be treated as a comment. + if ( !this.lexer.isWhiteSpace( theChar ) && theChar !== EOF && + !(theChar === "?" && this.lexer.peek() === ">") ) + break PINode; + + node.target = this.lexer.str.slice( startIdx, this.lexer.index ); + + this.lexer.skipWhiteSpace(); + startIdx = this.lexer.index; + this.lexer.goToString( "?>" ); + node.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index ); + this.lexer.advance( 1 ); + scopeChain[0].childNodes.push( node ); + setNodeParent( node, scopeChain[0] ); + break; + } + + // Go back to before the first '?' to include everything between the + // angle brackets in the comment we're going to create from this tag. + this.lexer.advance( startIdx - this.lexer.index - 1 ); + } + + if ( this.options.allowCDATA && this.lexer.match( "![CDATA[" ) ) + { + node = createNode( Node.CDATA_SECTION_NODE ); + startIdx = this.lexer.index; + this.lexer.goToString( "]]>" ); + node.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index ); + this.lexer.advance( 2 ); + scopeChain[0].childNodes.push( node ); + setNodeParent( node, scopeChain[0] ); + break; + } + else if ( this.lexer.match( "!DOCTYPE", false ) ) + { + this.lexer.skipWhiteSpace(); + startIdx = this.lexer.index; + this.lexer.goToString( ">" ); + + let rootNode = scopeChain[scopeChain.length - 1]; + + if ( rootNode.doctype ) + break; + else if ( rootNode.childNodes.length > 0 ) + for ( let i = rootNode.childNodes.length - 1; i >= 0; i-- ) + if ( rootNode.childNodes[i].nodeType < Node.TEXT_NODE || rootNode.childNodes[i].nodeType > Node.COMMENT_NODE ) + break Main; + + let params = this.lexer.str.slice( startIdx, this.lexer.index ).split( spacesRE ); + node = createNode( Node.DOCUMENT_TYPE_NODE ); + node.name = toLowerCase.call( params.shift() ); + + if ( params.length > 1 ) + { + let idType = toLowerCase.call( params.shift() ); + params = params.join( " " ).split( '"' ); + if ( params[0] === "" ) switch ( idType ) + { + case "public": + params.shift(); + node.publicId = params.shift(); + + case "system": + params.shift(); + node.systemId = params.shift(); + } + } + + if ( !node.publicId ) node.publicId = ""; + if ( !node.systemId ) node.systemId = ""; + + rootNode.childNodes.push( node ); + rootNode.doctype = node; + setNodeParent( node, rootNode ); + break; + } + else + { + let endTag; + if ( this.lexer.match( "!--" ) ) + { + if ( !this.lexer.match( ">" ) && !this.lexer.match( "->" ) ) + endTag = "-->"; + } + else + { + if ( theChar === "!" ) // Don't skip question marks that show up here. + this.lexer.getNextChar(); + endTag = ">"; + } + + node = createNode( Node.COMMENT_NODE ); + startIdx = this.lexer.index; + if ( endTag ) this.lexer.goToString( endTag ); + node.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index ); + this.lexer.advance( endTag ? endTag.length - 1 : -1 ); + scopeChain[0].childNodes.push( node ); + setNodeParent( node, scopeChain[0] ); + break; + } + } + else if ( theChar === "/" ) + { + theChar = this.lexer.getNextChar(); + state = STATE_END_TAG; + startIdx += 1; + } + } + + if ( state === STATE_ATTRIBUTE ) + { + // Find an attribute name. + while ( (this.lexer.index === startIdx && theChar === "=") || + (!this.lexer.isWhiteSpace( theChar ) && + !attributeNameExclusions[theChar] && + theChar !== EOF) ) + theChar = this.lexer.getNextChar(); + endIdx = this.lexer.index; + } + else + { + // Find a tag name. + while ( ((theChar >= "a" && theChar <= "z") || (theChar >= "A" && theChar <= "Z") || + (this.lexer.index > startIdx && ((theChar >= "0" && theChar <= "9") || theChar === "-" || theChar === "_" || theChar === ":"))) && + theChar !== EOF ) + theChar = this.lexer.getNextChar(); + endIdx = this.lexer.index; + if ( theChar === EOF ) + { + this.addTextNode( scopeChain, tagStartIdx, endIdx, false ); + return; + } + theChar = this.lexer.skipWhiteSpace(); + + if ( state === STATE_END_TAG ) + theChar = this.lexer.goToString( ">" ); + } + + if ( startIdx === endIdx ) + { + // Found an illegal character while searching for an attribute or tag name. + if ( this.options.allowSelfClosingSyntax && theChar === "/" && this.lexer.peek() === ">" ) + { + // If self-closing tag syntax is allowed, and we've found "/>", then we + // need to close the tag at the top of the scope chain. + theChar = this.lexer.getNextChar(); + state = STATE_END_TAG; + name = scopeChain[0][TAG_NAME]; + } + else if ( state === STATE_START_TAG ) + { + this.lexer.goToString( "<" ); + this.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false ); + tagStartIdx = this.lexer.index; + theChar = this.lexer.getNextChar(); + continue; + } + else if ( state === STATE_END_TAG ) + { + if ( startIdx === this.lexer.index ) break; // This throws "" away. + node = this.addTextNode( scopeChain, startIdx, this.lexer.index ); + node[NODE_TYPE] = Node.COMMENT_NODE; + break; + } + else + { + // All other illegal characters are simply skipped over, along with any + // following whitespace. + this.lexer.getNextChar(); + theChar = this.lexer.skipWhiteSpace(); + continue; + } + } + else + { + name = this.lexer.str.slice( startIdx, endIdx ); + if ( state !== STATE_ATTRIBUTE ) + name = toUpperCase.call( name ); + theChar = this.lexer.skipWhiteSpace(); + } + + switch ( state ) + { + case STATE_START_TAG: + node = createNode( Node.ELEMENT_NODE ); + node[TAG_NAME] = name; + while ( tagBoundaries.hasOwnProperty( node[TAG_NAME] ) && tagBoundaries[node[TAG_NAME]][scopeChain[0][TAG_NAME]] ) + scopeChain.splice( 0, 1 ); + scopeChain[0].childNodes.push( node ); + setNodeParent( node, scopeChain[0] ); + state = STATE_ATTRIBUTE; + selfClosing = selfClosingTags[node[TAG_NAME]]; + if ( selfClosing !== true ) scopeChain.unshift( node ); + break; + + case STATE_ATTRIBUTE: + let value = true; + + if ( this.options.lowerAttributeCase ) + name = toLowerCase.call( name ); + + if ( theChar === "=" ) + { + this.lexer.getNextChar(); + theChar = this.lexer.skipWhiteSpace(); + startIdx = this.lexer.index; + + if ( theChar === '"' || theChar === "'" ) + { + this.lexer.getNextChar(); + this.lexer.goToString( theChar ); + endIdx = this.lexer.index; + startIdx += 1; + this.lexer.getNextChar(); + theChar = this.lexer.skipWhiteSpace(); + } + else // Unquoted attribute value + { + while ( !this.lexer.isWhiteSpace( theChar ) && + //!unquotedAttributeExclusions[theChar] && + theChar !== ">" && + (!this.options.allowSelfClosingSyntax || !(theChar === "/" && this.lexer.peek() === ">")) && + theChar !== EOF ) + theChar = this.lexer.getNextChar(); + endIdx = this.lexer.index; + theChar = this.lexer.skipWhiteSpace(); + } + + if ( node.attributes.hasOwnProperty( name ) ) break; + value = this.lexer.str.slice( startIdx, endIdx ); + + if ( value === "" ) + value = true; + else if ( this.options.decodeEntities ) + value = this.entityEncoder.decode( value ); + } + else if ( node.attributes.hasOwnProperty( name ) ) break; + + node.attributes[name] = value; + break; + + case STATE_END_TAG: + for ( let i = 0; i < scopeChain.length; i++ ) + if ( scopeChain[i][TAG_NAME] === name ) + { + node = scopeChain[i]; + while ( scopeChain.length > 0 && scopeChain[0] !== node ) + scopeChain.shift(); + scopeChain.shift(); + break; + } + break; + } + } + else this.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false ); + + this.lexer.getNextChar(); + } + + parseText( scopeChain ) + { + var startIdx = this.lexer.index, + preserveContent = false; + + if ( scopeChain[0][TAG_NAME] === "SCRIPT" || scopeChain[0][TAG_NAME] === "STYLE" ) + { + this.lexer.goToString( "<\/"+ scopeChain[0][TAG_NAME], false ); + preserveContent = true; + } + else this.lexer.goToString( "<" ); + + this.addTextNode( scopeChain, startIdx, this.lexer.index, preserveContent ); + } + + addTextNode( scopeChain, startIdx, endIdx, preserveContent ) + { + var node = createNode( Node.TEXT_NODE ), + value = this.lexer.str.slice( startIdx, endIdx ); + + if ( preserveContent != null ) + { + if ( this.options.trimWhitespace ) + value = value.trim(); + else if ( this.options.collapseWhitespace && !preserveContent ) + value = value.replace( spacesRE, " " ); + + if ( this.options.decodeEntities && !preserveContent ) + value = this.entityEncoder.decode( value ); + } + + node.nodeValue = value; + scopeChain[0].childNodes.push( node ); + setNodeParent( node, scopeChain[0] ); + + return node; + } +} + +class ImageData { + constructor(widthOrData, heightOrWidth, settingsOrHeight, settings) { + var _a, _b; + const rgbaArray = (widthOrData instanceof Uint8ClampedArray) ? widthOrData : null; + let colorSpace = "srgb"; + if (rgbaArray) { + console.log(`[ImageData] Warning: Array initializer support is experimental! ( new ImageData([${rgbaArray.length}b ${(_b = (_a = rgbaArray === null || rgbaArray === void 0 ? void 0 : rgbaArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "Array"}], ${Array.from(arguments).slice(1).join(',')}) )`); + this.width = heightOrWidth; + this.height = typeof settingsOrHeight === "number" ? settingsOrHeight : undefined; + colorSpace = (typeof settingsOrHeight === "object" ? settingsOrHeight : (typeof settings === "object" ? settings : { colorSpace: "srgb" })).colorSpace; + } + else { + this.width = widthOrData; + this.height = heightOrWidth; + colorSpace = (typeof settingsOrHeight === "object" ? settingsOrHeight : { colorSpace: "srgb" }).colorSpace; + } + if (colorSpace !== "srgb") { + console.log(`[ImageData] Warning: Only the 'srgb' color space is supported! ( new ImageData(${Array.from(arguments).join(',')}) )`); + throw new Error(`Unsupported colorSpace: ${colorSpace}`); + } + // We need to calculate the height based on the array data and width + if (this.height === undefined) { + this.height = rgbaArray.length / this.width / 4; + } + if (rgbaArray) { + if (this.width * this.height * 4 !== rgbaArray.length) { + // TODO: this should be a "DOMException" + throw new Error(`The array dimensions do not match the supplied width or height`); + } + this.data = new Uint8ClampedArray(rgbaArray); + } + else { + this.data = new Uint8ClampedArray(this.width * this.height * 4); + } + } +} +// Export onto the global scope +if (globalThis && typeof globalThis.ImageData !== "object") { + // @ts-ignore + globalThis.ImageData = ImageData; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d +const FILL_STYLE = Symbol("fill-style"); +class CanvasRenderingContext2D { + get fillStyle() { + return this[FILL_STYLE]; + } + set fillStyle(newStyle) { + console.log(`${this}→fillStyle = ${newStyle}`); + this[FILL_STYLE] = newStyle; + } + // CanvasRect + clearRect(x, y, w, h) { + throw new Error("Not implemented"); + } + fillRect(x, y, w, h) { + const { r, g, b, a } = this.fillStyleRGBA; + const alpha = a * 255 | 0; + const data = this.canvas[CANVAS_DATA]; + // Optimization: full-canvas fill + if (x === 0 && y === 0 && data.length === w * h * 4) { + for (let i = 0; i < data.length; i += 4) { + if (i < 100) + console.log(`→ fill #${i} rgba(${data[i]},${data[i + 1]},${data[i + 2]} @ ${data[i + 3]}) => rgba(${r},${g},${b} @ ${alpha})`); + data[i + 0] = r; + data[i + 1] = g; + data[i + 2] = b; + data[i + 3] = alpha; + } + console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) whole canvas with ${r},${g},${b} @ ${alpha}`); + console.log(data); + return; + } + for (let row = y; row < y + h; ++row) { + const startIdx = row * 4 + x; + const endIdx = row * 4 + x + w; + for (let i = startIdx; i < endIdx; ++i) { + data[i + 0] = r; + data[i + 1] = g; + data[i + 2] = b; + data[i + 3] = alpha; + } + } + console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) with ${r},${g},${b} @ ${alpha}`); + } + strokeRect(x, y, w, h) { + throw new Error("Not implemented"); + } + constructor(parentCanvas) { + this.canvas = parentCanvas; + // defaults + this.fillStyle = "#000"; + } + drawImage(image, x1, y1, w1, h1, x2, y2, w2, h2) { + if (image instanceof globalThis.HTMLCanvasElement) { + w1 = w1 !== null && w1 !== void 0 ? w1 : image.width; + h1 = h1 !== null && h1 !== void 0 ? h1 : image.height; + if (w1 !== w2 || h1 !== h2) { + console.log(`${this} Not implemented: image scaling in drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`); + return; + } + const srcImage = image.getContext("2d").getImageData(x1, y1, w1, h1); + const srcPixels = srcImage.data; + const dstPixels = this.canvas[CANVAS_DATA]; + const rows = h1; + const cols = w1; + for (let row = 0; row < rows; ++row) { + for (let col = 0; col < cols; ++col) { + // source pixel + const si = ((y1 + row) * srcImage.width + x1 + col) * 4; + const sr = srcPixels[si]; + const sg = srcPixels[si + 1]; + const sb = srcPixels[si + 2]; + const sa = srcPixels[si + 3]; + // destination pixel + const di = ((y2 + row) * srcImage.width + x2 + col) * 4; + const dr = dstPixels[di]; + const dg = dstPixels[di + 1]; + const db = dstPixels[di + 2]; + const da = dstPixels[di + 3]; + // blend pixels using premultiplied alpha and the default 'source-over' composition + // https://drafts.fxtf.org/compositing/#porterduffcompositingoperators_srcover + const dstcontrib = (1 - sa / 255); + dstPixels[di + 0] = sr * (sa / 255) + dr * (da / 255) * dstcontrib | 0; + dstPixels[di + 1] = sg * (sa / 255) + dg * (da / 255) * dstcontrib | 0; + dstPixels[di + 2] = sb * (sa / 255) + db * (da / 255) * dstcontrib | 0; + dstPixels[di + 3] = sa + da * dstcontrib | 0; + if (row === col) { + console.log(`→ [${row},${col}]: imgdata#${si} rgba(${sr},${sg},${sb} @ ${sa}) + canvas#${di} rgba(${dr},${dg},${db} @ ${da}) => rgba(${dstPixels[di]},${dstPixels[di + 1]},${dstPixels[di + 2]} @ ${dstPixels[di + 3]})`); + } + } + } + console.log(`${this}→drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`); + return; + } + //let dx,dy,dw,dh; + //let sx,sy,sw,sh; + console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`); + } + createImageData(widthOrImagedata, height, settings) { + if (widthOrImagedata instanceof ImageData) { + return new ImageData(widthOrImagedata.data, widthOrImagedata.width, widthOrImagedata.height); + } + return new ImageData(widthOrImagedata, height, settings); + } + getImageData(sx, sy, sw, sh, settings) { + if (sx === 0 && sy === 0 && sw === this.canvas.width && sh === this.canvas.height && !settings) { + console.log(`${this}→getImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`); + return new ImageData(this.canvas[CANVAS_DATA], this.canvas.width, this.canvas.height); + } + console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(', ')} )`); + const id = new ImageData(sw, sh, settings); + return id; + } + putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) { + let premultWarnLow, premultWarnZero; + const canvas = this.canvas[CANVAS_DATA]; + if (dirtyX === undefined) { + if (dx === 0 && dy === 0 && imagedata.width === this.canvas.width && imagedata.height === this.canvas.height) { + console.log(`${this}→putImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`); + for (let col = 0; col < imagedata.height; ++col) { + for (let row = 0; row < imagedata.width; ++row) { + const idx = (col * imagedata.width + row) * 4; + const alpha = imagedata.data[idx + 3], r = imagedata.data[idx + 0], g = imagedata.data[idx + 1], b = imagedata.data[idx + 2]; + // Transparent pixels that are not fully black/white have browser inconsistencies + // Context for these warnings: + // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData#data_loss_due_to_browser_optimization + if (alpha === 0 && (r | g | b) !== 0 && (r & g & b) !== 255) { + premultWarnZero = true; + } + else if (alpha < 255 && (r | g | b) !== 0 && (r & g & b) !== 255) { + premultWarnLow = true; + } + canvas[idx + 0] = r; + canvas[idx + 1] = g; + canvas[idx + 2] = b; + canvas[idx + 3] = alpha; //a + } + } + if (premultWarnLow) { + console.log(`${this} Compat warning: image contained colored non-opaque pixels (alpha<255), the result be inconsistent with observed browser behavior.`); + } + if (premultWarnZero) { + console.log(`${this} Compat warning: image contained fully transparent colored pixels (alpha=0), the result of this operation may differ from browser behavior.`); + } + return; + } + console.log(`${this} Not implemented: non-whole-canvas putImageData( ${Array.from(arguments).join(', ')} )`); + return; + } + console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(', ')} )`); + } + setTransform(matrixOrA, b, c, d, e, f) { + console.log(`${this} Not implemented: context2d.setTransform( ${Array.from(arguments).join(', ')} )`); + } + // Stringifies the context object with its canvas & unique ID to ease debugging + get [Symbol.toStringTag]() { + return `${this.canvas[Symbol.toStringTag]}::context2d`; + } + // https://developer.mozilla.org/en-US/docs/Web/CSS/color_value + get fillStyleRGBA() { + let c; + let r = 0, g = 0, b = 0, a = 1; + // Named color ('white', 'black', etc) + if (CSS_NAMED_COLORS.has(this.fillStyle)) { + c = HTMLColorToRGBA(CSS_NAMED_COLORS.get(this.fillStyle)); + if (c) + return c; + } + // HTML color (#aaa, #bbccdd, #rrggbbaa) + c = HTMLColorToRGBA(this.fillStyle); + if (c) + return c; + // rgb() color definition + c = HTMLColorToRGBA(this.fillStyle); + if (c) + return c; + return { r, g, b, a }; + } +} +// TODO: these are only the basic colors +const CSS_NAMED_COLORS = new Map([ + ["black", "#000000"], + ["silver", "#c0c0c0"], + ["gray", "#808080"], + ["white", "#ffffff"], + ["maroon", "#800000"], + ["red", "#ff0000"], + ["purple", "#800080"], + ["fuchsia", "#ff00ff"], + ["green", "#008000"], + ["lime", "#00ff00"], + ["olive", "#808000"], + ["yellow", "#ffff00"], + ["navy", "#000080"], + ["blue", "#0000ff"], + ["teal", "#008080"], + ["aqua", "#00ffff"], +]); +function HTMLColorToRGBA(color) { + var _a, _b; + let r = 0, g = 0, b = 0, a = 0; + let matched, wasMatched; + // Match longform + matched = (_a = color.match(/^#(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/)) === null || _a === void 0 ? void 0 : _a.groups; + if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) { + r = parseInt(matched.r, 16); + g = parseInt(matched.g, 16); + b = parseInt(matched.b, 16); + a = matched.a ? parseInt(matched.a, 10) : 1.0; + wasMatched = true; + } + // Match short form + matched = (_b = color.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/)) === null || _b === void 0 ? void 0 : _b.groups; + if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) { + r = parseInt(matched.r, 16); + g = parseInt(matched.g, 16); + b = parseInt(matched.b, 16); + a = matched.a ? parseInt(matched.a, 10) : 1.0; + wasMatched = true; + } + if (!wasMatched) { + console.log(`Not a HTML color string: ${color}`); + return null; + } + return { r, g, b, a }; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#the-canvas-element +// Implementation +const WIDTH = Symbol("canvas-width"); +const HEIGHT = Symbol("canvas-height"); +const CONTEXT = Symbol("canvas-context"); +const EID = Symbol("element-id"); +// Access canvas data (for the Context or testing/debugging) +const CANVAS_DATA = Symbol("accesscanvas-data"); +class HTMLCanvasElement extends Node { + get width() { + console.debug(`${this}→width? (${this[WIDTH]})`); + return this[WIDTH]; + } + get height() { + console.debug(`${this}→height? (${this[HEIGHT]})`); + return this[HEIGHT]; + } + set width(width) { + console.debug(`${this}→width = ${width}`); + this[WIDTH] = width; + this.resize(this[WIDTH], this[HEIGHT]); + } + set height(height) { + console.debug(`${this}→height = ${height}`); + this[HEIGHT] = height; + this.resize(this[WIDTH], this[HEIGHT]); + } + //getContext(contextId: "bitmaprenderer", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null; + //getContext(contextId: string, options?: any): RenderingContext | null; + getContext(contextId, _options) { + if (contextId != "2d") + throw new Error(`Not implemented: ${contextId}`); + this[CONTEXT] = this[CONTEXT] || new CanvasRenderingContext2D(this); + if (!(this[CONTEXT] instanceof CanvasRenderingContext2D)) + throw new Error(`Context invalid`); + return this[CONTEXT]; + } + toDataURL(_type = "image/png", _quality) { + throw new Error("Not implemented"); + } + toBlob(_callback, _type = "image/png", _quality) { + throw new Error("Not implemented"); + } + get clientWidth() { + return this.width; + } + get clientHeight() { + return this.height; + } + constructor() { + super(EXTEND_NODE); + // Assign a new pseudo-random element ID + this[EID] = (Math.random() * (Math.pow(36, 6)) | 0).toString(36); + // The default size of a new canvas in most implementations + this.resize(300, 150); + } + // Stringifies the object including its unique element tag + get [Symbol.toStringTag]() { + return `HTMLCanvasElement#${this[EID]}`; + } + resize(width, height) { + this[WIDTH] = width; + this[HEIGHT] = height; + this[CANVAS_DATA] = new Uint8ClampedArray(this[WIDTH] * this[HEIGHT] * 4); + console.debug(`${this}→reset, new size: ${this[WIDTH]}x${this[HEIGHT]} (${this[CANVAS_DATA].length}b)`); + } +} +// Export onto the global scope +if (globalThis && typeof globalThis.HTMLCanvasElement !== "object") { + // @ts-ignore + globalThis.HTMLCanvasElement = HTMLCanvasElement; +} + +function createCanvasNode( nodeType ) +{ + const node = new HTMLCanvasElement(); + + node[NODE_TYPE] = nodeType; + node.nodeValue = null; + node[PARENT_NODE] = null; + node[OWNER] = null; + + switch ( nodeType ) + { + case Node.ELEMENT_NODE: + node[TAG_NAME] = null; + node.attributes = {}; + // fallthrough + + case Node.DOCUMENT_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + node.childNodes = []; + } + + return node; +} + +const decodingRE = /&(#\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g, + + // From 'SyntaxCharacter' in section 21.2.1 (Patterns) of the ECMAScript 6.0 spec. + regExpEscapeRE = /[\^$\\.*+?()[\]{}|]/g, + + _defaultEntities = processEntities( { + "amp": "&", + "apos": "'", + "copy": 169, + "gt": ">", + "lt": "<", + "nbsp": 160, + "quot": '"' + } ); + +let defaultEntities = _defaultEntities; + +class EntityEncoder +{ + constructor( entities ) + { + this.entities = entities || "default"; + } + + encode( string, what ) + { + if ( !this.encodingReplacements ) return string; + return string.replace( what instanceof RegExp ? globalizeRegExp( what ) : this.encodingRE, chr => this.encodingReplacements[chr] || chr ); + } + + decode( string ) + { + if ( !this.decodingReplacements ) return string; + return string.replace( decodingRE, ( _, m ) => + { + if ( m[0] === "#" ) + { + if ( m[1] === "x" || m[1] === "X" ) + m = parseInt( m.slice( 2 ), 16 ) | 0; + else m = m.slice( 1 ) | 0; + return String.fromCodePoint( m ); + } + return this.decodingReplacements[m] || this.decodingReplacements[m.toLowerCase()] || _; + } ); + } + + set entities( entities ) + { + if ( entities === "default" ) + entities = defaultEntities; + else if ( !entities || !(entities.encodingRE instanceof RegExp) ) + entities = processEntities( entities ); + + this.encodingRE = entities.encodingRE; + this.encodingReplacements = entities.encodingReplacements; + this.decodingReplacements = entities.decodingReplacements; + } + + static set defaultEntities( entities ) + { + if ( entities && typeof entities === "object" ) + defaultEntities = processEntities( Object.assign( {}, entities ) ); + else defaultEntities = _defaultEntities; + } +} + +function processEntities( entities ) +{ + var result = { + encodingRE: null, + encodingReplacements: null, + decodingReplacements: null + }; + + if ( entities && typeof entities === "object" ) + { + const escapes = {}, + unescapes = {}, + entityList = []; + + for ( let k in entities ) + if ( entities.hasOwnProperty( k ) ) + { + let entity = entities[k]; + + if ( Number.isFinite( entity ) ) + entity = String.fromCodePoint( entity ); + else if ( typeof entity !== "string" || entity === "" ) + continue; + + entityList.push( entity.replace( regExpEscapeRE, "\\$&" ) ); + if ( !escapes.hasOwnProperty( entity ) || (k.length + 2) < escapes[entity].length ) + escapes[entity] = "&"+ k +";"; + unescapes[k] = entity; + } + + if ( entityList.length > 0 ) + { + result.encodingRE = new RegExp( entityList.join( "|" ), "g" ); + result.encodingReplacements = escapes; + result.decodingReplacements = unescapes; + } + } + + if ( !result.encodingRE ) + result.encodingRE = new RegExp( "(?:)", "g" ); + + return result; +} + +/* @END_UNIT_TESTS */ + +const ENTITY_ENCODER = Symbol( "entityEncoder" ); + +class DOM extends Node +{ + constructor( html, options ) + { + const node = createNode( Node.DOCUMENT_FRAGMENT_NODE, DOM ); + node[PARSER_OPTIONS] = Parser.setupOptions( options ); + node[ENTITY_ENCODER] = new EntityEncoder( node[PARSER_OPTIONS].entities ); + node.innerHTML = html; + return node; + } + + get documentElement() {return this[DOCUMENT_ELEMENT] || null} + + get innerHTML() + { + let html = ""; + for ( let i = 0; i < this.childNodes.length; i++ ) + html += serializeNode( this.childNodes[i] ); + return html; + } + set innerHTML( html ) + { + this[NODE_TYPE] = Node.DOCUMENT_FRAGMENT_NODE; + if ( html && typeof html === "string" ) + { + const rootNode = new Parser( html, this[PARSER_OPTIONS], this[ENTITY_ENCODER] ).parseHTML(); + + detachNodes( this.childNodes ); + + if ( rootNode.doctype ) + this[DOCTYPE] = rootNode.doctype; + else this[DOCTYPE] = null; + + this.childNodes = rootNode.childNodes; + for ( let i = 0; i < this.childNodes.length; i++ ) + setNodeParent( this.childNodes[i], this ); + + setupDocument( this ); + } + else this.childNodes.length = 0; + } + + get outerHTML() {return null} + set outerHTML( v ) {} + + get doctype() + { + return this[DOCTYPE] || null; + } + set doctype( val ) + { + if ( val ) + { + let doctype = this[DOCTYPE]; + if ( val instanceof Node ) + { + if ( val.nodeType === Node.DOCUMENT_TYPE_NODE && val !== doctype ) + { + this[DOCTYPE] = val; + if ( doctype ) this.replaceChild( val, doctype ); + else this.insertBefore( val, this.firstChild ); + } + } + else if ( typeof val === "object" ) + { + if ( !doctype ) + this[DOCTYPE] = this.insertBefore( this.createDocumentType( val.name, val.publicId, val.systemId ), this.firstChild ); + else setupDocumentType( doctype, val.name, val.publicId, val.systemId ); + } + } + else if ( val === null && this[DOCTYPE] ) + { + this.removeChild( this[DOCTYPE] ); + this[DOCTYPE] = null; + } + } + + get head() + { + return this[HEAD] || null; + } + + get title() + { + const head = this.head; + if ( head ) + { + const title = head.getElementsByTagName( "title" ); + if ( title.length > 0 ) + return title[0].textContent; + } + return ""; + } + set title( val ) + { + const head = this.head; + if ( head ) + { + let title = head.getElementsByTagName( "title" ); + if ( title.length <= 0 ) + title = head.appendChild( this.createElement( "title" ) ); + else title = title[0]; + title.textContent = val; + } + } + + get body() + { + return this[BODY] || null; + } + set body( val ) + { + if ( val instanceof Node && val.nodeType === Node.ELEMENT_NODE && + (val.tagName === "BODY" || val.tagName === "FRAMESET") && + val !== this[BODY] && this[DOCUMENT_ELEMENT] ) + { + if ( this[BODY] ) this[BODY].parentNode.replaceChild( val, this[BODY] ); + else this[DOCUMENT_ELEMENT].appendChild( val ); + } + } + + get entityEncoder() + { + return this[ENTITY_ENCODER]; + } + + createElement( tagName ) + { + if ( tagName && typeof tagName === "string" ) + { + const node = createNodeForTagName( tagName ); + node[TAG_NAME] = tagName.toUpperCase(); + return node; + } + } + + createTextNode( text ) + { + return createTextBasedNode( Node.TEXT_NODE, text ); + } + + createComment( data ) + { + return createTextBasedNode( Node.COMMENT_NODE, data ); + } + + createCDATASection( data ) + { + return createTextBasedNode( Node.CDATA_SECTION_NODE, data, "]]>" ); + } + + createProcessingInstruction( target, data ) + { + NewNode: + if ( target && typeof target === "string" ) + { + if ( Parser.isNameCharStart( target[0] ) ) + for ( let i = 1; i < target.length; i++ ) + { + if ( !Parser.isNameChar( target[i] ) ) + break NewNode; + } + else break NewNode; + + const node = createTextBasedNode( Node.PROCESSING_INSTRUCTION_NODE, data, "?>" ); + node.target = target; + return node; + } + throw new Error( "Invalid target name "+ JSON.stringify( target ) +"." ); + } + + createDocumentType( name, publicId, systemId ) + { + return setupDocumentType( createNode( Node.DOCUMENT_TYPE_NODE ), name, publicId, systemId ); + } + + getElementsByName( name ) + { + const nodeList = []; + if ( name && typeof name === "string" ) + this.forEach( node => + { + if ( node.attributes && node.attributes.name === name ) + nodeList.push( node ); + } ); + return nodeList; + } +} + +function createTextBasedNode( type, text, disallowed = false ) +{ + const node = createNode( type ); + node.nodeValue = ""; + if ( text && typeof text === "string" ) + { + if ( disallowed && typeof disallowed === "string" && text.indexOf( disallowed ) !== -1 ) + throw new Error( "The data provided ('"+ text +"') contains '"+ disallowed +"'." ); + node.nodeValue += text; + } + return node; +} + +function setupDocumentType( doctype, name, publicId, systemId ) +{ + if ( name && typeof name === "string" ) + { + doctype.name = name.toLowerCase(); + + if ( publicId && typeof publicId === "string" ) + doctype.publicId = publicId; + else doctype.publicId = ""; + + if ( systemId && typeof systemId === "string" ) + doctype.systemId = systemId; + else doctype.systemId = ""; + } + else doctype.name = doctype.publicId = doctype.systemId = ""; + + return doctype; +} + +function createNodeForTagName( tagName ) +{ + switch ( tagName.toLowerCase() ) + { + case 'canvas': + return createCanvasNode( Node.ELEMENT_NODE ); + default: + return createNode( Node.ELEMENT_NODE ); + } +} + +/* @START_UNIT_TESTS */ +DOM.parseSelector = parseSelector; +/* @END_UNIT_TESTS */ + +DOM.Node = Node; +DOM.EntityEncoder = EntityEncoder; + +module.exports = DOM; +//# sourceMappingURL=fauxdom-with-canvas.tests.cjs.map diff --git a/lib/fauxdom-with-canvas.tests.cjs.map b/lib/fauxdom-with-canvas.tests.cjs.map new file mode 100644 index 0000000..3fc2c71 --- /dev/null +++ b/lib/fauxdom-with-canvas.tests.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"fauxdom-with-canvas.tests.cjs","sources":["../src/lexer.js","../src/event-target.js","../src/utils.js","../src/token-list.js","../src/css-style-declaration.js","../src/selector-parser.js","../src/selectors.js","../src/serializer.js","../src/node.js","../src/html-parser.js","../src/js-canvas/ImageData.js","../src/js-canvas/RenderingContext.js","../src/js-canvas/HTMLCanvasElement.js","../src/canvas-node.js","../src/entity-encoder.js","../src/document.js"],"sourcesContent":["const reCache = {},\n\twhitespaces = {},\n\tisWhiteSpace = Object.prototype.hasOwnProperty.bind( whitespaces ),\n\tEOF = null;\n\nexport {whitespaces, EOF};\n\nexport class Lexer\n{\n\tconstructor( str )\n\t{\n\t\tthis.index = 0;\n\t\tthis.str = str;\n\t\tthis.scanChar = this.str[this.index];\n\t\t\n\t\tif ( !isWhiteSpace( \"\\x20\" ) )\n\t\t{\n\t\t\t// Unicode C0 & C1 control characters are treated as whitespace, along with the ASCII space character.\n\t\t\tfor ( let i = 0; i <= 0x20; i++ )\n\t\t\t\twhitespaces[String.fromCharCode( i )] = null;\n\t\t\tfor ( let i = 0x80; i <= 0x9f; i++ )\n\t\t\t\twhitespaces[String.fromCharCode( i )] = null;\n\t\t}\n\t}\n\t\n\tisWhiteSpace( theChar )\n\t{\n\t\treturn (theChar !== EOF && isWhiteSpace( theChar ));\n\t}\n\t\n\tgoToString( toChar, caseSensitive )\n\t{\n\t\tif ( caseSensitive !== false )\n\t\t\tthis.index = this.str.indexOf( toChar, this.index );\n\t\telse\n\t\t{\n\t\t\tif ( !reCache[toChar] )\n\t\t\t\treCache[toChar] = new RegExp( toChar, \"ig\" );\n\t\t\t\n\t\t\treCache[toChar].lastIndex = this.index;\n\t\t\t\n\t\t\tconst match = reCache[toChar].exec( this.str );\n\t\t\tif ( match ) this.index = match.index;\n\t\t\telse this.index = -1;\n\t\t}\n\t\t\n\t\tif ( this.index > -1 )\n\t\t\tthis.scanChar = this.str[this.index];\n\t\telse\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\tthis.scanChar = EOF;\n\t\t}\n\t}\n\t\n\tgoToIndex( index )\n\t{\n\t\tthis.scanChar = this.str[this.index = index];\n\t}\n\t\n\tadvance( amount )\n\t{\n\t\tthis.index += amount;\n\t\tif ( this.index > this.str.length )\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\treturn (this.scanChar = EOF);\n\t\t}\n\t\treturn (this.scanChar = this.str[this.index]);\n\t}\n\t\n\tmatch( str, caseSensitive )\n\t{\n\t\tvar chunk = this.str.substr( this.index, str.length );\n\t\tif ( caseSensitive === false )\n\t\t{\n\t\t\tstr = str.toLowerCase();\n\t\t\tchunk = chunk.toLowerCase();\n\t\t}\n\t\tif ( chunk === str )\n\t\t{\n\t\t\tthis.index += str.length-1;\n\t\t\tthis.getNextChar();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpeek()\n\t{\n\t\treturn this.str[this.index + 1];\n\t}\n\t\n\tgetChar()\n\t{\n\t\treturn this.scanChar;\n\t}\n\t\n\tgetNextChar()\n\t{\n\t\tif ( this.index + 1 < this.str.length )\n\t\t\treturn (this.scanChar = this.str[++this.index]);\n\t\telse\n\t\t{\n\t\t\tthis.index = this.str.length;\n\t\t\treturn (this.scanChar = EOF);\n\t\t}\n\t}\n\t\n\tgetNextAfterWhiteSpace()\n\t{\n\t\tvar theChar;\n\t\tdo theChar = this.getNextChar();\n\t\twhile ( theChar !== EOF && isWhiteSpace( theChar ) )\n\t\treturn theChar;\n\t}\n\t\n\tskipWhiteSpace()\n\t{\n\t\tvar theChar = this.scanChar;\n\t\t\n\t\twhile ( theChar !== EOF && isWhiteSpace( theChar ) )\n\t\t\ttheChar = this.getNextChar();\n\t\t\n\t\treturn this.scanChar;\n\t}\n}","// Implementation of the HTML EventTarget API\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\nconst EVENT_LISTENERS = Symbol(\"event-listeners\");\n\nexport default class EventTarget {\n\taddEventListener( eventType, callback, useCaptureOrOptions )\n\t{\n\t\t// Lazily create the event listener map on the node\n\t\tthis[EVENT_LISTENERS] = this[EVENT_LISTENERS] ?? new Map();\n\n\t\t// Registered listeners for this eventType\n\t\tlet listeners = this[EVENT_LISTENERS].get(eventType);\n\t\tif (!listeners) {\n\t\t\tlisteners = [];\n\t\t\tthis[EVENT_LISTENERS].set(eventType, listeners);\n\t\t}\n\n\t\t// Capturing and non-capturing listeners need to be removed separately\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#sect1\n\t\t// TODO: handle other options? (once, passive, signal)\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#options\n\t\tlisteners.push({\n\t\t\tcallback,\n\t\t\tcapturing: useCaptureOrOptions === true || !!useCaptureOrOptions?.capture,\n\t\t\toptions: typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions : { capture: !!useCaptureOrOptions }\n\t\t});\n\t}\n\n\tremoveEventListener( eventType, callback, useCaptureOrOptions )\n\t{\n\t\t// There aren't any listeners registered\n\t\tif (!this[EVENT_LISTENERS]) return;\n\n\t\t// Registered listeners for this eventType\n\t\tlet listeners = this[EVENT_LISTENERS].get(eventType);\n\t\tif (!listeners) return;\n\n\t\t// Extract the boolean capture value from the different possible argument formats\n\t\tconst captureSetting = !!(typeof useCaptureOrOptions === 'object' ? useCaptureOrOptions.capture : useCaptureOrOptions);\n\n\t\t// Find the indexes of listeners we want to remove, then remove them from the listeners array\n\t\t// A listener must match the callback object (function) and capture setting (true/false)\n\t\t// We remove the elements in reverse index order to avoid the indexes changing\n\t\tlisteners.map((listener, i) => {\n\t\t\treturn listener.callback === callback && listener.capturing === captureSetting ? i : undefined\n\t\t})\n\t\t\t.reverse()\n\t\t\t.forEach(i => {\n\t\t\t\tif (i !== undefined) listeners.splice(i, 1)\n\t\t\t});\n\t}\n\n\tdispatchEvent( event )\n\t{\n\t\tlet notCancelled = true;\n\n\t\t// There aren't any listeners registered\n\t\tif (!this[EVENT_LISTENERS]) return notCancelled;\n\n\t\t// List active listeners\n\t\tconst listeners = this[EVENT_LISTENERS].get(event.type) ?? [];\n\n\t\t// Dispatch the event for every listener\n\t\t// TODO: handle 'once', 'passive' options, bubbling & capture\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase\n\t\tlisteners?.forEach(({ callback }) => {\n\t\t\tcallback(event);\n\n\t\t\t// The event has been canceled through preventDefault()\n\t\t\tif (event.defaultPrevented) notCancelled = false;\n\t\t});\n\n\t\treturn notCancelled;\n\t}\n\n}\n","const DOCTYPE = Symbol( \"doctype\" ),\n\tHEAD = Symbol( \"head\" ),\n\tBODY = Symbol( \"body\" ),\n\tDOCUMENT_ELEMENT = Symbol( \"documentElement\" ),\n\tNODE_TYPE = Symbol( \"nodeType\" ),\n\tPARENT_NODE = Symbol( \"parentNode\" ),\n\tOWNER = Symbol( \"ownerDocument\" ),\n\tTAG_NAME = Symbol( \"tagName\" ),\n\tPARSER_OPTIONS = Symbol( \"parserOptions\" ),\n\t\n\tspacesRE = /\\s+/g,\n/* @START_BROWSER_ONLY */\n\treFlagsRE = /[gimsuy]*$/,\n/* @END_BROWSER_ONLY */\n\t\n\tnodeTypes = {\n\t\tELEMENT_NODE: 1,\n\t\t//ATTRIBUTE_NODE: 2, // Unused\n\t\tTEXT_NODE: 3,\n\t\tCDATA_SECTION_NODE: 4,\n\t\t//ENTITY_REFERENCE_NODE: 5, // Unused, historical\n\t\t//ENTITY_NODE: 6, // Unused, historical\n\t\tPROCESSING_INSTRUCTION_NODE: 7,\n\t\tCOMMENT_NODE: 8,\n\t\tDOCUMENT_NODE: 9,\n\t\tDOCUMENT_TYPE_NODE: 10,\n\t\tDOCUMENT_FRAGMENT_NODE: 11,\n\t\t//NOTATION_NODE: 12 // Unused, historical\n\t},\n\t\n\tselfClosingTags = {\n\t\t\"AREA\": true,\n\t\t\"BASE\": true,\n\t\t\"BR\": true,\n\t\t\"COL\": true,\n\t\t\"COMMAND\": true,\n\t\t\"EMBED\": true,\n\t\t\"HR\": true,\n\t\t\"IMG\": true,\n\t\t\"INPUT\": true,\n\t\t\"KEYGEN\": true,\n\t\t\"LINK\": true,\n\t\t\"META\": true,\n\t\t\"PARAM\": true,\n\t\t\"SOURCE\": true,\n\t\t\"TRACK\": true,\n\t\t\"WBR\": true\n\t};\n\nexport {DOCTYPE, HEAD, BODY, DOCUMENT_ELEMENT, NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME, PARSER_OPTIONS, spacesRE, nodeTypes, selfClosingTags};\n\nexport function setupDocument( document )\n{\n\tvar firstElementPosition = -1,\n\t\tdocumentElementPosition = -1,\n\t\tdocumentTagName = \"HTML\";\n\t\n\tif ( document[DOCTYPE] && document[PARSER_OPTIONS].allowCustomRootElement )\n\t\tdocumentTagName = document[DOCTYPE].name.toUpperCase();\n\t\n\tfor ( let i = 0, l = document.childNodes.length; i < l; i++ )\n\t\tif ( document.childNodes[i].tagName === documentTagName )\n\t\t{\n\t\t\tdocumentElementPosition = i;\n\t\t\t\n\t\t\tdocument[NODE_TYPE] = nodeTypes.DOCUMENT_NODE;\n\t\t\tdocument[DOCUMENT_ELEMENT] = document.childNodes[i];\n\t\t\tdocument[HEAD] = document[BODY] = null;\n\t\t\tfor ( let k = 0; k < document[DOCUMENT_ELEMENT].childNodes.length; k++ )\n\t\t\t{\n\t\t\t\tconst node = document[DOCUMENT_ELEMENT].childNodes[k];\n\t\t\t\t\n\t\t\t\tswitch ( node.tagName )\n\t\t\t\t{\n\t\t\t\t\tcase \"HEAD\": document[HEAD] = node; break;\n\t\t\t\t\t\n\t\t\t\t\tcase \"BODY\":\n\t\t\t\t\tcase \"FRAMESET\":\n\t\t\t\t\t\tdocument[BODY] = node; break;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( document[HEAD] && document[BODY] ) break;\n\t\t\t}\n\t\t\t\n\t\t\tif ( firstElementPosition !== -1 )\n\t\t\t{\n\t\t\t\tconst newParent = document[HEAD] || document[BODY] || document[DOCUMENT_ELEMENT],\n\t\t\t\t\tcount = documentElementPosition - firstElementPosition;\n\t\t\t\tfor ( let k = firstElementPosition; k < documentElementPosition; k++ )\n\t\t\t\t\tsetNodeParent( document.childNodes[k], newParent );\n\t\t\t\tnewParent.childNodes.splice( 0, 0, ...document.childNodes.splice( firstElementPosition, count ) );\n\t\t\t\tdocumentElementPosition -= count;\n\t\t\t\tl -= count;\n\t\t\t}\n\t\t\t\n\t\t\tif ( documentElementPosition < l - 1 )\n\t\t\t{\n\t\t\t\tconst newParent = document[BODY] || document[HEAD] || document[DOCUMENT_ELEMENT];\n\t\t\t\tfor ( let k = documentElementPosition + 1; k < l; k++ )\n\t\t\t\t\tsetNodeParent( document.childNodes[k], newParent );\n\t\t\t\tnewParent.childNodes.splice( newParent.childNodes.length, 0, ...document.childNodes.splice( documentElementPosition + 1 ) );\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\t}\n\t\telse if ( firstElementPosition === -1 && document.childNodes[i].nodeType === nodeTypes.ELEMENT_NODE )\n\t\t\tfirstElementPosition = i;\n}\n\nexport function getDocument( node )\n{\n\tconst owner = node[OWNER] || node.getRootNode();\n\tif ( owner[NODE_TYPE] === nodeTypes.DOCUMENT_NODE || owner[NODE_TYPE] === nodeTypes.DOCUMENT_FRAGMENT_NODE )\n\t\treturn owner;\n\treturn null;\n}\n\nexport function detachNodes( nodes )\n{\n\tif ( nodes && nodes.length > 0 ) for ( let i = 0; i < nodes.length; i++ )\n\t\tsetNodeParent( nodes[i], null );\n}\n\nexport function setNodeParent( node, parent )\n{\n\tconst owner = (parent !== null ? getDocument( parent ) : null);\n\t\n\tif ( node[OWNER] !== owner && node.hasChildNodes() )\n\t\tnode.forEach( node => {node[OWNER] = owner}, null );\n\t\n\tnode[PARENT_NODE] = parent;\n\tnode[OWNER] = owner;\n}\n\nexport function globalizeRegExp( re )\n{\n\tif ( !re.global )\n\t{\n\t\tlet flags = re.flags;\n\t/* @START_BROWSER_ONLY */\n\t\tif ( flags === undefined )\n\t\t\tflags = re.toString().match( reFlagsRE )[0];\n\t/* @END_BROWSER_ONLY */\n\t\tre = new RegExp( re.source, flags +\"g\" );\n\t}\n\treturn re;\n}","import {spacesRE} from \"./utils.js\";\n\nconst ELEMENT = Symbol( \"element\" ),\n\tLENGTH = Symbol( \"length\" ),\n\t\n\tvalidClassTokenRE = /^\\S+$/,\n\t\n\tindexOf = Array.prototype.indexOf,\n\tjoin = Array.prototype.join,\n\tsplice = Array.prototype.splice;\n\nexport function createTokenList( elem )\n{\n\tconst list = Object.create( DOMTokenList.prototype );\n\t\n\tlist[LENGTH] = 0;\n\tlist[ELEMENT] = elem;\n\tconst className = elem.className;\n\tif ( className ) list.value = className;\n\t\n\treturn list;\n}\n\nexport default class DOMTokenList\n{\n\tconstructor()\n\t{\n\t\tthrow new Error( \"Cannot directly instantiate DOMTokenList.\" );\n\t}\n\t\n\tget length() {return this[LENGTH]}\n\tset length( val ) {}\n\t\n\tget value()\n\t{\n\t\treturn join.call( this, \" \" );\n\t}\n\tset value( val )\n\t{\n\t\tif ( this[LENGTH] > 0 )\n\t\t\tfor ( let k in this ) if ( this.hasOwnProperty( k ) && isFinite( k ) )\n\t\t\t\tdelete this[k];\n\t\tthis[LENGTH] = 0;\n\t\t\n\t\tif ( typeof val === \"string\" )\n\t\t\tthis.add.apply( this, val.split( spacesRE ) );\n\t\telse delete this[ELEMENT].attributes.class;\n\t}\n\t\n\tadd()\n\t{\n\t\tfor ( let i = 0; i < arguments.length; i++ )\n\t\t\tif ( indexOf.call( this, arguments[i] ) === -1 && this.supports( arguments[i] ) )\n\t\t\t\tthis[this[LENGTH]++] = arguments[i];\n\t\tthis[ELEMENT].attributes.class = this.value;\n\t}\n\t\n\tremove()\n\t{\n\t\tfor ( let i = 0, idx; i < arguments.length; i++ )\n\t\t{\n\t\t\tidx = indexOf.call( this, arguments[i] );\n\t\t\tif ( idx !== -1 )\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t}\n\t\tthis[ELEMENT].attributes.class = this.value;\n\t}\n\t\n\titem( v )\n\t{\n\t\tif ( typeof v === \"number\" && v >= 0 && v < this[LENGTH] )\n\t\t\treturn this[v];\n\t}\n\t\n\ttoggle( token, force )\n\t{\n\t\tvar exists = false;\n\t\tif ( this.supports( token ) )\n\t\t{\n\t\t\tlet idx = indexOf.call( this, token );\n\t\t\tif ( idx !== -1 && force !== true )\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t\telse if ( force !== false )\n\t\t\t{\n\t\t\t\texists = true;\n\t\t\t\tif ( idx === -1 )\n\t\t\t\t\tthis[this[LENGTH]++] = token;\n\t\t\t}\n\t\t\tthis[ELEMENT].attributes.class = this.value;\n\t\t}\n\t\treturn exists;\n\t}\n\t\n\tcontains( token )\n\t{\n\t\treturn (indexOf.call( this, token ) !== -1);\n\t}\n\t\n\treplace( token, newToken )\n\t{\n\t\tvar idx = indexOf.call( this, token );\n\t\tif ( idx >= 0 && this.supports( newToken ) )\n\t\t{\n\t\t\tif ( indexOf.call( this, newToken ) === -1 )\n\t\t\t\tthis[idx] = newToken;\n\t\t\telse\n\t\t\t{\n\t\t\t\tsplice.call( this, idx, 1 );\n\t\t\t\tthis[LENGTH]--;\n\t\t\t}\n\t\t\tthis[ELEMENT].attributes.class = this.value;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tsupports( token )\n\t{\n\t\tif ( token && typeof token === \"string\" )\n\t\t\treturn token.match( validClassTokenRE );\n\t\treturn false;\n\t}\n}","// HTML \"style\" inline CSS property handling\n// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style\n\n// style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; border-bottom-color: hotpink; -moz-animation-iteration-count: 1\"\nconst ELEMENT = Symbol( \"element\" );\n\n// Conversions between kebab-case and camelCase forms of the CSS property name\n// The rules are as described in https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style\nfunction prop2dom(cssPropertyName) {\n\treturn cssPropertyName.replace(/-[a-z]/g, (r) => r.toUpperCase().substr(1));\n}\n// Note: dom2prop(dom2prop('camelCaseProp')) will work as expected so it's always safe\n// to use dom2prop to canonicalize property names in their kebab case (dashed) form\nfunction dom2prop(cssStyleDeclarationPropertyName) {\n\treturn cssStyleDeclarationPropertyName.replace(/[A-Z]/g, (r) => '-'+r.toLowerCase());\n}\n// In theory a valid CSS property (identifier) is more permissive, but in practice this covers all property names in use\nfunction valid(propertyName) {\n\tif (typeof propertyName !== 'string') return false;\n\t// Valid css property name\n\tif (propertyName.match(/^\\-?[a-z_-]*[a-z]$/)) return true;\n\t// Valid custom property\n\tif (propertyName.match(/^\\-\\-[A-Za-z_-]*[A-Za-z0-9]$/)) return true;\n\t// Valid DOM-style (camel case) property\n\tif (propertyName.match(/^[a-zA-Z]+$/)) return true;\n\n\treturn false;\n}\n\n// Parses a style=\"\" attribute into a map of property-value pairs for easier alterations\nfunction styleToMap(styleString = \"\") {\n\treturn new Map(styleString.split(/\\s*;\\s*/g).filter(s => s.length).map(sd => sd.trim().match(/^([a-z-]+)\\s*:\\s*(.*)$/).slice(1)));\n}\n\n// Stringifies a map of property-value pairs back into a style=\"\" inline style attribute value\nfunction mapToStyle(styleMap) {\n\treturn Array.from(styleMap?.entries() ?? []).map(e => e.join(': ')).join('; ');\n}\n\nexport function createInlineStyle( elem )\n{\n\tconst styleObject = {\n\t\t[ELEMENT]: elem\n\t};\n\n\tconst styleProxy = new Proxy(styleObject, {\n\t\tget(target, name) {\n\t\t\tif (name === ELEMENT) return elem;\n\t\t\tif (!valid(name)) return undefined;\n\n\t\t\tconst prop = dom2prop(name);\n\n\t\t\treturn styleToMap(elem.attributes.style).get(prop);\n\t\t},\n\t\tset(target, name, value) {\n\t\t\t// Fail silently (return truthy value to avoid showing an TypeError)\n\t\t\tif (!valid(name)) return true;\n\n\t\t\tconst prop = dom2prop(name);\n\t\t\tconst map = styleToMap(elem.attributes.style);\n\n\t\t\telem.attributes.style = mapToStyle(map.set(prop, value));\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, name) {\n\t\t\tif (!valid(name)) return;\n\n\t\t\tconst prop = dom2prop(name);\n\t\t\tconst map = styleToMap(elem.attributes.style);\n\n\t\t\telem.attributes.style = mapToStyle(map.delete(prop));\n\t\t},\n\t});\n\n\treturn styleProxy;\n}\n\nexport function updateInlineStyle( style, value )\n{\n\t// Parse and re-stringify value to validate format\n\tconst styleValue = mapToStyle(styleToMap(value));\n\n\tstyle[ELEMENT].attributes.style = styleValue;\n}\n\nexport default class CSSStyleDeclaration {\n\tconstructor()\n\t{\n\t\tthrow new Error( \"Cannot directly instantiate CSSStyleDeclaration.\" );\n\t}\n}\n","import {Lexer, EOF} from \"./lexer.js\";\n\nconst newLinesRE = /\\r\\n|\\r|\\f/g,\n\tanbSyntaxRE = /\\(\\s*(even|odd|(?:(?:([+-]?\\d*)n)\\s*(?:([+-])\\s*(\\d+))?|([+-]?\\d+)))\\s*/g;\n\nconst ParamTypes = {\n\tSelectors: 0,\n\tIdentifier: 1,\n\tIterator: 2,\n\tIteratorOf: 3\n};\n\nconst paramExpectations = {\n\t\"is\": ParamTypes.Selectors,\n\t\"not\": ParamTypes.Selectors,\n\t\"where\": ParamTypes.Selectors, // Alias of :is()\n\t\"has\": ParamTypes.Selectors,\n\t\n\t\"lang\": ParamTypes.Identifier, // Not implementing\n\t\"dir\": ParamTypes.Identifier, // Not implementing\n\t\n\t\"nth-child\": ParamTypes.IteratorOf,\n\t\"nth-last-child\": ParamTypes.IteratorOf,\n\t\n\t\"nth-of-type\": ParamTypes.Iterator,\n\t\"nth-last-of-type\": ParamTypes.Iterator,\n\t\"nth-col\": ParamTypes.Iterator, // Not implementing\n\t\"nth-last-col\": ParamTypes.Iterator, // Not implementing\n};\n\n// https://drafts.csswg.org/selectors-4/\n\nexport function parseSelector( selector )\n{\n\treturn parseSelectorList( new Lexer( selector.replace( newLinesRE, \"\\n\" ) ) );\n}\n\nfunction parseSelectorList( lexer, terminator = EOF, relative = false )\n{\n\tvar theChar = lexer.skipWhiteSpace(),\n\t\tselector = {},\n\t\tcompound = [],\n\t\tcomplex = [compound],\n\t\tast = [complex];\n\t\n\twhile ( theChar !== EOF && theChar !== terminator )\n\t{\n\t\tswitch ( theChar )\n\t\t{\n\t\t\tcase \"*\": // https://drafts.csswg.org/selectors-4/#universal-selector\n\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\tthrow syntaxError( \"Universal selectors must come before all other simple selectors.\", lexer );\n\t\t\t\tselector.type = \"universal\";\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"#\":\n\t\t\tcase \".\":\n\t\t\t{\n\t\t\t\tlexer.getNextChar();\n\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\n\t\t\t\tselector.type = (theChar === \"#\" ? \"id\" : \"class\");\n\t\t\t\tselector.name = name;\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"[\": // https://drafts.csswg.org/selectors-4/#attribute-selectors\n\t\t\t{\n\t\t\t\tlexer.getNextAfterWhiteSpace();\n\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\n\t\t\t\tselector.type = \"attr\";\n\t\t\t\tselector.name = name;\n\t\t\t\tselector.comparison = \"=\";\n\t\t\t\tselector.value = true;\n\t\t\t\tselector.ignoreCase = false;\n\t\t\t\t\n\t\t\t\tif ( (theChar = lexer.getNextAfterWhiteSpace()) !== \"]\" )\n\t\t\t\t{\n\t\t\t\t\tswitch ( theChar )\n\t\t\t\t\t{\n\t\t\t\t\t\tcase \"=\": break;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase \"~\":\n\t\t\t\t\t\tcase \"|\":\n\t\t\t\t\t\tcase \"^\":\n\t\t\t\t\t\tcase \"$\":\n\t\t\t\t\t\tcase \"*\":\n\t\t\t\t\t\t\tif ( lexer.peek() !== \"=\" ) throw syntaxError( \"Expected '='.\", lexer, 1 );\n\t\t\t\t\t\t\tselector.comparison = theChar + selector.comparison;\n\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tdefault: throw syntaxError( \"Unexpected character '\"+ (theChar === EOF ? \"END_OF_INPUT\" : theChar) +\"'.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttheChar = lexer.getNextAfterWhiteSpace();\n\t\t\t\t\tif ( theChar === \"'\" || theChar === '\"' )\n\t\t\t\t\t{\n\t\t\t\t\t\t// https://drafts.csswg.org/css-syntax-3/#consume-string-token\n\t\t\t\t\t\tconst quote = theChar;\n\t\t\t\t\t\t\n\t\t\t\t\t\tselector.value = \"\";\n\t\t\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile ( theChar !== EOF && theChar !== quote && theChar !== \"\\n\" )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( theChar === \"\\\\\" )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tselector.value += parseEscapedCodePoint( lexer );\n\t\t\t\t\t\t\t\ttheChar = lexer.getChar();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tselector.value += theChar;\n\t\t\t\t\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\t\tselector.value = name;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( lexer.getNextAfterWhiteSpace() !== \"]\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst ident = parseIdentifier( lexer );\n\t\t\t\t\t\tif ( ident === \"i\" || ident === \"I\" )\n\t\t\t\t\t\t\tselector.ignoreCase = true;\n\t\t\t\t\t\telse if ( ident === \"s\" || ident === \"S\" )\n\t\t\t\t\t\t\tselector.ignoreCase = false;\n\t\t\t\t\t\telse if ( ident )\n\t\t\t\t\t\t\tthrow syntaxError( \"Unexpected identifier '\"+ ident +\"'.\", lexer, -ident.length + 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( lexer.getNextAfterWhiteSpace() !== \"]\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Expected ']'.\", lexer, -1 + ident.length );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \":\":\n\t\t\t{\n\t\t\t\tlexer.getNextChar();\n\t\t\t\tif ( lexer.match( \":\" ) ) // https://drafts.csswg.org/selectors-4/#pseudo-elements\n\t\t\t\t{\n\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected a pseudo-element name.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"pseudo-element\";\n\t\t\t\t\tselector.name = name;\n\t\t\t\t}\n\t\t\t\telse // https://drafts.csswg.org/selectors-4/#pseudo-classes\n\t\t\t\t{\n\t\t\t\t\tconst name = parseIdentifier( lexer );\n\t\t\t\t\tif ( !name ) throw syntaxError( \"Expected a pseudo-class name.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"pseudo-class\";\n\t\t\t\t\tselector.name = name;\n\t\t\t\t\t\n\t\t\t\t\tconst paramType = paramExpectations[name];\n\t\t\t\t\tif ( paramType != null )\n\t\t\t\t\t{\n\t\t\t\t\t\tselector.type = \"pseudo-fn\";\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( lexer.getNextChar() !== \"(\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Expected '('.\", lexer );\n\t\t\t\t\t\t\n\t\t\t\t\t\tswitch ( paramType )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase ParamTypes.IteratorOf: // https://drafts.csswg.org/selectors-4/#nth-child-pseudo\n\t\t\t\t\t\t\tcase ParamTypes.Iterator: // https://drafts.csswg.org/css-syntax-3/#anb-microsyntax\n\t\t\t\t\t\t\t\tlet A = 0, B = 0, ofSelector;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tanbSyntaxRE.lastIndex = lexer.index;\n\t\t\t\t\t\t\t\tconst match = anbSyntaxRE.exec( lexer.str );\n\t\t\t\t\t\t\t\tif ( !match ) throw syntaxError( \"Invalid parameter.\", lexer, 1 );\n\t\t\t\t\t\t\t\tlexer.advance( match[0].length );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( paramType === ParamTypes.IteratorOf )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\t\t\t\t\t\tconst savedIdx = lexer.index;\n\t\t\t\t\t\t\t\t\tif ( parseIdentifier( lexer ).toLowerCase() === \"of\" )\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tconst chr = lexer.getNextChar();\n\t\t\t\t\t\t\t\t\t\tif ( chr !== \")\" && !lexer.isWhiteSpace( chr ) )\n\t\t\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected whitespace.\", lexer );\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tofSelector = parseSelectorList( lexer, \")\" );\n\t\t\t\t\t\t\t\t\t\tif ( !(ofSelector instanceof Array) || ofSelector.length === 0 )\n\t\t\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected at least one selector.\", lexer );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse lexer.goToIndex( savedIdx );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( lexer.skipWhiteSpace() !== \")\" )\n\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected ')'.\", lexer );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( match[1] === \"even\" || match[1] === \"odd\" )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tA = 2;\n\t\t\t\t\t\t\t\t\tif ( match[1] === \"odd\" ) B = 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if ( match[5] ) // We found just an integer.\n\t\t\t\t\t\t\t\t\tB = parseInt( match[5], 10 );\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif ( match[2] === \"-\" ) A = -1;\n\t\t\t\t\t\t\t\t\telse if ( !match[2] || match[2] === \"+\" ) A = 1;\n\t\t\t\t\t\t\t\t\telse A = parseInt( match[2], 10 );\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif ( match[3] )\n\t\t\t\t\t\t\t\t\t\tB = parseInt( match[3] + match[4], 10 );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tselector.params = [A, B];\n\t\t\t\t\t\t\t\tif ( ofSelector ) selector.params.push( ofSelector );\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase ParamTypes.Selectors:\n\t\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\t\tselector.params = parseSelectorList( lexer, \")\", true );\n\t\t\t\t\t\t\t\tif ( selector.params.length === 0 )\n\t\t\t\t\t\t\t\t\tthrow syntaxError( \"Expected at least one selector.\", lexer );\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase ParamTypes.Identifier:\n\t\t\t\t\t\t\t\tif ( isIdentifierStart( lexer.getNextAfterWhiteSpace() ) )\n\t\t\t\t\t\t\t\t\tselector.params = [parseIdentifier( lexer )];\n\t\t\t\t\t\t\t\telse throw syntaxError( \"Expected an identifier.\", lexer );\n\t\t\t\t\t\t\t\tlexer.getNextChar();\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( lexer.skipWhiteSpace() !== \")\" ) throw syntaxError( \"Expected ')'.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\t// Having this branch here allows custom functional pseudo-classes with\n\t\t\t\t\t// these names to be defined by the user.\n\t\t\t\t\telse if ( name === \"before\" || name === \"after\" || name === \"first-line\" || name === \"first-letter\" )\n\t\t\t\t\t\tselector.type = \"pseudo-element\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcompound.push( selector );\n\t\t\t\tselector = {};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\t// https://drafts.csswg.org/selectors-4/#combinators\n\t\t\tcase \"+\":\n\t\t\tcase \">\":\n\t\t\tcase \"~\":\n\t\t\t\tif ( compound.length === 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( complex.length === 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tif ( relative )\n\t\t\t\t\t\t\tcomplex.unshift( [{type: \"pseudo-class\", name: \"scope\"}] );\n\t\t\t\t\t\telse throw syntaxError( \"Absolute selectors cannot start with a combinator.\", lexer );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( typeof complex[complex.length - 2] === \"string\" )\n\t\t\t\t\t\tthrow syntaxError( \"Cannot have multiple combinators in a row.\", lexer );\n\t\t\t\t\tcomplex.splice( complex.length - 1, 0, theChar );\n\t\t\t\t}\n\t\t\t\telse complex.push( theChar, compound = [] );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \",\":\n\t\t\t\tif ( compound.length === 0 )\n\t\t\t\t{\n\t\t\t\t\tif ( complex.length > 1 )\n\t\t\t\t\t{\n\t\t\t\t\t\tcomplex.pop();\n\t\t\t\t\t\tif ( typeof complex[complex.length - 1] === \"string\" )\n\t\t\t\t\t\t\tthrow syntaxError( \"Complex selectors are not allowed to end with a combinator.\", lexer, -1 );\n\t\t\t\t\t\tast.push( complex = [compound] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse ast.push( complex = [compound = []] );\n\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\tif ( lexer.isWhiteSpace( theChar ) )\n\t\t\t\t{\n\t\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\t\tcomplex.push( compound = [] );\n\t\t\t\t\tlexer.skipWhiteSpace();\n\t\t\t\t\tlexer.advance( -1 );\n\t\t\t\t}\n\t\t\t\telse if ( isIdentifierStart( theChar ) )\n\t\t\t\t{\n\t\t\t\t\tif ( compound.length > 0 )\n\t\t\t\t\t\tthrow syntaxError( \"Type (tag name) selectors must come before all other simple selectors.\", lexer );\n\t\t\t\t\t\n\t\t\t\t\tselector.type = \"type\";\n\t\t\t\t\t// We'll always have a valid identifier here, thanks to\n\t\t\t\t\t// the isIdentifierStart() above.\n\t\t\t\t\tselector.name = parseIdentifier( lexer ).toUpperCase();\n\t\t\t\t\t\n\t\t\t\t\tcompound.push( selector );\n\t\t\t\t\tselector = {};\n\t\t\t\t}\n\t\t\t\telse throw syntaxError( \"Unexpected character '\"+ theChar +\"'.\", lexer );\n\t\t}\n\t\ttheChar = lexer.getNextChar();\n\t}\n\t\n\tif ( compound.length === 0 )\n\t{\n\t\tif ( complex.length === 1 )\n\t\t{\n\t\t\tast.pop();\n\t\t\tcomplex = ast[ast.length - 1];\n\t\t}\n\t\telse complex.pop();\n\t}\n\t\n\tif ( complex && typeof complex[complex.length - 1] === \"string\" )\n\t\tthrow syntaxError( \"Complex selectors are not allowed to end with a combinator.\", lexer, -1 );\n\t\n\treturn ast;\n}\n\nfunction syntaxError( message, lexer, offset = 0 )\n{\n\tvar error = new SyntaxError( message ),\n\t\tcolumn = lexer.index + offset;\n\terror.stack = \"SyntaxError: \"+ message +\"\\n\\n\"+ lexer.str +\"\\n\"+ \" \".repeat( column ) +\"^\\n at index \"+ column;\n\treturn error;\n}\n\n// https://drafts.csswg.org/css-syntax-3/#consume-name\nfunction parseIdentifier( lexer )\n{\n\tvar name = \"\",\n\t\ttheChar = lexer.getChar();\n\t\n\tif ( isIdentifierStart( theChar ) )\n\t{\n\t\tdo\n\t\t{\n\t\t\tif ( theChar === \"\\\\\" )\n\t\t\t{\n\t\t\t\tname += parseEscapedCodePoint( lexer );\n\t\t\t\ttheChar = lexer.getChar();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tname += theChar;\n\t\t\t\ttheChar = lexer.getNextChar();\n\t\t\t}\n\t\t}\n\t\twhile ( theChar !== EOF && (isIdentifierStart( theChar ) || (theChar >= \"0\" && theChar <= \"9\") || theChar === \"-\") )\n\t\tlexer.advance( -1 );\n\t}\n\t\n\treturn name;\n}\n\n// https://drafts.csswg.org/css-syntax-3/#consume-escaped-code-point\nfunction parseEscapedCodePoint( lexer )\n{\n\tvar theChar = lexer.getNextChar();\n\t\n\tif ( isHexDigit( theChar ) )\n\t{\n\t\tlet codePoint = \"\";\n\t\t\n\t\tfor ( let i = 5; i >= 0 && isHexDigit( theChar ); i-- )\n\t\t{\n\t\t\tcodePoint += theChar;\n\t\t\ttheChar = lexer.getNextChar();\n\t\t}\n\t\t\n\t\tif ( lexer.isWhiteSpace( theChar ) )\n\t\t\tlexer.getNextChar();\n\t\t\n\t\tcodePoint = parseInt( codePoint, 16 ) | 0;\n\t\tif ( codePoint === 0 ||\n\t\t\t(codePoint >= 0xD800 && codePoint <= 0xDFFF) || // Surrogate\n\t\t\tcodePoint > 0x10FFFF ) // Maximum allowed code point\n\t\t\t\treturn \"\\uFFFD\";\n\t\treturn String.fromCodePoint( codePoint );\n\t}\n\telse if ( theChar === EOF ) return \"\\uFFFD\";\n\t\n\tlexer.getNextChar();\n\treturn theChar;\n}\n\nfunction isHexDigit( theChar )\n{\n\treturn (theChar !== EOF && ((theChar >= \"0\" && theChar <= \"9\") || (theChar >= \"A\" && theChar <= \"F\") || (theChar >= \"a\" && theChar <= \"f\")));\n}\n\nfunction isIdentifierStart( theChar )\n{\n\treturn ((theChar >= \"A\" && theChar <= \"Z\") || (theChar >= \"a\" && theChar <= \"z\") || theChar === \"_\" || theChar >= \"\\u0080\" || theChar === \"\\\\\");\n}","import {parseSelector} from \"./selector-parser.js\";\nimport Node from \"./node.js\";\nimport {NODE_TYPE, PARENT_NODE, TAG_NAME, spacesRE, getDocument} from \"./utils.js\";\n\nconst STATE_INITIAL = 0,\n\tSTATE_DESCENDANT_COMBINATOR = 1,\n\tSTATE_CHILD_COMBINATOR = 2,\n\tSTATE_NEXT_SIBLING_COMBINATOR = 3,\n\tSTATE_SUBSEQUENT_SIBLING_COMBINATOR = 4,\n\t\n\tstateTransitions = {\n\t\t\">\": STATE_CHILD_COMBINATOR,\n\t\t\"+\": STATE_NEXT_SIBLING_COMBINATOR,\n\t\t\"~\": STATE_SUBSEQUENT_SIBLING_COMBINATOR\n\t},\n\t\n\tpseudoProcs = {\n\t\tis( scope, node, selectors )\n\t\t{\n\t\t\treturn matchesSelectorList( scope, node, selectors );\n\t\t},\n\t\tnot( scope, node, selectors )\n\t\t{\n\t\t\treturn !matchesSelectorList( scope, node, selectors );\n\t\t},\n\t\thas( scope, node, selectors )\n\t\t{\n\t\t\tvar has = false;\n\t\t\t\n\t\t\tfor ( let i = 0; i < selectors.length; i++ )\n\t\t\t\tif ( selectors[i][0] instanceof Array && isRelativeSimpleSelector( selectors[i][0][0] ) )\n\t\t\t\t{\n\t\t\t\t\thas = matchesSelectorList( node, node, selectors, true );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\n\t\t\tif ( !has && node.childNodes.length > 0 ) node.forEach( elem =>\n\t\t\t{\n\t\t\t\tif ( matchesSelectorList( node, elem, selectors ) )\n\t\t\t\t{\n\t\t\t\t\thas = true;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t\n\t\t\treturn has;\n\t\t},\n\t\t\n\t\t[\"nth-child\"]( scope, node, args )\n\t\t{\n\t\t\tconst parent = node[PARENT_NODE],\n\t\t\t\tnodes = parent.childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] );\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t{\n\t\t\t\t\tif ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t[\"nth-last-child\"]( scope, node, args )\n\t\t{\n\t\t\tconst parent = node[PARENT_NODE],\n\t\t\t\tnodes = parent.childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] );\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t{\n\t\t\t\t\tif ( !args[2] || matchesSelectorList( parent, nodes[i], args[2] ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\t[\"nth-of-type\"]( scope, node, args )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] ),\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t{\n\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t}\n\t\t\t\n\t\t\t// For code here to be reachable, 'node' would have to not be inside\n\t\t\t// its own parent, or the above test of 'nodes[i] === node' would\n\t\t\t// have to be skippable. Since neither of these scenarios is\n\t\t\t// possible (for now), an explicit 'return false' here never\n\t\t\t// executes and isn't needed.\n\t\t},\n\t\t[\"nth-last-of-type\"]( scope, node, args )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\titer = new ChildIterator( args[0], args[1] ),\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t{\n\t\t\t\t\tconst iterMatch = iter.next();\n\t\t\t\t\tif ( nodes[i] === node )\n\t\t\t\t\t\treturn iterMatch;\n\t\t\t\t}\n\t\t\t\n\t\t\t// For code here to be reachable, 'node' would have to not be inside\n\t\t\t// its own parent, or the above test of 'nodes[i] === node' would\n\t\t\t// have to be skippable. Since neither of these scenarios is\n\t\t\t// possible (for now), an explicit 'return false' here never\n\t\t\t// executes and isn't needed.\n\t\t}\n\t},\n\tpseudoClasses = {\n\t\tscope( scope, node )\n\t\t{\n\t\t\treturn (node === scope);\n\t\t},\n\t\t\n\t\tenabled( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"BUTTON\":\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\tcase \"OPTGROUP\":\n\t\t\t\tcase \"OPTION\":\n\t\t\t\tcase \"FIELDSET\":\n\t\t\t\t\treturn !node.hasAttribute( \"disabled\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tdisabled( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"BUTTON\":\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\tcase \"OPTGROUP\":\n\t\t\t\tcase \"OPTION\":\n\t\t\t\tcase \"FIELDSET\":\n\t\t\t\t\treturn node.hasAttribute( \"disabled\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\tchecked( scope, node )\n\t\t{\n\t\t\tif ( node[TAG_NAME] === \"INPUT\" )\n\t\t\t{\n\t\t\t\tconst type = node.getAttribute( \"type\" );\n\t\t\t\tif ( type === \"checkbox\" || type === \"radio\" )\n\t\t\t\t\treturn node.hasAttribute( \"checked\" );\n\t\t\t}\n\t\t\telse if ( node[TAG_NAME] === \"OPTION\" )\n\t\t\t\treturn node.hasAttribute( \"selected\" );\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\trequired( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\t\treturn node.hasAttribute( \"required\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\toptional( scope, node )\n\t\t{\n\t\t\tswitch ( node[TAG_NAME] )\n\t\t\t{\n\t\t\t\tcase \"INPUT\":\n\t\t\t\tcase \"SELECT\":\n\t\t\t\tcase \"TEXTAREA\":\n\t\t\t\t\treturn !node.hasAttribute( \"required\" );\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t\n\t\troot( scope, node )\n\t\t{\n\t\t\tconst document = getDocument( scope );\n\t\t\treturn (!!document && document.documentElement === node);\n\t\t},\n\t\tempty( scope, node )\n\t\t{\n\t\t\treturn (node.childNodes.length === 0);\n\t\t},\n\t\t\n\t\t[\"first-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"last-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"only-child\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes;\n\t\t\tlet first, last;\n\t\t\tfor ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- )\n\t\t\t{\n\t\t\t\tif ( !first && nodes[s][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\tfirst = nodes[s];\n\t\t\t\tif ( !last && nodes[e][NODE_TYPE] === Node.ELEMENT_NODE )\n\t\t\t\t\tlast = nodes[e];\n\t\t\t}\n\t\t\treturn (first === last && first === node);\n\t\t},\n\t\t\n\t\t[\"first-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = 0; i < nodes.length; i++ )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"last-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tfor ( let i = nodes.length - 1; i >= 0; i-- )\n\t\t\t\tif ( nodes[i][TAG_NAME] === tagName )\n\t\t\t\t\treturn (nodes[i] === node);\n\t\t\t\n\t\t\t// For code here to be reachable, we would have to be looking at an\n\t\t\t// ELEMENT_NODE node inside a parent that has no ELEMENT_NODE nodes.\n\t\t\t// Therefore, an explicit 'return false' here never executes and\n\t\t\t// isn't needed.\n\t\t},\n\t\t[\"only-of-type\"]( scope, node )\n\t\t{\n\t\t\tconst nodes = node[PARENT_NODE].childNodes,\n\t\t\t\ttagName = node[TAG_NAME];\n\t\t\tlet first, last;\n\t\t\tfor ( let s = 0, e = nodes.length - 1; e >= 0 && !(first && last); s++, e-- )\n\t\t\t{\n\t\t\t\tif ( !first && nodes[s][TAG_NAME] === tagName )\n\t\t\t\t\tfirst = nodes[s];\n\t\t\t\tif ( !last && nodes[e][TAG_NAME] === tagName )\n\t\t\t\t\tlast = nodes[e];\n\t\t\t}\n\t\t\treturn (first === last && first === node);\n\t\t}\n\t};\n\npseudoProcs.where = pseudoProcs.is;\n\nexport function querySelector( scope, selector, all )\n{\n\tconst selectors = parseSelector( selector ),\n\t\tresult = [];\n\t\n\tscope.forEach( node =>\n\t{\n\t\tif ( matchesSelectorList( scope, node, selectors ) )\n\t\t{\n\t\t\tresult.push( node );\n\t\t\tif ( !all ) return false;\n\t\t}\n\t} );\n\t\n\treturn (all ? result : (result[0] || null));\n}\n\nexport function closest( scope, selector )\n{\n\tconst selectors = parseSelector( selector );\n\tlet node = scope;\n\t\n\twhile ( node != null && node[NODE_TYPE] === Node.ELEMENT_NODE )\n\t{\n\t\tif ( matchesSelectorList( scope, node, selectors ) )\n\t\t\treturn node;\n\t\tnode = node[PARENT_NODE];\n\t}\n\t\n\treturn null;\n}\n\nexport function matches( scope, selector )\n{\n\treturn matchesSelectorList( scope, scope, parseSelector( selector ) );\n}\n\nfunction matchesSelectorList( scope, node, selectors, relative = false )\n{\n\tvar currentNode;\n\t\nList:\n\tfor ( let i = 0; i < selectors.length; i++ )\n\t{\n\t\tconst complex = selectors[i];\n\t\tlet state = STATE_INITIAL;\n\t\t\n\t\tif ( relative && complex[0] instanceof Array && !isRelativeSimpleSelector( complex[0][0] ) )\n\t\t\tcontinue;\n\t\t\n\t\tcurrentNode = node;\n\t\t\n\tComplex:\n\t\tfor ( let x = (relative ? 0 : complex.length - 1);\n\t\t\t(relative ? x < complex.length : x >= 0);\n\t\t\t(relative ? x++ : x--) )\n\t\t{\n\t\t\tif ( stateTransitions.hasOwnProperty( complex[x] ) )\n\t\t\t\tstate = stateTransitions[complex[x]];\n\t\t\telse switch ( state )\n\t\t\t{\n\t\t\t\tcase STATE_INITIAL:\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tstate = STATE_DESCENDANT_COMBINATOR;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_DESCENDANT_COMBINATOR:\n\t\t\t\t\twhile ( currentNode = currentNode[PARENT_NODE] )\n\t\t\t\t\t\tif ( matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\t\tcontinue Complex;\n\t\t\t\t\tcontinue List;\n\t\t\t\t\t\n\t\t\t\tcase STATE_CHILD_COMBINATOR:\n\t\t\t\t\tcurrentNode = currentNode[PARENT_NODE];\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_NEXT_SIBLING_COMBINATOR:\n\t\t\t\t{\n\t\t\t\t\tconst nodes = currentNode[PARENT_NODE].childNodes;\n\t\t\t\t\tcurrentNode = nodes[nodes.indexOf( currentNode ) + (relative ? 1 : -1)];\n\t\t\t\t\tif ( !matchesCompoundSelector( scope, currentNode, complex[x] ) )\n\t\t\t\t\t\tcontinue List;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase STATE_SUBSEQUENT_SIBLING_COMBINATOR:\n\t\t\t\t{\n\t\t\t\t\tconst nodes = currentNode[PARENT_NODE].childNodes;\n\t\t\t\t\tfor ( let k = nodes.indexOf( currentNode ) + (relative ? 1 : -1);\n\t\t\t\t\t\t\t(relative ? k < nodes.length : k >= 0);\n\t\t\t\t\t\t\t(relative ? k++ : k--) )\n\t\t\t\t\t\tif ( matchesCompoundSelector( scope, nodes[k], complex[x] ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcurrentNode = nodes[k];\n\t\t\t\t\t\t\tcontinue Complex;\n\t\t\t\t\t\t}\n\t\t\t\t\tcontinue List;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction matchesCompoundSelector( scope, node, compound )\n{\n\tif ( !node || node[NODE_TYPE] !== Node.ELEMENT_NODE )\n\t\treturn false;\n\tfor ( let i = 0; i < compound.length; i++ )\n\t{\n\t\tconst simple = compound[i];\n\t\tlet matched;\n\t\t\n\t\tmatched = false;\n\t\tswitch ( simple.type )\n\t\t{\n\t\t\tcase \"universal\": return true;\n\t\t\t\n\t\t\tcase \"type\": matched = (node[TAG_NAME] === simple.name); break;\n\t\t\tcase \"id\": matched = (node.id === simple.name); break;\n\t\t\tcase \"class\": matched = node.classList.contains( simple.name ); break;\n\t\t\t\n\t\t\tcase \"attr\":\n\t\t\t\tif ( simple.comparison === \"=\" && (simple.value === true || simple.value === \"\") )\n\t\t\t\t\tmatched = node.hasAttribute( simple.name );\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlet attr = node.getAttribute( simple.name );\n\t\t\t\t\tif ( typeof attr === \"string\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tlet value = (simple.ignoreCase ? simple.value.toLowerCase() : simple.value);\n\t\t\t\t\t\tif ( simple.ignoreCase ) attr = attr.toLowerCase();\n\t\t\t\t\t\tif ( value !== \"\" ) switch ( simple.comparison )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase \"=\": matched = (attr === value); break;\n\t\t\t\t\t\t\tcase \"~=\": matched = attr.split( spacesRE ).indexOf( value ) !== -1; break;\n\t\t\t\t\t\t\tcase \"|=\": matched = (attr === value || attr.startsWith( value +\"-\" )); break;\n\t\t\t\t\t\t\tcase \"^=\": matched = attr.startsWith( value ); break;\n\t\t\t\t\t\t\tcase \"$=\": matched = attr.endsWith( value ); break;\n\t\t\t\t\t\t\tcase \"*=\": matched = attr.indexOf( value ) !== -1; break;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"pseudo-element\": break;\n\t\t\t\n\t\t\tcase \"pseudo-class\":\n\t\t\t\tif ( pseudoClasses.hasOwnProperty( simple.name ) )\n\t\t\t\t\tmatched = !!pseudoClasses[simple.name].call( null, scope, node );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"pseudo-fn\":\n\t\t\t\tif ( pseudoProcs.hasOwnProperty( simple.name ) )\n\t\t\t\t\tmatched = !!pseudoProcs[simple.name].call( null, scope, node, simple.params );\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif ( !matched ) return false;\n\t}\n\treturn true;\n}\n\nfunction isRelativeSimpleSelector( simple )\n{\n\treturn (!!simple && simple.type === \"pseudo-class\" && simple.name === \"scope\");\n}\n\nclass ChildIterator\n{\n\tconstructor( A, B )\n\t{\n\t\tthis.A = parseInt( A, 10 ) | 0;\n\t\tthis.B = parseInt( B, 10 ) | 0;\n\t\tthis.current = 0;\n\t}\n\t\n\tnext()\n\t{\n\t\tif ( this.A === 0 && this.B === 0 )\n\t\t\treturn false;\n\t\t\n\t\tthis.current += 1;\n\t\t\n\t\tlet match = false;\n\t\tif ( this.A === 0 )\n\t\t\tmatch = (this.current === this.B);\n\t\telse if ( (this.A < 0 && this.B >= this.current) || (this.A > 0 && this.current >= this.B) )\n\t\t\tmatch = (((this.current + this.B) % this.A) === 0);\n\t\t\n\t\treturn match;\n\t}\n}","import {PARSER_OPTIONS, nodeTypes, selfClosingTags, getDocument} from \"./utils.js\";\n\nexport function serializeNode( elem )\n{\n\tvar tagName = elem.tagName,\n\t\towner = getDocument( elem ),\n\t\tentities = owner ? owner.entityEncoder : null,\n\t\thtml = \"\";\n\tswitch ( elem.nodeType )\n\t{\n\t\tcase nodeTypes.ELEMENT_NODE:\n\t\t\ttagName = tagName.toLowerCase();\n\t\t\thtml += \"<\"+ tagName;\n\t\t\tfor ( let k in elem.attributes )\n\t\t\t\tif ( elem.attributes.hasOwnProperty( k ) )\n\t\t\t\t{\n\t\t\t\t\tlet attr = elem.attributes[k];\n\t\t\t\t\tif ( attr === true )\n\t\t\t\t\t\tattr = \"\";\n\t\t\t\t\telse if ( entities && owner[PARSER_OPTIONS] )\n\t\t\t\t\t\tattr = encodeEntities( attr, entities, owner[PARSER_OPTIONS] );\n\t\t\t\t\t\n\t\t\t\t\thtml += \" \"+ k;\n\t\t\t\t\tif ( attr !== \"\" )\n\t\t\t\t\t\thtml += '=\"'+ attr +'\"';\n\t\t\t\t}\n\t\t\thtml += \">\";\n\t\t\t\n\t\t\tfor ( let i = 0; i < elem.childNodes.length; i++ )\n\t\t\t\thtml += serializeNode( elem.childNodes[i] );\n\t\t\t\n\t\t\tif ( selfClosingTags[elem.tagName] !== true )\n\t\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.TEXT_NODE:\n\t\t\tif ( entities && owner[PARSER_OPTIONS] &&\n\t\t\t\t(!elem.parentNode || (elem.parentNode.tagName !== \"SCRIPT\" && elem.parentNode.tagName !== \"STYLE\")) )\n\t\t\t\t\thtml += encodeEntities( elem.nodeValue, entities, owner[PARSER_OPTIONS] );\n\t\t\telse html += elem.nodeValue;\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.CDATA_SECTION_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.PROCESSING_INSTRUCTION_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.COMMENT_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t\t\t\n\t\tcase nodeTypes.DOCUMENT_TYPE_NODE:\n\t\t\thtml += \"\";\n\t\t\tbreak;\n\t}\n\treturn html;\n}\n\nfunction encodeEntities( text, entities, options )\n{\n\tif ( options.encodeEntities === false )\n\t\treturn text;\n\telse if ( options.encodeEntities === true || !(options.encodeEntities instanceof RegExp) )\n\t\treturn entities.encode( text );\n\treturn entities.encode( text, options.encodeEntities );\n}","import DOM from \"./document.js\";\nimport Parser from \"./html-parser.js\";\nimport EventTarget from \"./event-target.js\";\nimport {createTokenList} from \"./token-list.js\";\nimport {createInlineStyle, updateInlineStyle} from \"./css-style-declaration.js\";\nimport {querySelector, closest, matches} from \"./selectors.js\";\nimport {serializeNode} from \"./serializer.js\";\nimport {DOCTYPE, HEAD, BODY, NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME, PARSER_OPTIONS,\n\tspacesRE, nodeTypes, selfClosingTags, setupDocument, getDocument, detachNodes, setNodeParent} from \"./utils.js\";\n\nconst CLASS_LIST = Symbol( \"classList\" );\nconst INLINE_STYLE = Symbol( \"style\" );\n\nexport const EXTEND_NODE = Symbol( \"extendNode\" );\n\nexport function createNode( nodeType, baseClass = Node )\n{\n\tconst node = Object.create( baseClass.prototype );\n\t\n\tnode[NODE_TYPE] = nodeType;\n\tnode.nodeValue = null;\n\tnode[PARENT_NODE] = null;\n\tnode[OWNER] = null;\n\t\n\tswitch ( nodeType )\n\t{\n\t\tcase Node.ELEMENT_NODE:\n\t\t\tnode[TAG_NAME] = null;\n\t\t\tnode.attributes = {};\n\t\t\t// fallthrough\n\t\t\t\n\t\tcase Node.DOCUMENT_NODE:\n\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\tnode.childNodes = [];\n\t}\n\t\n\treturn node;\n}\n\nexport default class Node extends EventTarget\n{\n\tconstructor()\n\t{\n\t\tsuper();\n\n\t\t// We allow `extend`-ing `class`-es to call super(EXTEND_NODE)\n\t\tif (arguments[0] === EXTEND_NODE) return;\n\n\t\tthrow new Error( \"Cannot directly instantiate Node.\" );\n\t}\n\t\n\tget nodeType() {return this[NODE_TYPE]}\n\t\n\tget nodeName()\n\t{\n\t\tswitch ( this.nodeType )\n\t\t{\n\t\t\tcase Node.ELEMENT_NODE: return this.tagName;\n\t\t\tcase Node.TEXT_NODE: return \"#text\";\n\t\t\tcase Node.CDATA_SECTION_NODE: return \"#cdata-section\";\n\t\t\tcase Node.PROCESSING_INSTRUCTION_NODE: return this.target;\n\t\t\tcase Node.COMMENT_NODE: return \"#comment\";\n\t\t\tcase Node.DOCUMENT_NODE: return \"#document\";\n\t\t\tcase Node.DOCUMENT_TYPE_NODE: return this.name;\n\t\t\tcase Node.DOCUMENT_FRAGMENT_NODE: return \"#document-fragment\";\n\t\t}\n\t}\n\t\n\tget parentNode() {return this[PARENT_NODE]}\n\tget ownerDocument() {return this[OWNER]}\n\tget tagName() {return this[TAG_NAME] || null}\n\t\n\tget firstChild()\n\t{\n\t\tif ( this.childNodes ) return this.childNodes[0] || null;\n\t\treturn null;\n\t}\n\t\n\tget lastChild()\n\t{\n\t\tif ( this.childNodes ) return this.childNodes[this.childNodes.length - 1] || null;\n\t\treturn null;\n\t}\n\t\n\tget previousSibling()\n\t{\n\t\tconst parent = this.parentNode;\n\t\tif ( parent )\n\t\t{\n\t\t\tconst idx = parent.childNodes.indexOf( this );\n\t\t\tif ( idx > 0 ) return parent.childNodes[idx - 1];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget nextSibling()\n\t{\n\t\tconst parent = this.parentNode;\n\t\tif ( parent )\n\t\t{\n\t\t\tconst idx = parent.childNodes.indexOf( this );\n\t\t\tif ( idx > -1 && idx < parent.childNodes.length - 1 ) return parent.childNodes[idx + 1];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget id()\n\t{\n\t\treturn (this.attributes && this.attributes.id) || \"\";\n\t}\n\tset id( id )\n\t{\n\t\tif ( this.attributes )\n\t\t\tthis.attributes.id = id;\n\t}\n\t\n\tget className()\n\t{\n\t\treturn (this.attributes && this.attributes.class) || \"\";\n\t}\n\tset className( val )\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tthis.classList.value = val;\n\t\t\tthis.attributes.class = this[CLASS_LIST].value;\n\t\t}\n\t}\n\t\n\tget classList()\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[CLASS_LIST] )\n\t\t\t\tthis[CLASS_LIST] = createTokenList( this );\n\t\t\treturn this[CLASS_LIST];\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tget innerHTML()\n\t{\n\t\tif ( this.nodeType === Node.ELEMENT_NODE )\n\t\t{\n\t\t\tlet html = \"\";\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\thtml += serializeNode( this.childNodes[i] );\n\t\t\treturn html;\n\t\t}\n\t\treturn null;\n\t}\n\tset innerHTML( html )\n\t{\n\t\tif ( this.nodeType === Node.ELEMENT_NODE && selfClosingTags[this.tagName] !== true )\n\t\t{\n\t\t\tconst nodes = parseHTML( this, html );\n\t\t\tif ( nodes )\n\t\t\t\taddChildNode( this, nodes, 0, this.childNodes.length );\n\t\t\telse\n\t\t\t{\n\t\t\t\tdetachNodes( this.childNodes );\n\t\t\t\tthis.childNodes.length = 0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tget outerHTML()\n\t{\n\t\treturn serializeNode( this );\n\t}\n\tset outerHTML( html )\n\t{\n\t\tif ( this.parentNode )\n\t\t{\n\t\t\tconst idx = this.parentNode.childNodes.indexOf( this ),\n\t\t\t\tnodes = parseHTML( this, html );\n\t\t\tif ( nodes )\n\t\t\t\taddChildNode( this.parentNode, nodes, idx, 1 );\n\t\t\telse detachNodes( this.parentNode.childNodes.splice( idx, 1 ) );\n\t\t}\n\t}\n\n\tget style()\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[INLINE_STYLE] )\n\t\t\t\tthis[INLINE_STYLE] = createInlineStyle( this );\n\t\t\treturn this[INLINE_STYLE];\n\t\t}\n\t\treturn null;\n\t}\n\tset style( value )\n\t{\n\t\tif ( this.attributes )\n\t\t{\n\t\t\tif ( !this[INLINE_STYLE] )\n\t\t\t\tthis[INLINE_STYLE] = createInlineStyle( this );\n\n\t\t\tupdateInlineStyle( this[INLINE_STYLE], value );\n\t\t}\n\t}\n\t\n\tget textContent()\n\t{\n\t\tif ( this.childNodes )\n\t\t{\n\t\t\tlet text = \"\";\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t{\n\t\t\t\tif ( this.childNodes[i].nodeType !== Node.COMMENT_NODE &&\n\t\t\t\t\t\tthis.childNodes[i].nodeType !== Node.CDATA_SECTION_NODE &&\n\t\t\t\t\t\tthis.childNodes[i].nodeType !== Node.PROCESSING_INSTRUCTION_NODE )\n\t\t\t\t\ttext += this.childNodes[i].textContent;\n\t\t\t}\n\t\t\treturn text;\n\t\t}\n\t\treturn this.nodeValue;\n\t}\n\tset textContent( text )\n\t{\n\t\tif ( text == null )\n\t\t\ttext = \"\";\n\t\telse if ( typeof text !== \"string\" )\n\t\t\ttext += \"\";\n\t\t\n\t\tif ( this.childNodes )\n\t\t{\n\t\t\tlet node = createNode( Node.TEXT_NODE );\n\t\t\tnode.nodeValue = text;\n\t\t\tsetNodeParent( node, this );\n\t\t\t\n\t\t\tdetachNodes( this.childNodes );\n\t\t\tthis.childNodes.length = 1;\n\t\t\tthis.childNodes[0] = node;\n\t\t}\n\t\telse if ( this.nodeType >= Node.TEXT_NODE && this.nodeType <= Node.COMMENT_NODE )\n\t\t\tthis.nodeValue = text;\n\t}\n\t\n\tgetRootNode()\n\t{\n\t\tlet rootNode = this;\n\t\twhile ( rootNode.parentNode )\n\t\t\trootNode = rootNode.parentNode;\n\t\treturn rootNode;\n\t}\n\t\n\thasAttributes()\n\t{\n\t\tif ( this.attributes ) for ( let k in this.attributes )\n\t\t\tif ( this.attributes.hasOwnProperty( k ) ) return true;\n\t\treturn false;\n\t}\n\t\n\tgetAttributeNames()\n\t{\n\t\tif ( this.attributes )\n\t\t\treturn Object.keys( this.attributes );\n\t\treturn [];\n\t}\n\t\n\tgetAttribute( name )\n\t{\n\t\tvar result;\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t\tresult = this.attributes[lowerAttributeCase( this, name )];\n\t\tif ( result === undefined )\n\t\t\treturn null;\n\t\treturn result;\n\t}\n\t\n\tsetAttribute( name, value )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( name === \"class\" )\n\t\t\t{\n\t\t\t\tif ( value !== true )\n\t\t\t\t\tthis.className = \"\"+ value;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.classList.value = \"\";\n\t\t\t\t\tthis.attributes[name] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( typeof value === \"string\" || value === true )\n\t\t\t\tthis.attributes[name] = value;\n\t\t\telse this.attributes[name] = \"\"+ value;\n\t\t}\n\t}\n\t\n\ttoggleAttribute( name, force )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( !this.attributes.hasOwnProperty( name ) )\n\t\t\t{\n\t\t\t\tif ( arguments.length === 1 || force === true )\n\t\t\t\t\treturn (this.attributes[name] = true);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse if ( arguments.length === 1 || force === false )\n\t\t\t{\n\t\t\t\tdelete this.attributes[name];\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\t\n\tremoveAttribute( name )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t{\n\t\t\tname = lowerAttributeCase( this, name );\n\t\t\tif ( name === \"class\" && this[CLASS_LIST] )\n\t\t\t\tthis[CLASS_LIST].value = null;\n\t\t\tdelete this.attributes[name];\n\t\t}\n\t}\n\t\n\thasAttribute( name )\n\t{\n\t\tif ( this.attributes && name && typeof name === \"string\" )\n\t\t\treturn this.attributes.hasOwnProperty( lowerAttributeCase( this, name ) );\n\t\treturn false;\n\t}\n\t\n\thasChildNodes()\n\t{\n\t\treturn (!!this.childNodes && this.childNodes.length > 0);\n\t}\n\t\n\tappendChild( child )\n\t{\n\t\treturn this.insertBefore( child, null );\n\t}\n\t\n\tinsertBefore( newChild, refChild )\n\t{\n\t\tif ( this.childNodes && newChild instanceof Node && arguments.length > 1 )\n\t\t{\n\t\t\tlet idx = -1;\n\t\t\t\n\t\t\tif ( refChild == null )\n\t\t\t\tidx = this.childNodes.length;\n\t\t\telse if ( refChild instanceof Node && refChild.parentNode === this )\n\t\t\t\tidx = this.childNodes.indexOf( refChild );\n\t\t\t\n\t\t\tif ( idx !== -1 )\n\t\t\t\treturn addChildNode( this, newChild, idx );\n\t\t}\n\t\treturn null;\n\t}\n\t\n\treplaceChild( newChild, oldChild )\n\t{\n\t\tif ( this.childNodes && oldChild instanceof Node && newChild instanceof Node &&\n\t\t\toldChild.parentNode === this && oldChild !== newChild )\n\t\t{\n\t\t\taddChildNode( this, newChild, this.childNodes.indexOf( oldChild ), 1 );\n\t\t\treturn oldChild;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tremoveChild( child )\n\t{\n\t\tif ( this.childNodes && child instanceof Node && child.parentNode === this )\n\t\t{\n\t\t\tconst idx = this.childNodes.indexOf( child ),\n\t\t\t\towner = getDocument( this );\n\t\t\t\n\t\t\tif ( owner && child.parentNode === owner.documentElement && tagNameProp.hasOwnProperty( child.tagName ) )\n\t\t\t\towner[tagNameProp[child.tagName]] = null;\n\t\t\t\n\t\t\tdetachNodes( this.childNodes.splice( idx, 1 ) );\n\t\t\treturn child;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tcloneNode( deep )\n\t{\n\t\tvar clone;\n\t\t\n\t\tif ( this.nodeType === Node.DOCUMENT_NODE || this.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t\t\tclone = new DOM( null, this[PARSER_OPTIONS] );\n\t\telse clone = createNode( this.nodeType );\n\t\t\n\t\tswitch ( this.nodeType )\n\t\t{\n\t\t\tcase Node.ELEMENT_NODE:\n\t\t\t\tclone[TAG_NAME] = this.tagName;\n\t\t\t\tclone.attributes = Object.assign( clone.attributes, this.attributes );\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.TEXT_NODE:\n\t\t\tcase Node.CDATA_SECTION_NODE:\n\t\t\tcase Node.PROCESSING_INSTRUCTION_NODE:\n\t\t\tcase Node.COMMENT_NODE:\n\t\t\t\tclone.nodeValue = this.nodeValue;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.DOCUMENT_NODE:\n\t\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\t\tclone[NODE_TYPE] = this.nodeType;\n\t\t\t\tclone.entityEncoder.entities = this.entityEncoder;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase Node.DOCUMENT_TYPE_NODE:\n\t\t\t\tclone.name = this.name;\n\t\t\t\tclone.publicId = this.publicId;\n\t\t\t\tclone.systemId = this.systemId;\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif ( deep === true && this.childNodes && this.childNodes.length > 0 )\n\t\t{\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\tclone.appendChild( this.childNodes[i].cloneNode( true ) );\n\t\t\t\n\t\t\tif ( clone.nodeType === Node.DOCUMENT_NODE || clone.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t\t\t\tsetupDocument( clone );\n\t\t}\n\t\t\n\t\treturn clone;\n\t}\n\t\n\tgetElementById( id )\n\t{\n\t\tvar elem = null;\n\t\tif ( id && typeof id === \"string\" && this.childNodes )\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( node.id === id )\n\t\t\t\t{\n\t\t\t\t\telem = node;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} );\n\t\treturn elem;\n\t}\n\t\n\tgetElementsByClassName( className )\n\t{\n\t\tvar nodeList = [];\n\t\tif ( className && typeof className === \"string\" )\n\t\t{\n\t\t\tconst classList = className.trim().split( spacesRE );\n\t\t\tif ( classList.length > 1 || classList[0] !== \"\" ) this.forEach( node =>\n\t\t\t{\n\t\t\t\tfor ( let i = 0; i < classList.length; i++ )\n\t\t\t\t\tif ( !node.classList.contains( classList[i] ) )\n\t\t\t\t\t\treturn;\n\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\t}\n\t\treturn nodeList;\n\t}\n\t\n\tgetElementsByTagName( tagName )\n\t{\n\t\tvar nodeList = [];\n\t\tif ( tagName && typeof tagName === \"string\" )\n\t\t{\n\t\t\ttagName = tagName.toUpperCase();\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( tagName === \"*\" || node.tagName === tagName )\n\t\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\t}\n\t\treturn nodeList;\n\t}\n\t\n\tclosest( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn closest( this, selector );\n\t\telse return null;\n\t}\n\t\n\tmatches( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn matches( this, selector );\n\t\telse return false;\n\t}\n\t\n\tquerySelector( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn querySelector( this, selector, false );\n\t\telse return null;\n\t}\n\t\n\tquerySelectorAll( selector )\n\t{\n\t\tif ( selector && typeof selector === \"string\" )\n\t\t\treturn querySelector( this, selector, true );\n\t\telse return [];\n\t}\n\t\n\t// Non-standard\n\t\n\tforEach( callback, type = nodeTypes.ELEMENT_NODE )\n\t{\n\t\t// This unrolled recursive function is about 1.45x faster in Node than its\n\t\t// equivalent recursive form.\n\t\t\n\t\tlet childNodes = this.childNodes,\n\t\t\tcurrent = this.firstChild,\n\t\t\tidxStack = [],\n\t\t\tidx = 0,\n\t\t\tparent, nextSibling;\n\t\t\n\t\twhile ( current )\n\t\t{\n\t\t\t// 'parent' and 'nextSibling' are stored here so that if callback() changes\n\t\t\t// the document, we can maintain our place in the overall list of nodes by\n\t\t\t// looking for insertions, deletions, or replacements within the 'current'\n\t\t\t// node's list of siblings.\n\t\t\tparent = current[PARENT_NODE];\n\t\t\tnextSibling = childNodes[idx + 1];\n\t\t\t\n\t\t\tif ( (type === null || current.nodeType === type) &&\n\t\t\t\tcallback( current, parent ) === false )\n\t\t\t\t\treturn;\n\t\t\t\n\t\t\t// If the parent of 'current' changes during callback(), we no longer want to\n\t\t\t// look at the children of 'current' here as it was either moved or removed.\n\t\t\tif ( current[PARENT_NODE] === parent && current.childNodes && current.childNodes.length > 0 )\n\t\t\t{\n\t\t\t\tidxStack.push( idx );\n\t\t\t\tchildNodes = current.childNodes;\n\t\t\t\tcurrent = childNodes[idx = 0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif ( nextSibling )\n\t\t\t\t{\n\t\t\t\t\tidx += 1;\n\t\t\t\t\t// If callback() changed the number of nodes that come before the\n\t\t\t\t\t// previously found 'nextSibling', 'idx' needs to be updated so we\n\t\t\t\t\t// don't skip over or repeat visits to any nodes.\n\t\t\t\t\tif ( nextSibling !== childNodes[idx] )\n\t\t\t\t\t\tidx = parent.childNodes.indexOf( nextSibling );\n\t\t\t\t}\n\t\t\t\telse idx = childNodes.length;\n\t\t\t\t\n\t\t\t\twhile ( childNodes[idx] == null )\n\t\t\t\t{\n\t\t\t\t\tcurrent = parent;\n\t\t\t\t\tparent = current[PARENT_NODE];\n\t\t\t\t\tif ( current && current !== this )\n\t\t\t\t\t{\n\t\t\t\t\t\tchildNodes = parent.childNodes;\n\t\t\t\t\t\tidx = idxStack.pop() + 1;\n\t\t\t\t\t}\n\t\t\t\t\telse return;\n\t\t\t\t}\n\t\t\t\tcurrent = childNodes[idx];\n\t\t\t}\n\t\t}\n\t}\n}\n\nObject.defineProperties( Node,\n{\n\tELEMENT_NODE: {value: nodeTypes.ELEMENT_NODE},\n\t//ATTRIBUTE_NODE: {value: nodeTypes.ATTRIBUTE_NODE},\n\tTEXT_NODE: {value: nodeTypes.TEXT_NODE},\n\tCDATA_SECTION_NODE: {value: nodeTypes.CDATA_SECTION_NODE},\n\t//ENTITY_REFERENCE_NODE: {value: nodeTypes.ENTITY_REFERENCE_NODE},\n\t//ENTITY_NODE: {value: nodeTypes.ENTITY_NODE},\n\tPROCESSING_INSTRUCTION_NODE: {value: nodeTypes.PROCESSING_INSTRUCTION_NODE},\n\tCOMMENT_NODE: {value: nodeTypes.COMMENT_NODE},\n\tDOCUMENT_NODE: {value: nodeTypes.DOCUMENT_NODE},\n\tDOCUMENT_TYPE_NODE: {value: nodeTypes.DOCUMENT_TYPE_NODE},\n\tDOCUMENT_FRAGMENT_NODE: {value: nodeTypes.DOCUMENT_FRAGMENT_NODE},\n\t//NOTATION_NODE: {value: nodeTypes.NOTATION_NODE},\n} );\n\nconst tagNameProp = {\n\tHEAD,\n\tBODY,\n\tFRAMESET: BODY\n};\n\nfunction addChildNode( parent, node, index, removalCount = 0 )\n{\n\tif ( !parent ||\n\t\t(parent.nodeType !== Node.ELEMENT_NODE &&\n\t \t\tparent.nodeType !== Node.DOCUMENT_NODE &&\n\t \t\tparent.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) ||\n\t\t(parent.nodeType === Node.ELEMENT_NODE && selfClosingTags[parent.tagName] === true) )\n\t\t\treturn node;\n\t\n\tif ( node.nodeType <= Node.COMMENT_NODE )\n\t{\n\t\tif ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE )\n\t\t{\n\t\t\tif ( tagNameProp.hasOwnProperty( node.tagName ) )\n\t\t\t{\n\t\t\t\tconst prop = tagNameProp[node.tagName];\n\t\t\t\tif ( parent.parentNode[prop] && removalCount === 0 )\n\t\t\t\t\treturn node;\n\t\t\t\tparent.parentNode[prop] = node;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ( node.parentNode )\n\t\t\tnode.parentNode.removeChild( node );\n\t\tsetNodeParent( node, parent );\n\t\tdetachNodes( parent.childNodes.splice( index, removalCount, node ) );\n\t}\n\telse if ( node.nodeType === Node.DOCUMENT_TYPE_NODE &&\n\t\t(parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) )\n\t{\n\t\tconst owner = node.parentNode;\n\t\tif ( owner && (owner.nodeType === Node.DOCUMENT_NODE || owner.nodeType === Node.DOCUMENT_FRAGMENT_NODE) )\n\t\t{\n\t\t\towner.removeChild( node );\n\t\t\towner[DOCTYPE] = null;\n\t\t}\n\t\tsetNodeParent( node, parent );\n\t\tdetachNodes( parent.childNodes.splice( index, removalCount, node ) );\n\t\tparent[DOCTYPE] = node;\n\t}\n\telse if ( node.nodeType === Node.DOCUMENT_FRAGMENT_NODE )\n\t{\n\t\tif ( parent.parentNode && parent.parentNode.nodeType === Node.DOCUMENT_NODE )\n\t\t{\n\t\t\tif ( removalCount > 0 )\n\t\t\t\tdetachNodes( parent.childNodes.splice( index, removalCount ) );\n\t\t\tfor ( let i = node.childNodes.length - 1; i >= 0; i-- )\n\t\t\t{\n\t\t\t\tconst child = node.childNodes[i];\n\t\t\t\tif ( tagNameProp.hasOwnProperty( child.tagName ) )\n\t\t\t\t{\n\t\t\t\t\tconst prop = tagNameProp[child.tagName];\n\t\t\t\t\tif ( parent.parentNode[prop] && removalCount === 0 )\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tparent.parentNode[prop] = child;\n\t\t\t\t}\n\t\t\t\tsetNodeParent( child, parent );\n\t\t\t\tparent.childNodes.splice( index, 0, child );\n\t\t\t\tnode.childNodes.splice( i, 1 );\n\t\t\t}\n\t\t}\n\t\telse if ( node !== getDocument( parent ) )\n\t\t{\n\t\t\tfor ( let i = 0; i < node.childNodes.length; i++ )\n\t\t\t\tsetNodeParent( node.childNodes[i], parent );\n\t\t\tdetachNodes( parent.childNodes.splice( index, removalCount, ...node.childNodes ) );\n\t\t\tnode.childNodes.length = 0;\n\t\t}\n\t}\n\t\n\treturn node;\n}\n\nfunction parseHTML( parent, html )\n{\n\tif ( html && typeof html === \"string\" )\n\t{\n\t\tconst owner = getDocument( parent );\n\t\treturn new Parser( html, owner ? owner[PARSER_OPTIONS] : null, owner ? owner.entityEncoder : null ).parseHTML();\n\t}\n}\n\nfunction lowerAttributeCase( node, name )\n{\n\tconst owner = getDocument( node );\n\tif ( owner && owner[PARSER_OPTIONS].lowerAttributeCase )\n\t\treturn name.toLowerCase();\n\treturn name;\n}","import {Lexer, EOF} from \"./lexer.js\";\nimport Node, {createNode} from \"./node.js\";\nimport {NODE_TYPE, TAG_NAME, PARSER_OPTIONS, spacesRE, selfClosingTags, setNodeParent, globalizeRegExp} from \"./utils.js\";\n\nconst toLowerCase = String.prototype.toLowerCase,\n\ttoUpperCase = String.prototype.toUpperCase,\n\t\n\tdefaultOptions = {\n\t\tallowCustomRootElement: false,\n\t\tallowSelfClosingSyntax: false,\n\t\tallowCDATA: false,\n\t\tallowProcessingInstructions: false,\n\t\tdecodeEntities: false,\n\t\tencodeEntities: false,\n\t\tcollapseWhitespace: false,\n\t\ttrimWhitespace: false,\n\t\tlowerAttributeCase: false\n\t},\n\t\n\tSTATE_START_TAG = 0,\n\tSTATE_ATTRIBUTE = 1,\n\tSTATE_END_TAG = 2,\n\t\n\t// '12.1.2.3 Attributes' from HTML5 spec.\n\tattributeNameExclusions = {\n\t\t//\"\\0\": true, // This is caught by the lexer in isWhiteSpace().\n\t\t//'\"': true, // Disabled to better match browser behaviour.\n\t\t//\"'\": true, // Disabled to better match browser behaviour.\n\t\t\">\": true,\n\t\t\"/\": true,\n\t\t\"=\": true\n\t},\n\t\n\tpTagBoundary = {P: true},\n\tdefinitionTagBoundary = {DT: true, DD: true},\n\ttableStructureTagBoundary = {TBODY: true, THEAD: true, TFOOT: true},\n\ttableCellTagBoundary = {TD: true, TH: true},\n\tformElementTagBoundary = {BUTTON: true, DATALIST: true, OPTGROUP: true, OPTION: true, PROGRESS: true, SELECT: true, TEXTAREA: true},\n\t\n\t// Largely based on '8.1.2.4 Optional tags' from the HTML5 spec.\n\t// https://www.w3.org/TR/html50/syntax.html#syntax-tag-omission\n\ttagBoundaries = {\n\t\tADDRESS: pTagBoundary,\n\t\tARTICLE: pTagBoundary,\n\t\tASIDE: pTagBoundary,\n\t\tBLOCKQUOTE: pTagBoundary,\n\t\tDIV: pTagBoundary,\n\t\tFIELDSET: pTagBoundary,\n\t\tFOOTER: pTagBoundary,\n\t\tH1: pTagBoundary,\n\t\tH2: pTagBoundary,\n\t\tH3: pTagBoundary,\n\t\tH4: pTagBoundary,\n\t\tH5: pTagBoundary,\n\t\tH6: pTagBoundary,\n\t\tHEADER: pTagBoundary,\n\t\tHGROUP: pTagBoundary,\n\t\tHR: pTagBoundary,\n\t\tMAIN: pTagBoundary,\n\t\tNAV: pTagBoundary,\n\t\tP: pTagBoundary,\n\t\tPRE: pTagBoundary,\n\t\tSECTION: pTagBoundary,\n\t\t\n\t\tBODY: {HEAD: true, TITLE: true},\n\t\t\n\t\t// Definitions\n\t\tDL: pTagBoundary,\n\t\tDD: definitionTagBoundary,\n\t\tDT: definitionTagBoundary,\n\t\t\n\t\t// Tables\n\t\tTABLE: pTagBoundary,\n\t\tTBODY: tableStructureTagBoundary,\n\t\tTHEAD: tableStructureTagBoundary,\n\t\tTD: tableCellTagBoundary,\n\t\tTFOOT: tableStructureTagBoundary,\n\t\tTH: tableCellTagBoundary,\n\t\tTR: {TR: true},\n\t\t\n\t\t// Lists\n\t\tLI: {LI: true},\n\t\tOL: pTagBoundary,\n\t\tUL: pTagBoundary,\n\t\t\n\t\t// Forms\n\t\tBUTTON: formElementTagBoundary,\n\t\tDATALIST: formElementTagBoundary,\n\t\tFORM: pTagBoundary,\n\t\tINPUT: formElementTagBoundary,\n\t\tOPTGROUP: {OPTGROUP: true, OPTION: true},\n\t\tOPTION: {OPTION: true},\n\t\tOUTPUT: formElementTagBoundary,\n\t\tPROGRESS: formElementTagBoundary,\n\t\tSELECT: formElementTagBoundary,\n\t\tTEXTAREA: formElementTagBoundary,\n\t};\n\nexport default class Parser\n{\n\tconstructor( html, options, entityEncoder )\n\t{\n\t\tthis.options = Parser.setupOptions( options );\n\t\tthis.lexer = new Lexer( html );\n\t\tthis.entityEncoder = entityEncoder;\n\t}\n\t\n\tstatic setupOptions( options )\n\t{\n\t\toptions = Object.assign( {}, defaultOptions, options );\n\t\tif ( options.encodeEntities instanceof RegExp )\n\t\t\toptions.encodeEntities = globalizeRegExp( options.encodeEntities );\n\t\treturn Object.freeze( options );\n\t}\n\t\n\tstatic isNameCharStart( chr )\n\t{\n\t\treturn chr === \":\" || chr === \"_\" || (chr >= \"A\" && chr <= \"Z\") || (chr >= \"a\" && chr <= \"z\") ||\n\t\t\t(chr >= \"\\xC0\" && chr <= \"\\xD6\") || (chr >= \"\\xD8\" && chr <= \"\\xF6\") ||\n\t\t\t(chr >= \"\\xF8\" && chr <= \"\\u02FF\") || (chr >= \"\\u0370\" && chr <= \"\\u037D\") ||\n\t\t\t(chr >= \"\\u037F\" && chr <= \"\\u1FFF\") || chr === \"\\u200C\" || chr === \"\\u200D\" ||\n\t\t\t(chr >= \"\\u2070\" && chr <= \"\\u218F\") || (chr >= \"\\u2C00\" && chr <= \"\\u2FEF\") ||\n\t\t\t(chr >= \"\\u3001\" && chr <= \"\\uD7FF\") || (chr >= \"\\uF900\" && chr <= \"\\uFDCF\") ||\n\t\t\t(chr >= \"\\uFDF0\" && chr <= \"\\uFFFD\") || (chr >= \"\\u10000\" && chr <= \"\\uEFFFF\");\n\t}\n\t\n\tstatic isNameChar( chr )\n\t{\n\t\treturn Parser.isNameCharStart( chr ) ||\n\t\t\t(chr >= \"0\" && chr <= \"9\") || chr === \"-\" || chr === \".\" || chr === \"\\xB7\" ||\n\t\t\t(chr >= \"\\u0300\" && chr <= \"\\u036F\") || chr === \"\\u203F\" || chr === \"\\u2040\";\n\t}\n\t\n\tparseHTML()\n\t{\n\t\tvar rootNode = createNode( Node.DOCUMENT_FRAGMENT_NODE ),\n\t\t\tscopeChain = [rootNode], theChar;\n\t\t\n\t\trootNode[PARSER_OPTIONS] = this.options;\n\t\t\n\t\tif ( this.options.trimWhitespace )\n\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\telse theChar = this.lexer.getChar();\n\t\t\n\t\twhile ( theChar !== EOF && scopeChain.length > 0 )\n\t\t{\n\t\t\tif ( theChar === \"<\" )\n\t\t\t\tthis.parseTag( scopeChain );\n\t\t\telse this.parseText( scopeChain );\n\t\t\t\n\t\t\tif ( this.options.trimWhitespace )\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\telse theChar = this.lexer.getChar();\n\t\t}\n\t\t\n\t\treturn rootNode;\n\t}\n\t\n\tparseTag( scopeChain )\n\t{\n\t\tvar node, name, selfClosing, state = STATE_START_TAG,\n\t\t\ttagStartIdx = this.lexer.index,\n\t\t\ttheChar = this.lexer.getNextChar(),\n\t\t\tstartIdx, endIdx;\n\t\t\n\t\tif ( theChar !== EOF )\n\tMain:\n\t\twhile ( theChar !== \">\" && theChar !== EOF )\n\t\t{\n\t\t\tstartIdx = this.lexer.index;\n\t\t\t\n\t\t\tif ( state === STATE_START_TAG )\n\t\t\t{\n\t\t\t\tif ( theChar === \"!\" || theChar === \"?\" )\n\t\t\t\t{\n\t\t\t\t\tif ( this.options.allowProcessingInstructions && this.lexer.match( \"?\" ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\ttheChar = this.lexer.getChar();\n\t\t\t\t\tPINode:\n\t\t\t\t\t\tif ( Parser.isNameCharStart( theChar ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode = createNode( Node.PROCESSING_INSTRUCTION_NODE );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Find target's name.\n\t\t\t\t\t\t\twhile ( theChar !== EOF && Parser.isNameChar( theChar ) )\n\t\t\t\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// If we have a non-whitespace character here that isn't EOF or\n\t\t\t\t\t\t\t// the end '?>', then we've come across an invalid name character\n\t\t\t\t\t\t\t// in the target name and this tag should be treated as a comment.\n\t\t\t\t\t\t\tif ( !this.lexer.isWhiteSpace( theChar ) && theChar !== EOF &&\n\t\t\t\t\t\t\t\t\t!(theChar === \"?\" && this.lexer.peek() === \">\") )\n\t\t\t\t\t\t\t\tbreak PINode;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tnode.target = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.lexer.skipWhiteSpace();\n\t\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\t\tthis.lexer.goToString( \"?>\" );\n\t\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\t\tthis.lexer.advance( 1 );\n\t\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Go back to before the first '?' to include everything between the\n\t\t\t\t\t\t// angle brackets in the comment we're going to create from this tag.\n\t\t\t\t\t\tthis.lexer.advance( startIdx - this.lexer.index - 1 );\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ( this.options.allowCDATA && this.lexer.match( \"![CDATA[\" ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tnode = createNode( Node.CDATA_SECTION_NODE );\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tthis.lexer.goToString( \"]]>\" );\n\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\tthis.lexer.advance( 2 );\n\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( this.lexer.match( \"!DOCTYPE\", false ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.lexer.skipWhiteSpace();\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tthis.lexer.goToString( \">\" );\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet rootNode = scopeChain[scopeChain.length - 1];\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( rootNode.doctype )\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\telse if ( rootNode.childNodes.length > 0 )\n\t\t\t\t\t\t\tfor ( let i = rootNode.childNodes.length - 1; i >= 0; i-- )\n\t\t\t\t\t\t\t\tif ( rootNode.childNodes[i].nodeType < Node.TEXT_NODE || rootNode.childNodes[i].nodeType > Node.COMMENT_NODE )\n\t\t\t\t\t\t\t\t\tbreak Main;\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet params = this.lexer.str.slice( startIdx, this.lexer.index ).split( spacesRE );\n\t\t\t\t\t\tnode = createNode( Node.DOCUMENT_TYPE_NODE );\n\t\t\t\t\t\tnode.name = toLowerCase.call( params.shift() );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( params.length > 1 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlet idType = toLowerCase.call( params.shift() );\n\t\t\t\t\t\t\tparams = params.join( \" \" ).split( '\"' );\n\t\t\t\t\t\t\tif ( params[0] === \"\" ) switch ( idType )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcase \"public\":\n\t\t\t\t\t\t\t\t\tparams.shift();\n\t\t\t\t\t\t\t\t\tnode.publicId = params.shift();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcase \"system\":\n\t\t\t\t\t\t\t\t\tparams.shift();\n\t\t\t\t\t\t\t\t\tnode.systemId = params.shift();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( !node.publicId ) node.publicId = \"\";\n\t\t\t\t\t\tif ( !node.systemId ) node.systemId = \"\";\n\t\t\t\t\t\t\n\t\t\t\t\t\trootNode.childNodes.push( node );\n\t\t\t\t\t\trootNode.doctype = node;\n\t\t\t\t\t\tsetNodeParent( node, rootNode );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlet endTag;\n\t\t\t\t\t\tif ( this.lexer.match( \"!--\" ) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( !this.lexer.match( \">\" ) && !this.lexer.match( \"->\" ) )\n\t\t\t\t\t\t\t\tendTag = \"-->\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif ( theChar === \"!\" ) // Don't skip question marks that show up here.\n\t\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\tendTag = \">\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tnode = createNode( Node.COMMENT_NODE );\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\tif ( endTag ) this.lexer.goToString( endTag );\n\t\t\t\t\t\tnode.nodeValue = this.lexer.str.slice( startIdx, this.lexer.index );\n\t\t\t\t\t\tthis.lexer.advance( endTag ? endTag.length - 1 : -1 );\n\t\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ( theChar === \"/\" )\n\t\t\t\t{\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tstate = STATE_END_TAG;\n\t\t\t\t\tstartIdx += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ( state === STATE_ATTRIBUTE )\n\t\t\t{\n\t\t\t\t// Find an attribute name.\n\t\t\t\twhile ( (this.lexer.index === startIdx && theChar === \"=\") ||\n\t\t\t\t\t\t(!this.lexer.isWhiteSpace( theChar ) &&\n \t\t\t\t\t\t!attributeNameExclusions[theChar] &&\n \t\t\t\t\t\ttheChar !== EOF) )\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\tendIdx = this.lexer.index;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Find a tag name.\n\t\t\t\twhile ( ((theChar >= \"a\" && theChar <= \"z\") || (theChar >= \"A\" && theChar <= \"Z\") ||\n\t\t\t\t\t\t(this.lexer.index > startIdx && ((theChar >= \"0\" && theChar <= \"9\") || theChar === \"-\" || theChar === \"_\" || theChar === \":\"))) &&\n\t\t\t\t\t\ttheChar !== EOF )\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\tif ( theChar === EOF )\n\t\t\t\t{\n\t\t\t\t\tthis.addTextNode( scopeChain, tagStartIdx, endIdx, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\n\t\t\t\tif ( state === STATE_END_TAG )\n\t\t\t\t\ttheChar = this.lexer.goToString( \">\" );\n\t\t\t}\n\t\t\t\n\t\t\tif ( startIdx === endIdx )\n\t\t\t{\n\t\t\t\t// Found an illegal character while searching for an attribute or tag name.\n\t\t\t\tif ( this.options.allowSelfClosingSyntax && theChar === \"/\" && this.lexer.peek() === \">\" )\n\t\t\t\t{\n\t\t\t\t\t// If self-closing tag syntax is allowed, and we've found \"/>\", then we\n\t\t\t\t\t// need to close the tag at the top of the scope chain.\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tstate = STATE_END_TAG;\n\t\t\t\t\tname = scopeChain[0][TAG_NAME];\n\t\t\t\t}\n\t\t\t\telse if ( state === STATE_START_TAG )\n\t\t\t\t{\n\t\t\t\t\tthis.lexer.goToString( \"<\" );\n\t\t\t\t\tthis.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false );\n\t\t\t\t\ttagStartIdx = this.lexer.index;\n\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if ( state === STATE_END_TAG )\n\t\t\t\t{\n\t\t\t\t\tif ( startIdx === this.lexer.index ) break; // This throws \"\" away.\n\t\t\t\t\tnode = this.addTextNode( scopeChain, startIdx, this.lexer.index );\n\t\t\t\t\tnode[NODE_TYPE] = Node.COMMENT_NODE;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// All other illegal characters are simply skipped over, along with any\n\t\t\t\t\t// following whitespace.\n\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tname = this.lexer.str.slice( startIdx, endIdx );\n\t\t\t\tif ( state !== STATE_ATTRIBUTE )\n\t\t\t\t\tname = toUpperCase.call( name );\n\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t}\n\t\t\t\n\t\t\tswitch ( state )\n\t\t\t{\n\t\t\t\tcase STATE_START_TAG:\n\t\t\t\t\tnode = createNode( Node.ELEMENT_NODE );\n\t\t\t\t\tnode[TAG_NAME] = name;\n\t\t\t\t\twhile ( tagBoundaries.hasOwnProperty( node[TAG_NAME] ) && tagBoundaries[node[TAG_NAME]][scopeChain[0][TAG_NAME]] )\n\t\t\t\t\t\tscopeChain.splice( 0, 1 );\n\t\t\t\t\tscopeChain[0].childNodes.push( node );\n\t\t\t\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\t\t\tstate = STATE_ATTRIBUTE;\n\t\t\t\t\tselfClosing = selfClosingTags[node[TAG_NAME]];\n\t\t\t\t\tif ( selfClosing !== true ) scopeChain.unshift( node );\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_ATTRIBUTE:\n\t\t\t\t\tlet value = true;\n\t\t\t\t\t\n\t\t\t\t\tif ( this.options.lowerAttributeCase )\n\t\t\t\t\t\tname = toLowerCase.call( name );\n\t\t\t\t\t\n\t\t\t\t\tif ( theChar === \"=\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\tstartIdx = this.lexer.index;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( theChar === '\"' || theChar === \"'\" )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\tthis.lexer.goToString( theChar );\n\t\t\t\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\t\t\t\tstartIdx += 1;\n\t\t\t\t\t\t\tthis.lexer.getNextChar();\n\t\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse // Unquoted attribute value\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twhile ( !this.lexer.isWhiteSpace( theChar ) &&\n\t\t\t\t\t\t\t\t\t//!unquotedAttributeExclusions[theChar] &&\n\t\t\t\t\t\t\t\t\ttheChar !== \">\" &&\n\t\t\t\t\t\t\t\t\t(!this.options.allowSelfClosingSyntax || !(theChar === \"/\" && this.lexer.peek() === \">\")) &&\n\t\t\t\t\t\t\t\t\ttheChar !== EOF )\n\t\t\t\t\t\t\t\ttheChar = this.lexer.getNextChar();\n\t\t\t\t\t\t\tendIdx = this.lexer.index;\n\t\t\t\t\t\t\ttheChar = this.lexer.skipWhiteSpace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( node.attributes.hasOwnProperty( name ) ) break;\n\t\t\t\t\t\tvalue = this.lexer.str.slice( startIdx, endIdx );\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( value === \"\" )\n\t\t\t\t\t\t\tvalue = true;\n\t\t\t\t\t\telse if ( this.options.decodeEntities )\n\t\t\t\t\t\t\tvalue = this.entityEncoder.decode( value );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( node.attributes.hasOwnProperty( name ) ) break;\n\t\t\t\t\t\n\t\t\t\t\tnode.attributes[name] = value;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase STATE_END_TAG:\n\t\t\t\t\tfor ( let i = 0; i < scopeChain.length; i++ )\n\t\t\t\t\t\tif ( scopeChain[i][TAG_NAME] === name )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode = scopeChain[i];\n\t\t\t\t\t\t\twhile ( scopeChain.length > 0 && scopeChain[0] !== node )\n\t\t\t\t\t\t\t\tscopeChain.shift();\n\t\t\t\t\t\t\tscopeChain.shift();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse this.addTextNode( scopeChain, tagStartIdx, this.lexer.index, false );\n\t\t\n\t\tthis.lexer.getNextChar();\n\t}\n\t\n\tparseText( scopeChain )\n\t{\n\t\tvar startIdx = this.lexer.index,\n\t\t\tpreserveContent = false;\n\t\t\n\t\tif ( scopeChain[0][TAG_NAME] === \"SCRIPT\" || scopeChain[0][TAG_NAME] === \"STYLE\" )\n\t\t{\n\t\t\tthis.lexer.goToString( \"<\\/\"+ scopeChain[0][TAG_NAME], false );\n\t\t\tpreserveContent = true;\n\t\t}\n\t\telse this.lexer.goToString( \"<\" );\n\t\t\n\t\tthis.addTextNode( scopeChain, startIdx, this.lexer.index, preserveContent );\n\t}\n\t\n\taddTextNode( scopeChain, startIdx, endIdx, preserveContent )\n\t{\n\t\tvar node = createNode( Node.TEXT_NODE ),\n\t\t\tvalue = this.lexer.str.slice( startIdx, endIdx );\n\t\t\n\t\tif ( preserveContent != null )\n\t\t{\n\t\t\tif ( this.options.trimWhitespace )\n\t\t\t\tvalue = value.trim();\n\t\t\telse if ( this.options.collapseWhitespace && !preserveContent )\n\t\t\t\tvalue = value.replace( spacesRE, \" \" );\n\t\t\t\n\t\t\tif ( this.options.decodeEntities && !preserveContent )\n\t\t\t\tvalue = this.entityEncoder.decode( value );\n\t\t}\n\t\t\n\t\tnode.nodeValue = value;\n\t\tscopeChain[0].childNodes.push( node );\n\t\tsetNodeParent( node, scopeChain[0] );\n\t\t\n\t\treturn node;\n\t}\n}","export class ImageData {\n constructor(widthOrData, heightOrWidth, settingsOrHeight, settings) {\n var _a, _b;\n const rgbaArray = (widthOrData instanceof Uint8ClampedArray) ? widthOrData : null;\n let colorSpace = \"srgb\";\n if (rgbaArray) {\n console.log(`[ImageData] Warning: Array initializer support is experimental! ( new ImageData([${rgbaArray.length}b ${(_b = (_a = rgbaArray === null || rgbaArray === void 0 ? void 0 : rgbaArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : \"Array\"}], ${Array.from(arguments).slice(1).join(',')}) )`);\n this.width = heightOrWidth;\n this.height = typeof settingsOrHeight === \"number\" ? settingsOrHeight : undefined;\n colorSpace = (typeof settingsOrHeight === \"object\" ? settingsOrHeight : (typeof settings === \"object\" ? settings : { colorSpace: \"srgb\" })).colorSpace;\n }\n else {\n this.width = widthOrData;\n this.height = heightOrWidth;\n colorSpace = (typeof settingsOrHeight === \"object\" ? settingsOrHeight : { colorSpace: \"srgb\" }).colorSpace;\n }\n if (colorSpace !== \"srgb\") {\n console.log(`[ImageData] Warning: Only the 'srgb' color space is supported! ( new ImageData(${Array.from(arguments).join(',')}) )`);\n throw new Error(`Unsupported colorSpace: ${colorSpace}`);\n }\n // We need to calculate the height based on the array data and width\n if (this.height === undefined) {\n this.height = rgbaArray.length / this.width / 4;\n }\n if (rgbaArray) {\n if (this.width * this.height * 4 !== rgbaArray.length) {\n // TODO: this should be a \"DOMException\"\n throw new Error(`The array dimensions do not match the supplied width or height`);\n }\n this.data = new Uint8ClampedArray(rgbaArray);\n }\n else {\n this.data = new Uint8ClampedArray(this.width * this.height * 4);\n }\n }\n}\n;\n// Export onto the global scope\nif (globalThis && typeof globalThis.ImageData !== \"object\") {\n // @ts-ignore\n globalThis.ImageData = ImageData;\n}\n","// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d\nimport { CANVAS_DATA } from \"./HTMLCanvasElement.js\";\nimport { ImageData } from \"./ImageData.js\";\nconst FILL_STYLE = Symbol(\"fill-style\");\nexport class CanvasRenderingContext2D {\n get fillStyle() {\n return this[FILL_STYLE];\n }\n set fillStyle(newStyle) {\n console.log(`${this}→fillStyle = ${newStyle}`);\n this[FILL_STYLE] = newStyle;\n }\n // CanvasRect\n clearRect(x, y, w, h) {\n throw new Error(\"Not implemented\");\n }\n fillRect(x, y, w, h) {\n const { r, g, b, a } = this.fillStyleRGBA;\n const alpha = a * 255 | 0;\n const data = this.canvas[CANVAS_DATA];\n // Optimization: full-canvas fill\n if (x === 0 && y === 0 && data.length === w * h * 4) {\n for (let i = 0; i < data.length; i += 4) {\n if (i < 100)\n console.log(`→ fill #${i} rgba(${data[i]},${data[i + 1]},${data[i + 2]} @ ${data[i + 3]}) => rgba(${r},${g},${b} @ ${alpha})`);\n data[i + 0] = r;\n data[i + 1] = g;\n data[i + 2] = b;\n data[i + 3] = alpha;\n }\n console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) whole canvas with ${r},${g},${b} @ ${alpha}`);\n console.log(data);\n return;\n }\n for (let row = y; row < y + h; ++row) {\n const startIdx = row * 4 + x;\n const endIdx = row * 4 + x + w;\n for (let i = startIdx; i < endIdx; ++i) {\n data[i + 0] = r;\n data[i + 1] = g;\n data[i + 2] = b;\n data[i + 3] = alpha;\n }\n }\n console.log(`${this}→fillRect( ${Array.from(arguments).join(', ')} ) with ${r},${g},${b} @ ${alpha}`);\n }\n strokeRect(x, y, w, h) {\n throw new Error(\"Not implemented\");\n }\n constructor(parentCanvas) {\n this.canvas = parentCanvas;\n // defaults\n this.fillStyle = \"#000\";\n }\n drawImage(image, x1, y1, w1, h1, x2, y2, w2, h2) {\n if (image instanceof globalThis.HTMLCanvasElement) {\n w1 = w1 !== null && w1 !== void 0 ? w1 : image.width;\n h1 = h1 !== null && h1 !== void 0 ? h1 : image.height;\n if (w1 !== w2 || h1 !== h2) {\n console.log(`${this} Not implemented: image scaling in drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n return;\n }\n const srcImage = image.getContext(\"2d\").getImageData(x1, y1, w1, h1);\n const srcPixels = srcImage.data;\n const dstPixels = this.canvas[CANVAS_DATA];\n const rows = h1;\n const cols = w1;\n for (let row = 0; row < rows; ++row) {\n for (let col = 0; col < cols; ++col) {\n // source pixel\n const si = ((y1 + row) * srcImage.width + x1 + col) * 4;\n const sr = srcPixels[si];\n const sg = srcPixels[si + 1];\n const sb = srcPixels[si + 2];\n const sa = srcPixels[si + 3];\n // destination pixel\n const di = ((y2 + row) * srcImage.width + x2 + col) * 4;\n const dr = dstPixels[di];\n const dg = dstPixels[di + 1];\n const db = dstPixels[di + 2];\n const da = dstPixels[di + 3];\n // blend pixels using premultiplied alpha and the default 'source-over' composition\n // https://drafts.fxtf.org/compositing/#porterduffcompositingoperators_srcover\n const dstcontrib = (1 - sa / 255);\n dstPixels[di + 0] = sr * (sa / 255) + dr * (da / 255) * dstcontrib | 0;\n dstPixels[di + 1] = sg * (sa / 255) + dg * (da / 255) * dstcontrib | 0;\n dstPixels[di + 2] = sb * (sa / 255) + db * (da / 255) * dstcontrib | 0;\n dstPixels[di + 3] = sa + da * dstcontrib | 0;\n if (row === col) {\n console.log(`→ [${row},${col}]: imgdata#${si} rgba(${sr},${sg},${sb} @ ${sa}) + canvas#${di} rgba(${dr},${dg},${db} @ ${da}) => rgba(${dstPixels[di]},${dstPixels[di + 1]},${dstPixels[di + 2]} @ ${dstPixels[di + 3]})`);\n }\n }\n }\n console.log(`${this}→drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n return;\n }\n //let dx,dy,dw,dh;\n //let sx,sy,sw,sh;\n console.log(`${this} Not implemented: only canvas sources supported: drawImage( <${image.constructor.name}> ${Array.from(arguments).join(', ')} )`);\n }\n createImageData(widthOrImagedata, height, settings) {\n if (widthOrImagedata instanceof ImageData) {\n return new ImageData(widthOrImagedata.data, widthOrImagedata.width, widthOrImagedata.height);\n }\n return new ImageData(widthOrImagedata, height, settings);\n }\n getImageData(sx, sy, sw, sh, settings) {\n if (sx === 0 && sy === 0 && sw === this.canvas.width && sh === this.canvas.height && !settings) {\n console.log(`${this}→getImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);\n return new ImageData(this.canvas[CANVAS_DATA], this.canvas.width, this.canvas.height);\n }\n console.log(`${this} Not implemented: context2d.getImageData( ${Array.from(arguments).join(', ')} )`);\n const id = new ImageData(sw, sh, settings);\n return id;\n }\n putImageData(imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) {\n let premultWarnLow, premultWarnZero;\n const canvas = this.canvas[CANVAS_DATA];\n if (dirtyX === undefined) {\n if (dx === 0 && dy === 0 && imagedata.width === this.canvas.width && imagedata.height === this.canvas.height) {\n console.log(`${this}→putImageData( ${Array.from(arguments).join(', ')} ) whole canvas ${this.canvas.width}x${this.canvas.height}`);\n for (let col = 0; col < imagedata.height; ++col) {\n for (let row = 0; row < imagedata.width; ++row) {\n const idx = (col * imagedata.width + row) * 4;\n const alpha = imagedata.data[idx + 3], r = imagedata.data[idx + 0], g = imagedata.data[idx + 1], b = imagedata.data[idx + 2];\n // Transparent pixels that are not fully black/white have browser inconsistencies\n // Context for these warnings:\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData#data_loss_due_to_browser_optimization\n if (alpha === 0 && (r | g | b) !== 0 && (r & g & b) !== 255) {\n premultWarnZero = true;\n }\n else if (alpha < 255 && (r | g | b) !== 0 && (r & g & b) !== 255) {\n premultWarnLow = true;\n }\n canvas[idx + 0] = r;\n canvas[idx + 1] = g;\n canvas[idx + 2] = b;\n canvas[idx + 3] = alpha; //a\n }\n }\n if (premultWarnLow) {\n console.log(`${this} Compat warning: image contained colored non-opaque pixels (alpha<255), the result be inconsistent with observed browser behavior.`);\n }\n if (premultWarnZero) {\n console.log(`${this} Compat warning: image contained fully transparent colored pixels (alpha=0), the result of this operation may differ from browser behavior.`);\n }\n return;\n }\n console.log(`${this} Not implemented: non-whole-canvas putImageData( ${Array.from(arguments).join(', ')} )`);\n return;\n }\n console.log(`${this} Not implemented: context2d.putImageData( ${Array.from(arguments).join(', ')} )`);\n }\n setTransform(matrixOrA, b, c, d, e, f) {\n console.log(`${this} Not implemented: context2d.setTransform( ${Array.from(arguments).join(', ')} )`);\n }\n // Stringifies the context object with its canvas & unique ID to ease debugging\n get [Symbol.toStringTag]() {\n return `${this.canvas[Symbol.toStringTag]}::context2d`;\n }\n // https://developer.mozilla.org/en-US/docs/Web/CSS/color_value\n get fillStyleRGBA() {\n let c;\n let r = 0, g = 0, b = 0, a = 1;\n // Named color ('white', 'black', etc)\n if (CSS_NAMED_COLORS.has(this.fillStyle)) {\n c = HTMLColorToRGBA(CSS_NAMED_COLORS.get(this.fillStyle));\n if (c)\n return c;\n }\n // HTML color (#aaa, #bbccdd, #rrggbbaa)\n c = HTMLColorToRGBA(this.fillStyle);\n if (c)\n return c;\n // rgb() color definition\n c = HTMLColorToRGBA(this.fillStyle);\n if (c)\n return c;\n return { r, g, b, a };\n }\n}\nexport class ImageBitmapRenderingContext {\n}\n// TODO: these are only the basic colors\nconst CSS_NAMED_COLORS = new Map([\n [\"black\", \"#000000\"],\n [\"silver\", \"#c0c0c0\"],\n [\"gray\", \"#808080\"],\n [\"white\", \"#ffffff\"],\n [\"maroon\", \"#800000\"],\n [\"red\", \"#ff0000\"],\n [\"purple\", \"#800080\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"green\", \"#008000\"],\n [\"lime\", \"#00ff00\"],\n [\"olive\", \"#808000\"],\n [\"yellow\", \"#ffff00\"],\n [\"navy\", \"#000080\"],\n [\"blue\", \"#0000ff\"],\n [\"teal\", \"#008080\"],\n [\"aqua\", \"#00ffff\"],\n]);\nfunction HTMLColorToRGBA(color) {\n var _a, _b;\n let r = 0, g = 0, b = 0, a = 0;\n let matched, wasMatched;\n // Match longform\n matched = (_a = color.match(/^#(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})(?[0-9a-f]{2})?$/)) === null || _a === void 0 ? void 0 : _a.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n r = parseInt(matched.r, 16);\n g = parseInt(matched.g, 16);\n b = parseInt(matched.b, 16);\n a = matched.a ? parseInt(matched.a, 10) : 1.0;\n wasMatched = true;\n }\n // Match short form\n matched = (_b = color.match(/^#(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})(?[0-9a-f]{1})?$/)) === null || _b === void 0 ? void 0 : _b.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n r = parseInt(matched.r, 16);\n g = parseInt(matched.g, 16);\n b = parseInt(matched.b, 16);\n a = matched.a ? parseInt(matched.a, 10) : 1.0;\n wasMatched = true;\n }\n if (!wasMatched) {\n console.log(`Not a HTML color string: ${color}`);\n return null;\n }\n return { r, g, b, a };\n}\nfunction CSSRGBColorToRGBA(color) {\n var _a;\n let matched = (_a = color.match(/rgb\\((?\\d{1,3})\\s+(?\\d{1,3})\\s+(?\\d{1,3})(\\s*\\/\\s*(?\\d{1,3})%)?/)) === null || _a === void 0 ? void 0 : _a.groups;\n if ((matched === null || matched === void 0 ? void 0 : matched.r) && (matched === null || matched === void 0 ? void 0 : matched.g) && (matched === null || matched === void 0 ? void 0 : matched.b)) {\n let r = parseInt(matched.r, 10);\n let g = parseInt(matched.g, 10);\n let b = parseInt(matched.b, 10);\n let a = matched.a ? parseInt(matched.a, 10) / 100 : 1.0;\n return { r, g, b, a };\n }\n console.log(`Not a CSS color definition': ${color}`);\n return null;\n}\n","// https://html.spec.whatwg.org/multipage/canvas.html#the-canvas-element\nimport Node, { EXTEND_NODE } from '../node.js';\nimport { CanvasRenderingContext2D,\n// ImageBitmaps currently unsupported\n// https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap\n//ImageBitmapRenderingContext, ImageBitmapRenderingContextSettings,\n } from './RenderingContext.js';\n// Implementation\nconst WIDTH = Symbol(\"canvas-width\");\nconst HEIGHT = Symbol(\"canvas-height\");\nconst CONTEXT = Symbol(\"canvas-context\");\nconst EID = Symbol(\"element-id\");\n// Access canvas data (for the Context or testing/debugging)\nexport const CANVAS_DATA = Symbol(\"accesscanvas-data\");\nexport class HTMLCanvasElement extends Node {\n get width() {\n console.debug(`${this}→width? (${this[WIDTH]})`);\n return this[WIDTH];\n }\n get height() {\n console.debug(`${this}→height? (${this[HEIGHT]})`);\n return this[HEIGHT];\n }\n set width(width) {\n console.debug(`${this}→width = ${width}`);\n this[WIDTH] = width;\n this.resize(this[WIDTH], this[HEIGHT]);\n }\n set height(height) {\n console.debug(`${this}→height = ${height}`);\n this[HEIGHT] = height;\n this.resize(this[WIDTH], this[HEIGHT]);\n }\n //getContext(contextId: \"bitmaprenderer\", options?: ImageBitmapRenderingContextSettings): ImageBitmapRenderingContext | null;\n //getContext(contextId: string, options?: any): RenderingContext | null;\n getContext(contextId, _options) {\n if (contextId != \"2d\")\n throw new Error(`Not implemented: ${contextId}`);\n this[CONTEXT] = this[CONTEXT] || new CanvasRenderingContext2D(this);\n if (!(this[CONTEXT] instanceof CanvasRenderingContext2D))\n throw new Error(`Context invalid`);\n return this[CONTEXT];\n }\n toDataURL(_type = \"image/png\", _quality) {\n throw new Error(\"Not implemented\");\n }\n toBlob(_callback, _type = \"image/png\", _quality) {\n throw new Error(\"Not implemented\");\n }\n get clientWidth() {\n return this.width;\n }\n get clientHeight() {\n return this.height;\n }\n constructor() {\n super(EXTEND_NODE);\n // Assign a new pseudo-random element ID\n this[EID] = (Math.random() * (Math.pow(36, 6)) | 0).toString(36);\n // The default size of a new canvas in most implementations\n this.resize(300, 150);\n }\n // Stringifies the object including its unique element tag\n get [Symbol.toStringTag]() {\n return `HTMLCanvasElement#${this[EID]}`;\n }\n resize(width, height) {\n this[WIDTH] = width;\n this[HEIGHT] = height;\n this[CANVAS_DATA] = new Uint8ClampedArray(this[WIDTH] * this[HEIGHT] * 4);\n console.debug(`${this}→reset, new size: ${this[WIDTH]}x${this[HEIGHT]} (${this[CANVAS_DATA].length}b)`);\n }\n}\n;\n// Export onto the global scope\nif (globalThis && typeof globalThis.HTMLCanvasElement !== \"object\") {\n // @ts-ignore\n globalThis.HTMLCanvasElement = HTMLCanvasElement;\n}\n","import Node, {createNode} from \"./node.js\";\nimport {HTMLCanvasElement} from \"./js-canvas/HTMLCanvasElement.js\";\nimport {NODE_TYPE, PARENT_NODE, OWNER, TAG_NAME} from \"./utils.js\";\n\nexport function createCanvasNode( nodeType )\n{\n\tconst node = new HTMLCanvasElement()\n\n\tnode[NODE_TYPE] = nodeType;\n\tnode.nodeValue = null;\n\tnode[PARENT_NODE] = null;\n\tnode[OWNER] = null;\n\t\n\tswitch ( nodeType )\n\t{\n\t\tcase Node.ELEMENT_NODE:\n\t\t\tnode[TAG_NAME] = null;\n\t\t\tnode.attributes = {};\n\t\t\t// fallthrough\n\t\t\t\n\t\tcase Node.DOCUMENT_NODE:\n\t\tcase Node.DOCUMENT_FRAGMENT_NODE:\n\t\t\tnode.childNodes = [];\n\t}\n\t\n\treturn node;\n}\n","import {globalizeRegExp} from \"./utils.js\";\n\nconst decodingRE = /&(#\\d+|#[xX][0-9a-fA-F]+|[0-9a-zA-Z]+);?/g,\n\t\n\t// From 'SyntaxCharacter' in section 21.2.1 (Patterns) of the ECMAScript 6.0 spec.\n\tregExpEscapeRE = /[\\^$\\\\.*+?()[\\]{}|]/g,\n\t\n\t_defaultEntities = processEntities( {\n\t\t\"amp\": \"&\",\n\t\t\"apos\": \"'\",\n\t\t\"copy\": 169,\n\t\t\"gt\": \">\",\n\t\t\"lt\": \"<\",\n\t\t\"nbsp\": 160,\n\t\t\"quot\": '\"'\n\t} );\n\nlet defaultEntities = _defaultEntities;\n\nexport default class EntityEncoder\n{\n\tconstructor( entities )\n\t{\n\t\tthis.entities = entities || \"default\";\n\t}\n\t\n\tencode( string, what )\n\t{\n\t\tif ( !this.encodingReplacements ) return string;\n\t\treturn string.replace( what instanceof RegExp ? globalizeRegExp( what ) : this.encodingRE, chr => this.encodingReplacements[chr] || chr );\n\t}\n\t\n\tdecode( string )\n\t{\n\t\tif ( !this.decodingReplacements ) return string;\n\t\treturn string.replace( decodingRE, ( _, m ) =>\n\t\t{\n\t\t\tif ( m[0] === \"#\" )\n\t\t\t{\n\t\t\t\tif ( m[1] === \"x\" || m[1] === \"X\" )\n\t\t\t\t\tm = parseInt( m.slice( 2 ), 16 ) | 0;\n\t\t\t\telse m = m.slice( 1 ) | 0;\n\t\t\t\treturn String.fromCodePoint( m );\n\t\t\t}\n\t\t\treturn this.decodingReplacements[m] || this.decodingReplacements[m.toLowerCase()] || _;\n\t\t} );\n\t}\n\t\n\tset entities( entities )\n\t{\n\t\tif ( entities === \"default\" )\n\t\t\tentities = defaultEntities;\n\t\telse if ( !entities || !(entities.encodingRE instanceof RegExp) )\n\t\t\tentities = processEntities( entities );\n\t\t\n\t\tthis.encodingRE = entities.encodingRE;\n\t\tthis.encodingReplacements = entities.encodingReplacements;\n\t\tthis.decodingReplacements = entities.decodingReplacements;\n\t}\n\t\n\tstatic set defaultEntities( entities )\n\t{\n\t\tif ( entities && typeof entities === \"object\" )\n\t\t\tdefaultEntities = processEntities( Object.assign( {}, entities ) );\n\t\telse defaultEntities = _defaultEntities;\n\t}\n}\n\nfunction processEntities( entities )\n{\n\tvar result = {\n\t\t\tencodingRE: null,\n\t\t\tencodingReplacements: null,\n\t\t\tdecodingReplacements: null\n\t\t};\n\t\n\tif ( entities && typeof entities === \"object\" )\n\t{\n\t\tconst escapes = {},\n\t\t\tunescapes = {},\n\t\t\tentityList = [];\n\t\t\n\t\tfor ( let k in entities )\n\t\t\tif ( entities.hasOwnProperty( k ) )\n\t\t\t{\n\t\t\t\tlet entity = entities[k];\n\t\t\t\t\n\t\t\t\tif ( Number.isFinite( entity ) )\n\t\t\t\t\tentity = String.fromCodePoint( entity );\n\t\t\t\telse if ( typeof entity !== \"string\" || entity === \"\" )\n\t\t\t\t\tcontinue;\n\t\t\t\t\n\t\t\t\tentityList.push( entity.replace( regExpEscapeRE, \"\\\\$&\" ) );\n\t\t\t\tif ( !escapes.hasOwnProperty( entity ) || (k.length + 2) < escapes[entity].length )\n\t\t\t\t\tescapes[entity] = \"&\"+ k +\";\";\n\t\t\t\tunescapes[k] = entity;\n\t\t\t}\n\t\t\n\t\tif ( entityList.length > 0 )\n\t\t{\n\t\t\tresult.encodingRE = new RegExp( entityList.join( \"|\" ), \"g\" );\n\t\t\tresult.encodingReplacements = escapes;\n\t\t\tresult.decodingReplacements = unescapes;\n\t\t}\n\t}\n\t\n\tif ( !result.encodingRE )\n\t\tresult.encodingRE = new RegExp( \"(?:)\", \"g\" );\n\t\n\treturn result;\n}","import \"./polyfills.js\";\n\nimport Parser from \"./html-parser.js\";\nimport Node, {createNode} from \"./node.js\";\nimport {createCanvasNode} from \"./canvas-node.js\";\nimport {serializeNode} from \"./serializer.js\";\nimport EntityEncoder from \"./entity-encoder.js\";\nimport {DOCTYPE, HEAD, BODY, DOCUMENT_ELEMENT, NODE_TYPE, TAG_NAME, PARSER_OPTIONS,\n\tsetupDocument, detachNodes, setNodeParent} from \"./utils.js\";\n\n/* @START_UNIT_TESTS */\nimport {parseSelector} from \"./selector-parser.js\";\n/* @END_UNIT_TESTS */\n\nconst ENTITY_ENCODER = Symbol( \"entityEncoder\" );\n\nexport default class DOM extends Node\n{\n\tconstructor( html, options )\n\t{\n\t\tconst node = createNode( Node.DOCUMENT_FRAGMENT_NODE, DOM );\n\t\tnode[PARSER_OPTIONS] = Parser.setupOptions( options );\n\t\tnode[ENTITY_ENCODER] = new EntityEncoder( node[PARSER_OPTIONS].entities );\n\t\tnode.innerHTML = html;\n\t\treturn node;\n\t}\n\t\n\tget documentElement() {return this[DOCUMENT_ELEMENT] || null}\n\t\n\tget innerHTML()\n\t{\n\t\tlet html = \"\";\n\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\thtml += serializeNode( this.childNodes[i] );\n\t\treturn html;\n\t}\n\tset innerHTML( html )\n\t{\n\t\tthis[NODE_TYPE] = Node.DOCUMENT_FRAGMENT_NODE;\n\t\tif ( html && typeof html === \"string\" )\n\t\t{\n\t\t\tconst rootNode = new Parser( html, this[PARSER_OPTIONS], this[ENTITY_ENCODER] ).parseHTML();\n\t\t\t\n\t\t\tdetachNodes( this.childNodes );\n\t\t\t\n\t\t\tif ( rootNode.doctype )\n\t\t\t\tthis[DOCTYPE] = rootNode.doctype;\n\t\t\telse this[DOCTYPE] = null;\n\t\t\t\n\t\t\tthis.childNodes = rootNode.childNodes;\n\t\t\tfor ( let i = 0; i < this.childNodes.length; i++ )\n\t\t\t\tsetNodeParent( this.childNodes[i], this );\n\t\t\t\n\t\t\tsetupDocument( this );\n\t\t}\n\t\telse this.childNodes.length = 0;\n\t}\n\t\n\tget outerHTML() {return null}\n\tset outerHTML( v ) {}\n\t\n\tget doctype()\n\t{\n\t\treturn this[DOCTYPE] || null;\n\t}\n\tset doctype( val )\n\t{\n\t\tif ( val )\n\t\t{\n\t\t\tlet doctype = this[DOCTYPE];\n\t\t\tif ( val instanceof Node )\n\t\t\t{\n\t\t\t\tif ( val.nodeType === Node.DOCUMENT_TYPE_NODE && val !== doctype )\n\t\t\t\t{\n\t\t\t\t\tthis[DOCTYPE] = val;\n\t\t\t\t\tif ( doctype ) this.replaceChild( val, doctype );\n\t\t\t\t\telse this.insertBefore( val, this.firstChild );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( typeof val === \"object\" )\n\t\t\t{\n\t\t\t\tif ( !doctype )\n\t\t\t\t\tthis[DOCTYPE] = this.insertBefore( this.createDocumentType( val.name, val.publicId, val.systemId ), this.firstChild );\n\t\t\t\telse setupDocumentType( doctype, val.name, val.publicId, val.systemId );\n\t\t\t}\n\t\t}\n\t\telse if ( val === null && this[DOCTYPE] )\n\t\t{\n\t\t\tthis.removeChild( this[DOCTYPE] );\n\t\t\tthis[DOCTYPE] = null;\n\t\t}\n\t}\n\t\n\tget head()\n\t{\n\t\treturn this[HEAD] || null;\n\t}\n\t\n\tget title()\n\t{\n\t\tconst head = this.head;\n\t\tif ( head )\n\t\t{\n\t\t\tconst title = head.getElementsByTagName( \"title\" );\n\t\t\tif ( title.length > 0 )\n\t\t\t\treturn title[0].textContent;\n\t\t}\n\t\treturn \"\";\n\t}\n\tset title( val )\n\t{\n\t\tconst head = this.head;\n\t\tif ( head )\n\t\t{\n\t\t\tlet title = head.getElementsByTagName( \"title\" );\n\t\t\tif ( title.length <= 0 )\n\t\t\t\ttitle = head.appendChild( this.createElement( \"title\" ) );\n\t\t\telse title = title[0];\n\t\t\ttitle.textContent = val;\n\t\t}\n\t}\n\t\n\tget body()\n\t{\n\t\treturn this[BODY] || null;\n\t}\n\tset body( val )\n\t{\n\t\tif ( val instanceof Node && val.nodeType === Node.ELEMENT_NODE &&\n\t\t\t(val.tagName === \"BODY\" || val.tagName === \"FRAMESET\") &&\n\t\t\tval !== this[BODY] && this[DOCUMENT_ELEMENT] )\n\t\t{\n\t\t\tif ( this[BODY] ) this[BODY].parentNode.replaceChild( val, this[BODY] );\n\t\t\telse this[DOCUMENT_ELEMENT].appendChild( val );\n\t\t}\n\t}\n\n\tget entityEncoder()\n\t{\n\t\treturn this[ENTITY_ENCODER];\n\t}\n\n\tcreateElement( tagName )\n\t{\n\t\tif ( tagName && typeof tagName === \"string\" )\n\t\t{\n\t\t\tconst node = createNodeForTagName( tagName );\n\t\t\tnode[TAG_NAME] = tagName.toUpperCase();\n\t\t\treturn node;\n\t\t}\n\t}\n\n\tcreateTextNode( text )\n\t{\n\t\treturn createTextBasedNode( Node.TEXT_NODE, text );\n\t}\n\n\tcreateComment( data )\n\t{\n\t\treturn createTextBasedNode( Node.COMMENT_NODE, data );\n\t}\n\n\tcreateCDATASection( data )\n\t{\n\t\treturn createTextBasedNode( Node.CDATA_SECTION_NODE, data, \"]]>\" );\n\t}\n\n\tcreateProcessingInstruction( target, data )\n\t{\n\tNewNode:\n\t\tif ( target && typeof target === \"string\" )\n\t\t{\n\t\t\tif ( Parser.isNameCharStart( target[0] ) )\n\t\t\t\tfor ( let i = 1; i < target.length; i++ )\n\t\t\t\t{\n\t\t\t\t\tif ( !Parser.isNameChar( target[i] ) )\n\t\t\t\t\t\tbreak NewNode;\n\t\t\t\t}\n\t\t\telse break NewNode;\n\t\t\t\n\t\t\tconst node = createTextBasedNode( Node.PROCESSING_INSTRUCTION_NODE, data, \"?>\" );\n\t\t\tnode.target = target;\n\t\t\treturn node;\n\t\t}\n\t\tthrow new Error( \"Invalid target name \"+ JSON.stringify( target ) +\".\" );\n\t}\n\n\tcreateDocumentType( name, publicId, systemId )\n\t{\n\t\treturn setupDocumentType( createNode( Node.DOCUMENT_TYPE_NODE ), name, publicId, systemId );\n\t}\n\n\tgetElementsByName( name )\n\t{\n\t\tconst nodeList = [];\n\t\tif ( name && typeof name === \"string\" )\n\t\t\tthis.forEach( node =>\n\t\t\t{\n\t\t\t\tif ( node.attributes && node.attributes.name === name )\n\t\t\t\t\tnodeList.push( node );\n\t\t\t} );\n\t\treturn nodeList;\n\t}\n}\n\nfunction createTextBasedNode( type, text, disallowed = false )\n{\n\tconst node = createNode( type );\n\tnode.nodeValue = \"\";\n\tif ( text && typeof text === \"string\" )\n\t{\n\t\tif ( disallowed && typeof disallowed === \"string\" && text.indexOf( disallowed ) !== -1 )\n\t\t\tthrow new Error( \"The data provided ('\"+ text +\"') contains '\"+ disallowed +\"'.\" );\n\t\tnode.nodeValue += text;\n\t}\n\treturn node;\n}\n\nfunction setupDocumentType( doctype, name, publicId, systemId )\n{\n\tif ( name && typeof name === \"string\" )\n\t{\n\t\tdoctype.name = name.toLowerCase();\n\t\t\n\t\tif ( publicId && typeof publicId === \"string\" )\n\t\t\tdoctype.publicId = publicId;\n\t\telse doctype.publicId = \"\";\n\t\t\n\t\tif ( systemId && typeof systemId === \"string\" )\n\t\t\tdoctype.systemId = systemId;\n\t\telse doctype.systemId = \"\";\n\t}\n\telse doctype.name = doctype.publicId = doctype.systemId = \"\";\n\t\n\treturn doctype;\n}\n\nfunction createNodeForTagName( tagName )\n{\n\tswitch ( tagName.toLowerCase() )\n\t{\n\t\tcase 'canvas':\n\t\t\treturn createCanvasNode( Node.ELEMENT_NODE );\n\t\tdefault:\n\t\t\treturn createNode( Node.ELEMENT_NODE );\n\t}\n}\n\n/* @START_UNIT_TESTS */\nDOM.parseSelector = parseSelector;\n/* @END_UNIT_TESTS */\n\nDOM.Node = Node;\nDOM.EntityEncoder = EntityEncoder;\n"],"names":["ELEMENT"],"mappings":";;AAAA,MAAM,OAAO,GAAG,EAAE;AAClB,CAAC,WAAW,GAAG,EAAE;AACjB,CAAC,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE;AACnE,CAAC,GAAG,GAAG,IAAI,CAAC;AAGZ;AACO,MAAM,KAAK;AAClB;AACA,CAAC,WAAW,EAAE,GAAG;AACjB,CAAC;AACD,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACjB,EAAE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACjB,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvC;AACA,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE;AAC9B,EAAE;AACF;AACA,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE;AAClC,IAAI,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;AACjD,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,IAA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