unpoly-rails 3.5.1 → 3.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70468fce141a1c580447f48f332f192150fbb33f601d6e5cfba3df0a6315bd0d
4
- data.tar.gz: d63f83daf2dcc332721d80a5bac1372691e239f036c0d08c100dc120824aba0d
3
+ metadata.gz: dc024e14743d564effce2ec6f52d2456a619281a5f95e2404cdf50c23794d11e
4
+ data.tar.gz: 4ae0fefdbd4211142bbdd076e6be8d664c83c9d9308aca2ebf7871817619ea6b
5
5
  SHA512:
6
- metadata.gz: 39f12127fa46df14990674dfd53f578e48bfa23f39cd0dcbfea54ca52f625fbdff5fe14f5bcd41c43e3447ddca731176611f00b2f5900c8f07e9af2266e53ba9
7
- data.tar.gz: 31f165207312a4efa9adb0991914a34bf5117b33f5c3c436e0a126ded2e6c96d319298a7fbda964b45f702a370850d64893092ec0fe560c7100ec813446da7f7
6
+ metadata.gz: 46277dfb7231b60a719cdb7a589f8929797e1201af464a756503246e54362544b5a37c5fbf0a6fb9766220853087fee31ae5cfb99fe049306558275d85dc886c
7
+ data.tar.gz: cd9dd4725b82f16f95f7b4520621b9d0316f0c8ad283178ef1b0667e17b3acf96fc450110cfaebbf13f2c81b2b83e8f5485ae15fc07ead640c10a05c3490c311
@@ -5,7 +5,7 @@
5
5
  /***/ (() => {
6
6
 
7
7
  window.up = {
8
- version: '3.5.1'
8
+ version: '3.5.2'
9
9
  };
10
10
 
11
11
 
@@ -1211,14 +1211,13 @@ up.element = (function () {
1211
1211
  function createBrokenDocumentFromHTML(html) {
1212
1212
  return new DOMParser().parseFromString(html, 'text/html');
1213
1213
  }
1214
- function fixScriptish(scriptish) {
1215
- let clone = document.createElement(scriptish.tagName);
1216
- for (let { name, value } of scriptish.attributes) {
1217
- clone.setAttribute(name, value);
1218
- }
1219
- clone.textContent = scriptish.innerHTML;
1214
+ function fixParserDamage(scriptish) {
1215
+ let clone = createFromHTML(scriptish.outerHTML);
1220
1216
  scriptish.replaceWith(clone);
1221
1217
  }
1218
+ function disableScript(scriptElement) {
1219
+ scriptElement.type = 'up-disabled-script';
1220
+ }
1222
1221
  function createFromHTML(html) {
1223
1222
  const range = document.createRange();
1224
1223
  range.setStart(document.body, 0);
@@ -1491,7 +1490,7 @@ up.element = (function () {
1491
1490
  attrSelector,
1492
1491
  tagName: elementTagName,
1493
1492
  createBrokenDocumentFromHTML,
1494
- fixScriptish,
1493
+ fixParserDamage,
1495
1494
  createFromHTML,
1496
1495
  get root() { return getRoot(); },
1497
1496
  paint,
@@ -1524,6 +1523,7 @@ up.element = (function () {
1524
1523
  parseSelector,
1525
1524
  filteredQuery,
1526
1525
  isEmpty,
1526
+ disableScript,
1527
1527
  };
1528
1528
  })();
1529
1529
 
@@ -2563,8 +2563,9 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
2563
2563
  const morphOptions = Object.assign(Object.assign({}, step), { beforeStart() {
2564
2564
  up.fragment.markAsDestroying(step.oldElement);
2565
2565
  }, afterInsert: () => {
2566
- this.responseDoc.finalizeElement(step.newElement);
2567
2566
  this._restoreKeepables(step);
2567
+ this.responseDoc.finalizeElement(step.newElement);
2568
+ this._unmarkKeepables(step);
2568
2569
  up.hello(step.newElement, step);
2569
2570
  this._addToResult(step.newElement);
2570
2571
  }, beforeDetach: () => {
@@ -2643,6 +2644,8 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
2643
2644
  if (keepPlan) {
2644
2645
  const keepableClone = keepable.cloneNode(true);
2645
2646
  keepable.insertAdjacentElement('beforebegin', keepableClone);
2647
+ keepable.classList.add('up-keeping');
2648
+ u.each(e.subtree(keepPlan.newElement, 'script'), e.disableScript);
2646
2649
  let viewports = up.viewport.subtree(keepPlan.oldElement);
2647
2650
  keepPlan.revivers = viewports.map(function (viewport) {
2648
2651
  let cursorProps = up.viewport.copyCursorProps(viewport);
@@ -2668,6 +2671,11 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
2668
2671
  }
2669
2672
  }
2670
2673
  }
2674
+ _unmarkKeepables(step) {
2675
+ for (let keepPlan of step.keepPlans) {
2676
+ keepPlan.oldElement.classList.remove('up-keeping');
2677
+ }
2678
+ }
2671
2679
  _willChangeElement(element) {
2672
2680
  return u.some(this._steps, (step) => step.oldElement.contains(element));
2673
2681
  }
@@ -6996,7 +7004,7 @@ up.ResponseDoc = (_a = class ResponseDoc {
6996
7004
  }
6997
7005
  _parseDocument(document) {
6998
7006
  document = this._parse(document, e.createBrokenDocumentFromHTML);
6999
- this._scriptishNeedFix = true;
7007
+ this._isDocumentBroken = true;
7000
7008
  this._useParseResult(document);
7001
7009
  }
7002
7010
  _parseFragment(fragment) {
@@ -7107,8 +7115,9 @@ up.ResponseDoc = (_a = class ResponseDoc {
7107
7115
  }
7108
7116
  finalizeElement(element) {
7109
7117
  up.NonceableCallback.adoptNonces(element, this._cspNonces);
7110
- if (this._scriptishNeedFix) {
7111
- element.querySelectorAll('noscript, script').forEach(e.fixScriptish);
7118
+ if (this._isDocumentBroken) {
7119
+ let brokenElements = e.subtree(element, ':is(noscript,script,audio,video):not(.up-keeping, .up-keeping *)');
7120
+ u.each(brokenElements, e.fixParserDamage);
7112
7121
  }
7113
7122
  }
7114
7123
  },