phoenix_live_view 0.19.0 → 0.19.2
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/assets/js/phoenix_live_view/dom.js +6 -3
- package/assets/js/phoenix_live_view/dom_patch.js +12 -5
- package/assets/js/phoenix_live_view/live_socket.js +3 -4
- package/assets/js/phoenix_live_view/view.js +1 -1
- package/assets/package.json +1 -1
- package/package.json +1 -1
- package/priv/static/phoenix_live_view.cjs.js +22 -13
- package/priv/static/phoenix_live_view.cjs.js.map +2 -2
- package/priv/static/phoenix_live_view.esm.js +22 -13
- package/priv/static/phoenix_live_view.esm.js.map +2 -2
- package/priv/static/phoenix_live_view.js +22 -13
- package/priv/static/phoenix_live_view.min.js +5 -5
|
@@ -305,17 +305,21 @@ var DOM = {
|
|
|
305
305
|
isUnloadableFormSubmit(e) {
|
|
306
306
|
return !e.defaultPrevented && !this.wantsNewTab(e);
|
|
307
307
|
},
|
|
308
|
-
|
|
308
|
+
isNewPageClick(e, currentLocation) {
|
|
309
|
+
let href = e.target instanceof HTMLAnchorElement ? e.target.getAttribute("href") : null;
|
|
310
|
+
let url;
|
|
311
|
+
if (e.defaultPrevented || href === null || this.wantsNewTab(e)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
309
314
|
if (href.startsWith("mailto:") || href.startsWith("tel:")) {
|
|
310
315
|
return false;
|
|
311
316
|
}
|
|
312
|
-
let url;
|
|
313
317
|
try {
|
|
314
318
|
url = new URL(href);
|
|
315
|
-
} catch (
|
|
319
|
+
} catch (e2) {
|
|
316
320
|
try {
|
|
317
321
|
url = new URL(href, currentLocation);
|
|
318
|
-
} catch (
|
|
322
|
+
} catch (e3) {
|
|
319
323
|
return true;
|
|
320
324
|
}
|
|
321
325
|
}
|
|
@@ -324,7 +328,7 @@ var DOM = {
|
|
|
324
328
|
return url.hash === "" && !url.href.endsWith("#");
|
|
325
329
|
}
|
|
326
330
|
}
|
|
327
|
-
return
|
|
331
|
+
return url.protocol.startsWith("http");
|
|
328
332
|
},
|
|
329
333
|
markPhxChildDestroyed(el) {
|
|
330
334
|
if (this.isPhxChild(el)) {
|
|
@@ -1779,11 +1783,17 @@ var DOMPatch = class {
|
|
|
1779
1783
|
parent.insertBefore(child, sibling);
|
|
1780
1784
|
}
|
|
1781
1785
|
let children = limit !== null && Array.from(parent.children);
|
|
1786
|
+
let childrenToRemove = [];
|
|
1782
1787
|
if (limit && limit < 0 && children.length > limit * -1) {
|
|
1783
|
-
children.slice(0, children.length + limit)
|
|
1788
|
+
childrenToRemove = children.slice(0, children.length + limit);
|
|
1784
1789
|
} else if (limit && limit >= 0 && children.length > limit) {
|
|
1785
|
-
children.slice(limit)
|
|
1790
|
+
childrenToRemove = children.slice(limit);
|
|
1786
1791
|
}
|
|
1792
|
+
childrenToRemove.forEach((removeChild) => {
|
|
1793
|
+
if (!this.streamInserts[removeChild.id]) {
|
|
1794
|
+
this.removeStreamChildElement(removeChild);
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1787
1797
|
},
|
|
1788
1798
|
onBeforeNodeAdded: (el) => {
|
|
1789
1799
|
dom_default.maybeAddPrivateHooks(el, phxViewportTop, phxViewportBottom);
|
|
@@ -1802,7 +1812,7 @@ var DOMPatch = class {
|
|
|
1802
1812
|
if (dom_default.isNowTriggerFormExternal(el, phxTriggerExternal)) {
|
|
1803
1813
|
externalFormTriggered = el;
|
|
1804
1814
|
}
|
|
1805
|
-
if (el.getAttribute && el.getAttribute("name")) {
|
|
1815
|
+
if (el.getAttribute && el.getAttribute("name") && dom_default.isFormInput(el)) {
|
|
1806
1816
|
trackedInputs.push(el);
|
|
1807
1817
|
}
|
|
1808
1818
|
if (dom_default.isPhxChild(el) && view.ownsElement(el) || dom_default.isPhxSticky(el) && view.ownsElement(el.parentNode)) {
|
|
@@ -1834,6 +1844,7 @@ var DOMPatch = class {
|
|
|
1834
1844
|
this.maybeReOrderStream(el);
|
|
1835
1845
|
},
|
|
1836
1846
|
onBeforeElUpdated: (fromEl, toEl) => {
|
|
1847
|
+
dom_default.maybeAddPrivateHooks(toEl, phxViewportTop, phxViewportBottom);
|
|
1837
1848
|
dom_default.cleanChildNodes(toEl, phxUpdate);
|
|
1838
1849
|
if (this.skipCIDSibling(toEl)) {
|
|
1839
1850
|
return false;
|
|
@@ -1883,10 +1894,9 @@ var DOMPatch = class {
|
|
|
1883
1894
|
if (dom_default.isPhxUpdate(toEl, phxUpdate, ["append", "prepend"])) {
|
|
1884
1895
|
appendPrependUpdates.push(new DOMPostMorphRestorer(fromEl, toEl, toEl.getAttribute(phxUpdate)));
|
|
1885
1896
|
}
|
|
1886
|
-
dom_default.maybeAddPrivateHooks(toEl, phxViewportTop, phxViewportBottom);
|
|
1887
1897
|
dom_default.syncAttrsToProps(toEl);
|
|
1888
1898
|
dom_default.applyStickyOperations(toEl);
|
|
1889
|
-
if (toEl.getAttribute("name")) {
|
|
1899
|
+
if (toEl.getAttribute("name") && dom_default.isFormInput(toEl)) {
|
|
1890
1900
|
trackedInputs.push(toEl);
|
|
1891
1901
|
}
|
|
1892
1902
|
this.trackBefore("updated", fromEl, toEl);
|
|
@@ -3312,7 +3322,7 @@ var View = class {
|
|
|
3312
3322
|
meta[name.replace(prefix, "")] = el.getAttribute(name);
|
|
3313
3323
|
}
|
|
3314
3324
|
}
|
|
3315
|
-
if (el.value !== void 0) {
|
|
3325
|
+
if (el.value !== void 0 && !(el instanceof HTMLFormElement)) {
|
|
3316
3326
|
if (!meta) {
|
|
3317
3327
|
meta = {};
|
|
3318
3328
|
}
|
|
@@ -4140,8 +4150,7 @@ var LiveSocket = class {
|
|
|
4140
4150
|
}
|
|
4141
4151
|
let phxEvent = target && target.getAttribute(click);
|
|
4142
4152
|
if (!phxEvent) {
|
|
4143
|
-
|
|
4144
|
-
if (!capture && href !== null && !dom_default.wantsNewTab(e) && dom_default.isNewPageHref(href, window.location)) {
|
|
4153
|
+
if (!capture && dom_default.isNewPageClick(e, window.location)) {
|
|
4145
4154
|
this.unload();
|
|
4146
4155
|
}
|
|
4147
4156
|
return;
|