From bbbf33fbda48ae00825e1bbea2b18bd160e7c128 Mon Sep 17 00:00:00 2001 From: Christoph Dietrich Date: Sat, 8 Aug 2020 12:52:43 +0200 Subject: [PATCH 1/3] fix: When changing the attribute 'name' of an iframe element, the iframes window must be updated aswell. Otherwise anchor tags with a 'target' attribute won't hit the right iframe. --- src/platforms/web/runtime/modules/attrs.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index b5e0640305c..5c0f5198bd9 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -109,7 +109,14 @@ function baseSetAttr (el, key, value) { // $flow-disable-line el.__ieph = true /* IE placeholder patched */ } - el.setAttribute(key, value) + // When changing the attribute 'name' of an iframe element, the iframes window must be updated aswell. Otherwise + // anchor tags with a 'target' attribute won't hit the right iframe. + if (el.tagName === 'IFRAME' && key === 'name') { + setTimeout((el: HTMLIFrameElement) => { + el.contentWindow.name = value; + }, 0, el); + } + el.setAttribute(key, value); } } From aabf5a1b5820d1f681882113ce30a4f55019f33a Mon Sep 17 00:00:00 2001 From: Christoph Dietrich Date: Thu, 25 Mar 2021 14:55:08 +0100 Subject: [PATCH 2/3] fix: Changes after review: When changing the attribute 'name' of an iframe element, the iframes window must be updated as well. Otherwise anchor tags with a 'target' attribute won't hit the right iframe. --- src/platforms/web/runtime/modules/attrs.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index 5c0f5198bd9..0f2a1f33704 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -109,12 +109,10 @@ function baseSetAttr (el, key, value) { // $flow-disable-line el.__ieph = true /* IE placeholder patched */ } - // When changing the attribute 'name' of an iframe element, the iframes window must be updated aswell. Otherwise + // When changing the attribute 'name' of an iframe element, the iframes window must be updated as well. Otherwise // anchor tags with a 'target' attribute won't hit the right iframe. - if (el.tagName === 'IFRAME' && key === 'name') { - setTimeout((el: HTMLIFrameElement) => { + if (el.tagName === 'IFRAME' && key === 'name' && el.contentWindow) { el.contentWindow.name = value; - }, 0, el); } el.setAttribute(key, value); } From b57d9c16e678bead017b457e7f01136448551e83 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 7 Apr 2021 14:48:01 +0200 Subject: [PATCH 3/3] chore: disable line flow --- src/platforms/web/runtime/modules/attrs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platforms/web/runtime/modules/attrs.js b/src/platforms/web/runtime/modules/attrs.js index 0f2a1f33704..29225c0c03f 100644 --- a/src/platforms/web/runtime/modules/attrs.js +++ b/src/platforms/web/runtime/modules/attrs.js @@ -112,6 +112,7 @@ function baseSetAttr (el, key, value) { // When changing the attribute 'name' of an iframe element, the iframes window must be updated as well. Otherwise // anchor tags with a 'target' attribute won't hit the right iframe. if (el.tagName === 'IFRAME' && key === 'name' && el.contentWindow) { + // $flow-disable-line el.contentWindow.name = value; } el.setAttribute(key, value);