phoenix_live_view 1.1.26 → 1.1.28

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.
@@ -407,7 +407,10 @@ export default class DOMPatch {
407
407
  portalCallbacks.push(() => this.teleport(toEl, morph));
408
408
  // for the magicId optimization we need to ensure that the template contents
409
409
  // are properly updated as they are used when restoring a cloned tree
410
- fromEl.innerHTML = toEl.innerHTML;
410
+ // Note: we can't write fromEl.innerHTML = toEl.innerHTML because in Chrome
411
+ // the HTML parser would drop nested forms, even when it should not.
412
+ // https://issues.chromium.org/issues/490290430
413
+ fromEl.content.replaceChildren(toEl.content.cloneNode(true));
411
414
  return false;
412
415
  }
413
416
 
@@ -193,6 +193,11 @@ export default class View {
193
193
  // bind the view to the element
194
194
  DOM.putPrivate(this.el, "view", this);
195
195
  this.id = this.el.id;
196
+ // destroyViewByEl requires the root set, so we need to set it early
197
+ // otherwise it could happen that we try to apply a join result for a
198
+ // view whose DOM node was already removed
199
+ // See https://github.com/phoenixframework/phoenix_live_view/issues/4177.
200
+ this.el.setAttribute(PHX_ROOT_ID, this.root.id);
196
201
  this.ref = 0;
197
202
  this.lastAckRef = null;
198
203
  this.childJoins = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -2516,7 +2516,7 @@ var DOMPatch = class {
2516
2516
  dom_default.copyPrivates(toEl, fromEl);
2517
2517
  if (dom_default.isPortalTemplate(toEl)) {
2518
2518
  portalCallbacks.push(() => this.teleport(toEl, morph));
2519
- fromEl.innerHTML = toEl.innerHTML;
2519
+ fromEl.content.replaceChildren(toEl.content.cloneNode(true));
2520
2520
  return false;
2521
2521
  }
2522
2522
  if (isFocusedFormEl && fromEl.type !== "hidden" && !focusedSelectChanged) {
@@ -4189,6 +4189,7 @@ var View = class _View {
4189
4189
  }
4190
4190
  dom_default.putPrivate(this.el, "view", this);
4191
4191
  this.id = this.el.id;
4192
+ this.el.setAttribute(PHX_ROOT_ID, this.root.id);
4192
4193
  this.ref = 0;
4193
4194
  this.lastAckRef = null;
4194
4195
  this.childJoins = 0;
@@ -5934,7 +5935,7 @@ var LiveSocket = class {
5934
5935
  }
5935
5936
  // public
5936
5937
  version() {
5937
- return "1.1.26";
5938
+ return "1.1.28";
5938
5939
  }
5939
5940
  isProfileEnabled() {
5940
5941
  return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";