Skip to content

Commit

Permalink
fix: check if dummyNode is on the targetNode
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 11, 2021
1 parent e181e07 commit 3071ef3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/dom-styles-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default class DOMStylesReader {
*/
this.dummyNode = undefined

// used to check if the dummyNode is on the current targetNode
this.targetNode = undefined

/**
* Set to true once tokenized
* @access private
Expand Down Expand Up @@ -99,12 +102,13 @@ export default class DOMStylesReader {
* @access private
*/
ensureDummyNodeExistence (targetNode) {
if (this.dummyNode === undefined) {
if (this.targetNode !== targetNode || this.dummyNode === undefined) {
this.dummyNode = document.createElement('span')
this.dummyNode.style.visibility = 'hidden'

// attach to the target node
targetNode.appendChild(this.dummyNode)
this.targetNode = targetNode
}
}

Expand Down

0 comments on commit 3071ef3

Please sign in to comment.