phoenix_live_view 0.18.9 → 0.18.10

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.
@@ -634,8 +634,8 @@ export default class LiveSocket {
634
634
  }
635
635
  let phxEvent = target && target.getAttribute(click)
636
636
  if(!phxEvent){
637
- let href = e.target.href
638
- if(!capture && href !== undefined && !DOM.wantsNewTab(e) && DOM.isNewPageHref(href, window.location)){
637
+ let href = e.target instanceof HTMLAnchorElement ? e.target.getAttribute("href") : null
638
+ if(!capture && href !== null && !DOM.wantsNewTab(e) && DOM.isNewPageHref(href, window.location)){
639
639
  this.unload()
640
640
  }
641
641
  return
@@ -805,7 +805,7 @@ export default class LiveSocket {
805
805
  view.disableForm(e.target)
806
806
  // safari needs next tick
807
807
  window.requestAnimationFrame(() => {
808
- this.unload()
808
+ if(!DOM.wantsNewTab(e)){ this.unload() }
809
809
  e.target.submit()
810
810
  })
811
811
  })
@@ -814,7 +814,10 @@ export default class LiveSocket {
814
814
 
815
815
  this.on("submit", e => {
816
816
  let phxEvent = e.target.getAttribute(this.binding("submit"))
817
- if(!phxEvent){ return this.unload() }
817
+ if(!phxEvent){
818
+ if(!DOM.wantsNewTab(e)){ this.unload() }
819
+ return
820
+ }
818
821
  e.preventDefault()
819
822
  e.target.disabled = true
820
823
  this.withinOwners(e.target, view => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "repository": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phoenix_live_view",
3
- "version": "0.18.9",
3
+ "version": "0.18.10",
4
4
  "description": "The Phoenix LiveView JavaScript client.",
5
5
  "license": "MIT",
6
6
  "module": "./priv/static/phoenix_live_view.esm.js",
@@ -3848,8 +3848,8 @@ var LiveSocket = class {
3848
3848
  }
3849
3849
  let phxEvent = target && target.getAttribute(click);
3850
3850
  if (!phxEvent) {
3851
- let href = e.target.href;
3852
- if (!capture && href !== void 0 && !dom_default.wantsNewTab(e) && dom_default.isNewPageHref(href, window.location)) {
3851
+ let href = e.target instanceof HTMLAnchorElement ? e.target.getAttribute("href") : null;
3852
+ if (!capture && href !== null && !dom_default.wantsNewTab(e) && dom_default.isNewPageHref(href, window.location)) {
3853
3853
  this.unload();
3854
3854
  }
3855
3855
  return;
@@ -4017,7 +4017,9 @@ var LiveSocket = class {
4017
4017
  this.withinOwners(e.target, (view) => {
4018
4018
  view.disableForm(e.target);
4019
4019
  window.requestAnimationFrame(() => {
4020
- this.unload();
4020
+ if (!dom_default.wantsNewTab(e)) {
4021
+ this.unload();
4022
+ }
4021
4023
  e.target.submit();
4022
4024
  });
4023
4025
  });
@@ -4026,7 +4028,10 @@ var LiveSocket = class {
4026
4028
  this.on("submit", (e) => {
4027
4029
  let phxEvent = e.target.getAttribute(this.binding("submit"));
4028
4030
  if (!phxEvent) {
4029
- return this.unload();
4031
+ if (!dom_default.wantsNewTab(e)) {
4032
+ this.unload();
4033
+ }
4034
+ return;
4030
4035
  }
4031
4036
  e.preventDefault();
4032
4037
  e.target.disabled = true;