@percy/dom 1.20.2 → 1.21.0
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.
- package/dist/bundle.js +18 -20
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -130,16 +130,30 @@
|
|
|
130
130
|
let [, ext] = mimetype.split('/');
|
|
131
131
|
let path = `/__serialized__/${uid}.${ext}`;
|
|
132
132
|
let url = new URL(path, document.URL).toString();
|
|
133
|
-
// converts text to base64
|
|
134
|
-
let content = window.btoa(data);
|
|
135
133
|
|
|
136
|
-
// return the url,
|
|
134
|
+
// return the url, text content, and mimetype
|
|
137
135
|
return {
|
|
138
136
|
url,
|
|
139
|
-
content,
|
|
137
|
+
content: data,
|
|
140
138
|
mimetype
|
|
141
139
|
};
|
|
142
140
|
}
|
|
141
|
+
function styleSheetFromNode(node) {
|
|
142
|
+
/* istanbul ignore if: sanity check */
|
|
143
|
+
if (node.sheet) return node.sheet;
|
|
144
|
+
|
|
145
|
+
// Cloned style nodes don't have a sheet instance unless they are within
|
|
146
|
+
// a document; we get it by temporarily adding the rules to DOM
|
|
147
|
+
const tempStyle = node.cloneNode();
|
|
148
|
+
tempStyle.setAttribute('data-percy-style-helper', '');
|
|
149
|
+
tempStyle.innerHTML = node.innerHTML;
|
|
150
|
+
const clone = document.cloneNode();
|
|
151
|
+
clone.appendChild(tempStyle);
|
|
152
|
+
const sheet = tempStyle.sheet;
|
|
153
|
+
// Cleanup node
|
|
154
|
+
tempStyle.remove();
|
|
155
|
+
return sheet;
|
|
156
|
+
}
|
|
143
157
|
|
|
144
158
|
// Returns a mostly random uid.
|
|
145
159
|
function uid() {
|
|
@@ -179,22 +193,6 @@
|
|
|
179
193
|
}
|
|
180
194
|
return true;
|
|
181
195
|
}
|
|
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
196
|
function serializeCSSOM(_ref) {
|
|
199
197
|
let {
|
|
200
198
|
dom,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
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": "
|
|
37
|
+
"gitHead": "44c63a3214f1fbfb0b1adcb6fcfe284a9f54d0cb"
|
|
38
38
|
}
|