UNPKG

@qwik.dev/core

Version:

An open source framework for building instant loading web apps at any scale, without the extra effort.

7 lines (6 loc) 2.35 kB
const QWIK_BACKPATCH_EXECUTOR_MINIFIED = "const t='script[type=\"qwik/backpatch\"]',e=document.currentScript;if(e){const o=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\");if(o){const e=o.querySelector(t);if(e){const t=JSON.parse(e.textContent||\"[]\"),n=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let r=n.currentNode,c=r.hasAttribute(\":\")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],i=t[e+1];let s=t[e+2];for(;c<o&&(r=n.nextNode(),r);)r.hasAttribute(\":\")&&c++;const l=r;null==s||!1===s?l.removeAttribute(i):(\"boolean\"==typeof s&&(s=\"\"),l.setAttribute(i,s))}}}}"; const QWIK_BACKPATCH_EXECUTOR_DEBUG = "const BACKPATCH_DATA_SELECTOR = 'script[type=\"qwik/backpatch\"]';\nconst executorScript = document.currentScript;\nif (executorScript) {\n const container = executorScript.closest(\n \"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"\n );\n if (container) {\n const script = container.querySelector(BACKPATCH_DATA_SELECTOR);\n if (script) {\n const data = JSON.parse(script.textContent || \"[]\");\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n let currentNode = walker.currentNode;\n let currentNodeIdx = currentNode.hasAttribute(\":\") ? 0 : -1;\n for (let i = 0; i < data.length; i += 3) {\n const elementIdx = data[i];\n const attrName = data[i + 1];\n let value = data[i + 2];\n while (currentNodeIdx < elementIdx) {\n currentNode = walker.nextNode();\n if (!currentNode) {\n break;\n }\n if (currentNode.hasAttribute(\":\")) {\n currentNodeIdx++;\n }\n }\n const element = currentNode;\n if (value == null || value === false) {\n element.removeAttribute(attrName);\n } else {\n if (typeof value === \"boolean\") {\n value = \"\";\n }\n element.setAttribute(attrName, value);\n }\n }\n }\n }\n}"; globalThis.QWIK_BACKPATCH_EXECUTOR_MINIFIED = QWIK_BACKPATCH_EXECUTOR_MINIFIED; globalThis.QWIK_BACKPATCH_EXECUTOR_DEBUG = QWIK_BACKPATCH_EXECUTOR_DEBUG; exports.QWIK_BACKPATCH_EXECUTOR_MINIFIED = QWIK_BACKPATCH_EXECUTOR_MINIFIED; exports.QWIK_BACKPATCH_EXECUTOR_DEBUG = QWIK_BACKPATCH_EXECUTOR_DEBUG;