@marko/runtime-tags 0.3.42 → 0.3.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/debug/dom.js CHANGED
@@ -47,7 +47,6 @@ __export(dom_exports, {
47
47
  data: () => data,
48
48
  dynamicClosure: () => dynamicClosure,
49
49
  dynamicTag: () => dynamicTag,
50
- dynamicTagAttrs: () => dynamicTagAttrs,
51
50
  effect: () => effect,
52
51
  forIn: () => forIn,
53
52
  forOf: () => forOf,
@@ -1693,45 +1692,6 @@ function initBranch(renderer, branch, parentNode) {
1693
1692
  queueRender(branch, renderer.___setup);
1694
1693
  }
1695
1694
  }
1696
- function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
1697
- return (scope, attrsOrOp) => {
1698
- const renderer = scope[nodeAccessor + "(" /* ConditionalRenderer */];
1699
- if (!renderer || attrsOrOp === DIRTY) {
1700
- return;
1701
- }
1702
- const childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
1703
- if (attrsOrOp === MARK || attrsOrOp === CLEAN) {
1704
- return renderer.___args?.(childScope, attrsOrOp);
1705
- }
1706
- const content = getContent?.(scope);
1707
- if (typeof renderer === "string") {
1708
- const nodeAccessor2 = true ? `#${renderer}/0` : 0;
1709
- if (renderer === "textarea" && content) {
1710
- throw new Error(
1711
- "A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
1712
- );
1713
- }
1714
- setConditionalRenderer(
1715
- childScope,
1716
- nodeAccessor2,
1717
- content,
1718
- createBranchScopeWithTagNameOrRenderer
1719
- );
1720
- attrs(childScope, nodeAccessor2, attrsOrOp());
1721
- } else if (renderer.___args) {
1722
- const attributes = attrsOrOp();
1723
- renderer.___args(
1724
- childScope,
1725
- inputIsArgs ? attributes : [
1726
- content ? {
1727
- ...attributes,
1728
- content
1729
- } : attributes
1730
- ]
1731
- );
1732
- }
1733
- };
1734
- }
1735
1695
  function createRendererWithOwner(template, rawWalks, setup, getArgs) {
1736
1696
  let args;
1737
1697
  const id = true ? Symbol("Marko Renderer") : {};
@@ -1784,31 +1744,59 @@ function conditional(nodeAccessor, ...branches) {
1784
1744
  function patchDynamicTag(fn) {
1785
1745
  dynamicTag = fn(dynamicTag);
1786
1746
  }
1787
- var dynamicTag = function dynamicTag2(nodeAccessor, fn, getIntersection) {
1747
+ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1748
+ const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
1788
1749
  const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1789
- let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1790
- return (scope, newRendererOrOp) => {
1750
+ return (scope, newRendererOrOp, getInput) => {
1791
1751
  if (newRendererOrOp === DIRTY) return;
1792
- const currentRenderer = scope[rendererAccessor];
1793
- let op = newRendererOrOp;
1794
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1795
- if (isDifferentRenderer(
1796
- currentRenderer,
1797
- scope[rendererAccessor] = normalizeDynamicRenderer(newRendererOrOp)
1798
- )) {
1752
+ if (newRendererOrOp === MARK || newRendererOrOp === CLEAN) {
1753
+ scope[rendererAccessor]?.___args?.(
1754
+ scope[childScopeAccessor],
1755
+ newRendererOrOp
1756
+ );
1757
+ } else {
1758
+ const newRenderer = normalizeDynamicRenderer(newRendererOrOp);
1759
+ if (!(rendererAccessor in scope) || isDifferentRenderer(scope[rendererAccessor], newRenderer)) {
1760
+ scope[rendererAccessor] = newRenderer;
1799
1761
  setConditionalRenderer(
1800
1762
  scope,
1801
1763
  nodeAccessor,
1802
- scope[rendererAccessor],
1764
+ newRenderer || (getContent ? getContent(scope) : void 0),
1803
1765
  createBranchScopeWithTagNameOrRenderer
1804
1766
  );
1805
- fn && fn(scope);
1806
- op = DIRTY;
1807
- } else {
1808
- op = CLEAN;
1767
+ if (getTagVar) {
1768
+ setTagVar(scope, childScopeAccessor, getTagVar());
1769
+ }
1770
+ if (getContent && typeof newRenderer === "string") {
1771
+ setConditionalRenderer(
1772
+ scope[childScopeAccessor],
1773
+ true ? `#${newRenderer}/0` : 0,
1774
+ getContent(scope),
1775
+ createBranchScopeWithRenderer
1776
+ );
1777
+ }
1778
+ }
1779
+ if (newRenderer) {
1780
+ const input = getInput?.();
1781
+ if (typeof newRenderer === "string") {
1782
+ attrs(
1783
+ scope[childScopeAccessor],
1784
+ true ? `#${newRenderer}/0` : 0,
1785
+ (inputIsArgs ? input[0] : input) || {}
1786
+ );
1787
+ } else {
1788
+ newRenderer.___args?.(
1789
+ scope[childScopeAccessor],
1790
+ inputIsArgs ? input : [
1791
+ getContent ? {
1792
+ ...input,
1793
+ content: getContent(scope)
1794
+ } : input || {}
1795
+ ]
1796
+ );
1797
+ }
1809
1798
  }
1810
1799
  }
1811
- intersection2?.(scope, op);
1812
1800
  };
1813
1801
  };
1814
1802
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
@@ -1926,7 +1914,7 @@ function isDifferentRenderer(a, b) {
1926
1914
  // src/dom/compat.ts
1927
1915
  var classIdToBranch = /* @__PURE__ */ new Map();
1928
1916
  var compat = {
1929
- patchConditionals: patchDynamicTag,
1917
+ patchDynamicTag,
1930
1918
  queueEffect,
1931
1919
  init(warp10Noop) {
1932
1920
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1970,8 +1958,8 @@ var compat = {
1970
1958
  }
1971
1959
  return value2;
1972
1960
  },
1973
- createRenderer(setup, clone, args) {
1974
- const renderer = createRenderer("", 0, setup, args && (() => args));
1961
+ createRenderer(args, clone) {
1962
+ const renderer = createRenderer("", 0, 0, () => args);
1975
1963
  renderer.___clone = clone;
1976
1964
  return renderer;
1977
1965
  },
@@ -1607,45 +1607,6 @@ function initBranch(renderer, branch, parentNode) {
1607
1607
  queueRender(branch, renderer.___setup);
1608
1608
  }
1609
1609
  }
1610
- function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
1611
- return (scope, attrsOrOp) => {
1612
- const renderer = scope[nodeAccessor + "(" /* ConditionalRenderer */];
1613
- if (!renderer || attrsOrOp === DIRTY) {
1614
- return;
1615
- }
1616
- const childScope = scope[nodeAccessor + "!" /* ConditionalScope */];
1617
- if (attrsOrOp === MARK || attrsOrOp === CLEAN) {
1618
- return renderer.___args?.(childScope, attrsOrOp);
1619
- }
1620
- const content = getContent?.(scope);
1621
- if (typeof renderer === "string") {
1622
- const nodeAccessor2 = true ? `#${renderer}/0` : 0;
1623
- if (renderer === "textarea" && content) {
1624
- throw new Error(
1625
- "A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
1626
- );
1627
- }
1628
- setConditionalRenderer(
1629
- childScope,
1630
- nodeAccessor2,
1631
- content,
1632
- createBranchScopeWithTagNameOrRenderer
1633
- );
1634
- attrs(childScope, nodeAccessor2, attrsOrOp());
1635
- } else if (renderer.___args) {
1636
- const attributes = attrsOrOp();
1637
- renderer.___args(
1638
- childScope,
1639
- inputIsArgs ? attributes : [
1640
- content ? {
1641
- ...attributes,
1642
- content
1643
- } : attributes
1644
- ]
1645
- );
1646
- }
1647
- };
1648
- }
1649
1610
  function createRendererWithOwner(template, rawWalks, setup, getArgs) {
1650
1611
  let args;
1651
1612
  const id = true ? Symbol("Marko Renderer") : {};
@@ -1698,31 +1659,59 @@ function conditional(nodeAccessor, ...branches) {
1698
1659
  function patchDynamicTag(fn) {
1699
1660
  dynamicTag = fn(dynamicTag);
1700
1661
  }
1701
- var dynamicTag = function dynamicTag2(nodeAccessor, fn, getIntersection) {
1662
+ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1663
+ const childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */;
1702
1664
  const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1703
- let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1704
- return (scope, newRendererOrOp) => {
1665
+ return (scope, newRendererOrOp, getInput) => {
1705
1666
  if (newRendererOrOp === DIRTY) return;
1706
- const currentRenderer = scope[rendererAccessor];
1707
- let op = newRendererOrOp;
1708
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1709
- if (isDifferentRenderer(
1710
- currentRenderer,
1711
- scope[rendererAccessor] = normalizeDynamicRenderer(newRendererOrOp)
1712
- )) {
1667
+ if (newRendererOrOp === MARK || newRendererOrOp === CLEAN) {
1668
+ scope[rendererAccessor]?.___args?.(
1669
+ scope[childScopeAccessor],
1670
+ newRendererOrOp
1671
+ );
1672
+ } else {
1673
+ const newRenderer = normalizeDynamicRenderer(newRendererOrOp);
1674
+ if (!(rendererAccessor in scope) || isDifferentRenderer(scope[rendererAccessor], newRenderer)) {
1675
+ scope[rendererAccessor] = newRenderer;
1713
1676
  setConditionalRenderer(
1714
1677
  scope,
1715
1678
  nodeAccessor,
1716
- scope[rendererAccessor],
1679
+ newRenderer || (getContent ? getContent(scope) : void 0),
1717
1680
  createBranchScopeWithTagNameOrRenderer
1718
1681
  );
1719
- fn && fn(scope);
1720
- op = DIRTY;
1721
- } else {
1722
- op = CLEAN;
1682
+ if (getTagVar) {
1683
+ setTagVar(scope, childScopeAccessor, getTagVar());
1684
+ }
1685
+ if (getContent && typeof newRenderer === "string") {
1686
+ setConditionalRenderer(
1687
+ scope[childScopeAccessor],
1688
+ true ? `#${newRenderer}/0` : 0,
1689
+ getContent(scope),
1690
+ createBranchScopeWithRenderer
1691
+ );
1692
+ }
1693
+ }
1694
+ if (newRenderer) {
1695
+ const input = getInput?.();
1696
+ if (typeof newRenderer === "string") {
1697
+ attrs(
1698
+ scope[childScopeAccessor],
1699
+ true ? `#${newRenderer}/0` : 0,
1700
+ (inputIsArgs ? input[0] : input) || {}
1701
+ );
1702
+ } else {
1703
+ newRenderer.___args?.(
1704
+ scope[childScopeAccessor],
1705
+ inputIsArgs ? input : [
1706
+ getContent ? {
1707
+ ...input,
1708
+ content: getContent(scope)
1709
+ } : input || {}
1710
+ ]
1711
+ );
1712
+ }
1723
1713
  }
1724
1714
  }
1725
- intersection2?.(scope, op);
1726
1715
  };
1727
1716
  };
1728
1717
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
@@ -1840,7 +1829,7 @@ function isDifferentRenderer(a, b) {
1840
1829
  // src/dom/compat.ts
1841
1830
  var classIdToBranch = /* @__PURE__ */ new Map();
1842
1831
  var compat = {
1843
- patchConditionals: patchDynamicTag,
1832
+ patchDynamicTag,
1844
1833
  queueEffect,
1845
1834
  init(warp10Noop) {
1846
1835
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1884,8 +1873,8 @@ var compat = {
1884
1873
  }
1885
1874
  return value2;
1886
1875
  },
1887
- createRenderer(setup, clone, args) {
1888
- const renderer = createRenderer("", 0, setup, args && (() => args));
1876
+ createRenderer(args, clone) {
1877
+ const renderer = createRenderer("", 0, 0, () => args);
1889
1878
  renderer.___clone = clone;
1890
1879
  return renderer;
1891
1880
  },
@@ -2028,7 +2017,6 @@ export {
2028
2017
  data,
2029
2018
  dynamicClosure,
2030
2019
  dynamicTag,
2031
- dynamicTagAttrs,
2032
2020
  effect,
2033
2021
  forIn,
2034
2022
  forOf,
@@ -35,7 +35,6 @@ __export(html_exports, {
35
35
  controllable_textarea_value: () => controllable_textarea_value,
36
36
  createRenderer: () => createRenderer,
37
37
  createTemplate: () => createTemplate,
38
- debug: () => debug,
39
38
  dynamicTagArgs: () => dynamicTagArgs,
40
39
  dynamicTagInput: () => dynamicTagInput,
41
40
  ensureScopeWithId: () => ensureScopeWithId,
@@ -584,15 +583,12 @@ var Reference = class {
584
583
  assigns = "";
585
584
  };
586
585
  var DEBUG = /* @__PURE__ */ new WeakMap();
587
- function debug(obj, file, loc, vars) {
588
- if (true) {
589
- DEBUG.set(obj, {
590
- file,
591
- loc,
592
- vars
593
- });
594
- }
595
- return obj;
586
+ function setDebugInfo(obj, file, loc, vars) {
587
+ DEBUG.set(obj, {
588
+ file,
589
+ loc,
590
+ vars
591
+ });
596
592
  }
597
593
  var Serializer = class {
598
594
  #state = new State();
@@ -748,7 +744,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
748
744
  }
749
745
  state.buf.push(access + "(" + ensureId(state, scopeRef) + ")");
750
746
  } else {
751
- const pos = state.buf.push("");
747
+ const pos = state.buf.push("") - 1;
752
748
  const assigns = state.assigned.size;
753
749
  writeProp(state, scope, parent, "");
754
750
  const scopeRef2 = parent && state.refs.get(scope);
@@ -759,7 +755,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
759
755
  fnRef.init = access + "(" + scopeId + ")";
760
756
  fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
761
757
  } else {
762
- state.buf[pos - 2] += access + "(";
758
+ state.buf[pos] = access + "(" + state.buf[pos];
763
759
  state.buf.push(")");
764
760
  }
765
761
  }
@@ -1319,21 +1315,21 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1319
1315
  let message = "Unable to serialize";
1320
1316
  let access = "";
1321
1317
  while (ref?.accessor) {
1322
- const debug2 = ref.parent?.debug;
1323
- if (debug2) {
1324
- const varLoc = debug2.vars?.[ref.accessor];
1318
+ const debug = ref.parent?.debug;
1319
+ if (debug) {
1320
+ const varLoc = debug.vars?.[ref.accessor];
1321
+ let debugAccess = ref.accessor;
1322
+ let debugLoc = debug.loc;
1325
1323
  if (varLoc) {
1326
1324
  if (Array.isArray(varLoc)) {
1327
- message += ` "${varLoc[0]}" in ${debug2.file}:${varLoc[1]}`;
1325
+ debugAccess = varLoc[0];
1326
+ if (varLoc[1]) debugLoc = varLoc[1];
1328
1327
  } else {
1329
- message += ` "${ref.accessor}" in ${debug2.file}:${varLoc}`;
1330
- }
1331
- } else {
1332
- message += ` ${JSON.stringify(ref.accessor)} in ${debug2.file}`;
1333
- if (debug2.loc) {
1334
- message += `:${debug2.loc}`;
1328
+ debugLoc = varLoc;
1335
1329
  }
1336
1330
  }
1331
+ message += ` ${JSON.stringify(debugAccess)} in ${debug.file}`;
1332
+ if (debugLoc) message += `:${debugLoc}`;
1337
1333
  break;
1338
1334
  }
1339
1335
  access = toAccess(ref.accessor) + access;
@@ -1729,7 +1725,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
1729
1725
  )
1730
1726
  );
1731
1727
  }
1732
- function writeScope(scopeId, partialScope) {
1728
+ var writeScope = (scopeId, partialScope) => {
1733
1729
  const { state } = $chunk.boundary;
1734
1730
  const { scopes } = state;
1735
1731
  let scope = scopes.get(scopeId);
@@ -1753,6 +1749,15 @@ function writeScope(scopeId, partialScope) {
1753
1749
  };
1754
1750
  }
1755
1751
  return scope;
1752
+ };
1753
+ if (true) {
1754
+ writeScope = /* @__PURE__ */ ((writeScope2) => (scopeId, partialScope, file, loc, vars) => {
1755
+ const scope = writeScope2(scopeId, partialScope);
1756
+ if (file && loc !== void 0) {
1757
+ setDebugInfo(scope, file, loc, vars);
1758
+ }
1759
+ return scope;
1760
+ })(writeScope);
1756
1761
  }
1757
1762
  function writeExistingScope(scope) {
1758
1763
  return writeScope(scope[K_SCOPE_ID], scope);
@@ -1888,7 +1893,7 @@ var State2 = class {
1888
1893
  this.$global = $global2;
1889
1894
  this.$global = $global2;
1890
1895
  if ($global2.cspNonce) {
1891
- this.nonceAttr = " " + escapeAttrValue($global2.cspNonce + "");
1896
+ this.nonceAttr = " nonce" + attrAssignment($global2.cspNonce);
1892
1897
  }
1893
1898
  }
1894
1899
  tagId = 1;
@@ -2263,15 +2268,15 @@ function getFilteredGlobals($global2) {
2263
2268
  }
2264
2269
 
2265
2270
  // src/html/attrs.ts
2266
- function classAttr(val) {
2267
- return stringAttr("class", classValue(val));
2271
+ function classAttr(value) {
2272
+ return stringAttr("class", classValue(value));
2268
2273
  }
2269
- function styleAttr(val) {
2270
- return stringAttr("style", styleValue(val));
2274
+ function styleAttr(value) {
2275
+ return stringAttr("style", styleValue(value));
2271
2276
  }
2272
2277
  function optionValueAttr(value) {
2273
2278
  const { [kSelectedValue]: selectedValue } = getChunk()?.context || {};
2274
- return attr("value", value) + (!isVoid(value) && (Array.isArray(value) ? selectedValue.includes(value) : selectedValue === value) ? ` selected` : "");
2279
+ return attr("value", value) + (!isVoid(value) && (Array.isArray(value) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
2275
2280
  }
2276
2281
  var kSelectedValue = Symbol("selectedValue");
2277
2282
  function controllable_select_value(scopeId, nodeAccessor, value, valueChange, content) {
@@ -2350,8 +2355,8 @@ function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChan
2350
2355
  }
2351
2356
  return attr("open", open);
2352
2357
  }
2353
- function attr(name, val) {
2354
- return isVoid(val) ? "" : nonVoidAttr(name, val);
2358
+ function attr(name, value) {
2359
+ return isVoid(value) ? "" : nonVoidAttr(name, value);
2355
2360
  }
2356
2361
  function attrs(data, nodeAccessor, scopeId, tagName) {
2357
2362
  let result = "";
@@ -2412,19 +2417,19 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2412
2417
  break;
2413
2418
  }
2414
2419
  for (const name in data) {
2415
- const val = data[name];
2420
+ const value = data[name];
2416
2421
  switch (name) {
2417
2422
  case "class":
2418
- result += classAttr(val);
2423
+ result += classAttr(value);
2419
2424
  break;
2420
2425
  case "style":
2421
- result += styleAttr(val);
2426
+ result += styleAttr(value);
2422
2427
  break;
2423
2428
  case "":
2424
2429
  case "content":
2425
2430
  break;
2426
2431
  default:
2427
- if (!isVoid(val)) {
2432
+ if (!isVoid(value)) {
2428
2433
  if (isEventHandler(name)) {
2429
2434
  if (!events) {
2430
2435
  events = {};
@@ -2432,9 +2437,9 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2432
2437
  [nodeAccessor + "~" /* EventAttributes */]: events
2433
2438
  });
2434
2439
  }
2435
- events[getEventHandlerName(name)] = val;
2440
+ events[getEventHandlerName(name)] = value;
2436
2441
  } else if (!skip.test(name)) {
2437
- result += nonVoidAttr(name, val);
2442
+ result += nonVoidAttr(name, value);
2438
2443
  }
2439
2444
  }
2440
2445
  break;
@@ -2456,36 +2461,48 @@ function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
2456
2461
  [nodeAccessor + ";" /* ControlledHandler */]: valueChange
2457
2462
  });
2458
2463
  }
2459
- function stringAttr(name, val) {
2460
- return val && ` ${name}=${escapeAttrValue(val)}`;
2464
+ function stringAttr(name, value) {
2465
+ return value && " " + name + attrAssignment(value);
2461
2466
  }
2462
- function nonVoidAttr(name, val) {
2463
- switch (typeof val) {
2467
+ function nonVoidAttr(name, value) {
2468
+ switch (typeof value) {
2464
2469
  case "string":
2465
- return ` ${name + attrAssignment(val)}`;
2470
+ return " " + name + attrAssignment(value);
2466
2471
  case "boolean":
2467
- return ` ${name}`;
2472
+ return " " + name;
2468
2473
  case "number":
2469
- return ` ${name}=${val}`;
2474
+ return " " + name + "=" + value;
2470
2475
  case "object":
2471
- if (val instanceof RegExp) {
2472
- return ` ${name + attrAssignment(val.source)}`;
2476
+ if (value instanceof RegExp) {
2477
+ return " " + name + attrAssignment(value.source);
2473
2478
  }
2474
2479
  break;
2475
2480
  }
2476
- return ` ${name + attrAssignment(val + "")}`;
2481
+ return " " + name + attrAssignment(value + "");
2477
2482
  }
2478
- function attrAssignment(val) {
2479
- return val ? `=${escapeAttrValue(val)}` : "";
2483
+ var singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g;
2484
+ var doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g;
2485
+ var needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g;
2486
+ function attrAssignment(value) {
2487
+ return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, '"') ? "='" + escapeSingleQuotedAttrValue(value) + "'" : '="' + escapeDoubleQuotedAttrValue(value) + '"' : "=" + value : "";
2480
2488
  }
2481
- var unsafeAttrChars = /["'>\s]/g;
2482
- function escapeAttrValue(str) {
2483
- if (unsafeAttrChars.test(str)) {
2484
- const c = str[unsafeAttrChars.lastIndex - 1];
2485
- unsafeAttrChars.lastIndex = 0;
2486
- return c === '"' ? `'${str.replace(/'/g, "&#39;")}'` : `"${str.replace(/"/g, "&#34;")}"`;
2487
- }
2488
- return str;
2489
+ function escapeSingleQuotedAttrValue(value) {
2490
+ return singleQuoteAttrReplacements.test(value) ? value.replace(
2491
+ singleQuoteAttrReplacements,
2492
+ replaceUnsafeSingleQuoteAttrChar
2493
+ ) : value;
2494
+ }
2495
+ function replaceUnsafeSingleQuoteAttrChar(match) {
2496
+ return match === "'" ? "&#39;" : "&amp;";
2497
+ }
2498
+ function escapeDoubleQuotedAttrValue(value) {
2499
+ return doubleQuoteAttrReplacements.test(value) ? value.replace(
2500
+ doubleQuoteAttrReplacements,
2501
+ replaceUnsafeDoubleQuoteAttrChar
2502
+ ) : value;
2503
+ }
2504
+ function replaceUnsafeDoubleQuoteAttrChar(match) {
2505
+ return match === '"' ? "&#34;" : "&amp;";
2489
2506
  }
2490
2507
 
2491
2508
  // src/common/compat-meta.ts
@@ -2967,7 +2984,6 @@ function NOOP2() {
2967
2984
  controllable_textarea_value,
2968
2985
  createRenderer,
2969
2986
  createTemplate,
2970
- debug,
2971
2987
  dynamicTagArgs,
2972
2988
  dynamicTagInput,
2973
2989
  ensureScopeWithId,