@percy/dom 1.20.2 → 1.20.3

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 +16 -16
  2. package/package.json +2 -2
package/dist/bundle.js CHANGED
@@ -140,6 +140,22 @@
140
140
  mimetype
141
141
  };
142
142
  }
143
+ function styleSheetFromNode(node) {
144
+ /* istanbul ignore if: sanity check */
145
+ if (node.sheet) return node.sheet;
146
+
147
+ // Cloned style nodes don't have a sheet instance unless they are within
148
+ // a document; we get it by temporarily adding the rules to DOM
149
+ const tempStyle = node.cloneNode();
150
+ tempStyle.setAttribute('data-percy-style-helper', '');
151
+ tempStyle.innerHTML = node.innerHTML;
152
+ const clone = document.cloneNode();
153
+ clone.appendChild(tempStyle);
154
+ const sheet = tempStyle.sheet;
155
+ // Cleanup node
156
+ tempStyle.remove();
157
+ return sheet;
158
+ }
143
159
 
144
160
  // Returns a mostly random uid.
145
161
  function uid() {
@@ -179,22 +195,6 @@
179
195
  }
180
196
  return true;
181
197
  }
182
- function styleSheetFromNode(node) {
183
- /* istanbul ignore if: sanity check */
184
- if (node.sheet) return node.sheet;
185
-
186
- // Cloned style nodes don't have a sheet instance unless they are within
187
- // a document; we get it by temporarily adding the rules to DOM
188
- const tempStyle = document.createElement('style');
189
- tempStyle.setAttribute('data-percy-style-helper', '');
190
- tempStyle.innerHTML = node.innerHTML;
191
- const clone = document.cloneNode();
192
- clone.appendChild(tempStyle);
193
- const sheet = tempStyle.sheet;
194
- // Cleanup node
195
- tempStyle.remove();
196
- return sheet;
197
- }
198
198
  function serializeCSSOM(_ref) {
199
199
  let {
200
200
  dom,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.20.2",
3
+ "version": "1.20.3",
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": "eb789262833734cfc4b7dbb888e889f571eb886e"
37
+ "gitHead": "520bd156af47080881b651e4819014cbacf76781"
38
38
  }