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 +4 -4
- data/assets/unpoly/unpoly.es6.js +21 -12
- data/assets/unpoly/unpoly.es6.min.js +1 -1
- data/assets/unpoly/unpoly.js +21 -12
- data/assets/unpoly/unpoly.min.js +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- metadata +2 -2
data/assets/unpoly/unpoly.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
/***/ (() => {
|
6
6
|
|
7
7
|
window.up = {
|
8
|
-
version: '3.5.
|
8
|
+
version: '3.5.2'
|
9
9
|
};
|
10
10
|
|
11
11
|
|
@@ -1207,14 +1207,13 @@ up.element = (function () {
|
|
1207
1207
|
function createBrokenDocumentFromHTML(html) {
|
1208
1208
|
return new DOMParser().parseFromString(html, 'text/html');
|
1209
1209
|
}
|
1210
|
-
function
|
1211
|
-
let clone =
|
1212
|
-
for (let { name, value } of scriptish.attributes) {
|
1213
|
-
clone.setAttribute(name, value);
|
1214
|
-
}
|
1215
|
-
clone.textContent = scriptish.innerHTML;
|
1210
|
+
function fixParserDamage(scriptish) {
|
1211
|
+
let clone = createFromHTML(scriptish.outerHTML);
|
1216
1212
|
scriptish.replaceWith(clone);
|
1217
1213
|
}
|
1214
|
+
function disableScript(scriptElement) {
|
1215
|
+
scriptElement.type = 'up-disabled-script';
|
1216
|
+
}
|
1218
1217
|
function createFromHTML(html) {
|
1219
1218
|
const range = document.createRange();
|
1220
1219
|
range.setStart(document.body, 0);
|
@@ -1486,7 +1485,7 @@ up.element = (function () {
|
|
1486
1485
|
attrSelector,
|
1487
1486
|
tagName: elementTagName,
|
1488
1487
|
createBrokenDocumentFromHTML,
|
1489
|
-
|
1488
|
+
fixParserDamage,
|
1490
1489
|
createFromHTML,
|
1491
1490
|
get root() { return getRoot(); },
|
1492
1491
|
paint,
|
@@ -1519,6 +1518,7 @@ up.element = (function () {
|
|
1519
1518
|
parseSelector,
|
1520
1519
|
filteredQuery,
|
1521
1520
|
isEmpty,
|
1521
|
+
disableScript,
|
1522
1522
|
};
|
1523
1523
|
})();
|
1524
1524
|
|
@@ -2526,8 +2526,9 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
|
|
2526
2526
|
up.fragment.markAsDestroying(step.oldElement);
|
2527
2527
|
},
|
2528
2528
|
afterInsert: () => {
|
2529
|
-
this.responseDoc.finalizeElement(step.newElement);
|
2530
2529
|
this._restoreKeepables(step);
|
2530
|
+
this.responseDoc.finalizeElement(step.newElement);
|
2531
|
+
this._unmarkKeepables(step);
|
2531
2532
|
up.hello(step.newElement, step);
|
2532
2533
|
this._addToResult(step.newElement);
|
2533
2534
|
},
|
@@ -2616,6 +2617,8 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
|
|
2616
2617
|
if (keepPlan) {
|
2617
2618
|
const keepableClone = keepable.cloneNode(true);
|
2618
2619
|
keepable.insertAdjacentElement('beforebegin', keepableClone);
|
2620
|
+
keepable.classList.add('up-keeping');
|
2621
|
+
u.each(e.subtree(keepPlan.newElement, 'script'), e.disableScript);
|
2619
2622
|
let viewports = up.viewport.subtree(keepPlan.oldElement);
|
2620
2623
|
keepPlan.revivers = viewports.map(function (viewport) {
|
2621
2624
|
let cursorProps = up.viewport.copyCursorProps(viewport);
|
@@ -2641,6 +2644,11 @@ up.Change.UpdateSteps = class UpdateSteps extends up.Change.Addition {
|
|
2641
2644
|
}
|
2642
2645
|
}
|
2643
2646
|
}
|
2647
|
+
_unmarkKeepables(step) {
|
2648
|
+
for (let keepPlan of step.keepPlans) {
|
2649
|
+
keepPlan.oldElement.classList.remove('up-keeping');
|
2650
|
+
}
|
2651
|
+
}
|
2644
2652
|
_willChangeElement(element) {
|
2645
2653
|
return u.some(this._steps, (step) => step.oldElement.contains(element));
|
2646
2654
|
}
|
@@ -6868,7 +6876,7 @@ up.ResponseDoc = (_a = class ResponseDoc {
|
|
6868
6876
|
}
|
6869
6877
|
_parseDocument(document) {
|
6870
6878
|
document = this._parse(document, e.createBrokenDocumentFromHTML);
|
6871
|
-
this.
|
6879
|
+
this._isDocumentBroken = true;
|
6872
6880
|
this._useParseResult(document);
|
6873
6881
|
}
|
6874
6882
|
_parseFragment(fragment) {
|
@@ -6978,8 +6986,9 @@ up.ResponseDoc = (_a = class ResponseDoc {
|
|
6978
6986
|
}
|
6979
6987
|
finalizeElement(element) {
|
6980
6988
|
up.NonceableCallback.adoptNonces(element, this._cspNonces);
|
6981
|
-
if (this.
|
6982
|
-
|
6989
|
+
if (this._isDocumentBroken) {
|
6990
|
+
let brokenElements = e.subtree(element, ':is(noscript,script,audio,video):not(.up-keeping, .up-keeping *)');
|
6991
|
+
u.each(brokenElements, e.fixParserDamage);
|
6983
6992
|
}
|
6984
6993
|
}
|
6985
6994
|
},
|