@percy/dom 1.10.0 → 1.10.1

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.
Files changed (2) hide show
  1. package/dist/bundle.js +5 -5
  2. package/package.json +2 -2
package/dist/bundle.js CHANGED
@@ -105,10 +105,8 @@
105
105
 
106
106
  // Returns true if a stylesheet is a CSSOM-based stylesheet.
107
107
  function isCSSOM(styleSheet) {
108
- var _styleSheet$ownerNode, _styleSheet$ownerNode2;
109
-
110
- // no href, has a rulesheet, and isn't already in the DOM
111
- return !styleSheet.href && styleSheet.cssRules && !((_styleSheet$ownerNode = styleSheet.ownerNode) !== null && _styleSheet$ownerNode !== void 0 && (_styleSheet$ownerNode2 = _styleSheet$ownerNode.innerText) !== null && _styleSheet$ownerNode2 !== void 0 && _styleSheet$ownerNode2.trim().length);
108
+ // no href, has a rulesheet, and has an owner node
109
+ return !styleSheet.href && styleSheet.cssRules && styleSheet.ownerNode;
112
110
  } // Outputs in-memory CSSOM into their respective DOM nodes.
113
111
 
114
112
 
@@ -119,9 +117,11 @@
119
117
  let styleId = styleSheet.ownerNode.getAttribute('data-percy-element-id');
120
118
  let cloneOwnerNode = clone.querySelector(`[data-percy-element-id="${styleId}"]`);
121
119
  style.type = 'text/css';
120
+ style.setAttribute('data-percy-element-id', styleId);
122
121
  style.setAttribute('data-percy-cssom-serialized', 'true');
123
- style.innerHTML = Array.from(styleSheet.cssRules).reduce((prev, cssRule) => prev + cssRule.cssText, '');
122
+ style.innerHTML = Array.from(styleSheet.cssRules).map(cssRule => cssRule.cssText).join('\n');
124
123
  cloneOwnerNode.parentNode.insertBefore(style, cloneOwnerNode.nextSibling);
124
+ cloneOwnerNode.remove();
125
125
  }
126
126
  }
127
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,5 +34,5 @@
34
34
  "devDependencies": {
35
35
  "interactor.js": "^2.0.0-beta.10"
36
36
  },
37
- "gitHead": "a6934eda4fc3b84845ae606d7f5a901f25e0a56f"
37
+ "gitHead": "3e16144300e8b49aab638ceb699630f4be71bb9f"
38
38
  }