gyosjs 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gyos.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * GyosJS v0.2.0
2
+ * GyosJS v0.2.1
3
3
  * (c) 2026
4
4
  * @license MIT
5
5
  */
@@ -7050,6 +7050,16 @@
7050
7050
  function findGlobalOutlet() {
7051
7051
  return document.querySelector('[g-outlet]');
7052
7052
  }
7053
+ function stripInertFallbackContent(root) {
7054
+ root.querySelectorAll('noscript').forEach(element => element.remove());
7055
+ }
7056
+ function parseNavigationDocument(html) {
7057
+ const doc = new DOMParser().parseFromString(html, 'text/html');
7058
+ // DOMParser disables scripting and parses noscript children as active markup.
7059
+ // A boosted page runs with scripting enabled, so those fallbacks must stay inert.
7060
+ stripInertFallbackContent(doc);
7061
+ return doc;
7062
+ }
7053
7063
  function resolveTarget(trigger, targetSelector, targetOutletIndex) {
7054
7064
  if (targetSelector) {
7055
7065
  try {
@@ -7086,7 +7096,7 @@
7086
7096
  }
7087
7097
  function saveSnapshot(url, html) {
7088
7098
  // create HTMLElement by html string to remove scripts and get clean snapshot
7089
- const doc = new DOMParser().parseFromString(html, 'text/html');
7099
+ const doc = parseNavigationDocument(html);
7090
7100
  // Ignore hash for snapshot keys
7091
7101
  if (url.includes('#'))
7092
7102
  url = url.split('#')[0];
@@ -7478,10 +7488,11 @@
7478
7488
  }
7479
7489
  // Parse HTML
7480
7490
  const doc = html
7481
- ? new DOMParser().parseFromString(html, 'text/html')
7491
+ ? parseNavigationDocument(html)
7482
7492
  : document.implementation.createHTMLDocument();
7483
7493
  // Pick source fragment
7484
7494
  const src = opts.historyFragment || pickSourceFragment(doc, target, targetOutletIndex);
7495
+ stripInertFallbackContent(src);
7485
7496
  assertActiveNavigation(transaction);
7486
7497
  // Final URL is response.url because in headers there could be redirects
7487
7498
  // because response.url never include hash, we need to manually merge it
@@ -7874,7 +7885,7 @@
7874
7885
  onAfterNavigate,
7875
7886
  portalCreate,
7876
7887
  portalDestroy,
7877
- version: '0.2.0'
7888
+ version: '0.2.1'
7878
7889
  };
7879
7890
 
7880
7891
  exports.applyDirective = applyDirective;