Skip to content

Commit 3071ef3

Browse files
committed
fix: check if dummyNode is on the targetNode
1 parent e181e07 commit 3071ef3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/dom-styles-reader.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default class DOMStylesReader {
2121
*/
2222
this.dummyNode = undefined
2323

24+
// used to check if the dummyNode is on the current targetNode
25+
this.targetNode = undefined
26+
2427
/**
2528
* Set to true once tokenized
2629
* @access private
@@ -99,12 +102,13 @@ export default class DOMStylesReader {
99102
* @access private
100103
*/
101104
ensureDummyNodeExistence (targetNode) {
102-
if (this.dummyNode === undefined) {
105+
if (this.targetNode !== targetNode || this.dummyNode === undefined) {
103106
this.dummyNode = document.createElement('span')
104107
this.dummyNode.style.visibility = 'hidden'
105108

106109
// attach to the target node
107110
targetNode.appendChild(this.dummyNode)
111+
this.targetNode = targetNode
108112
}
109113
}
110114

0 commit comments

Comments
 (0)