@percy/dom 1.28.2 → 1.28.3-alpha.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 +23 -2
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -19,6 +19,16 @@
19
19
  switch (elem.type) {
20
20
  case 'checkbox':
21
21
  case 'radio':
22
+ /*
23
+ here we are removing the checked attr if present by default,
24
+ so that only the current selected radio-button will have the checked attr present in the dom
25
+ this happens because in html,
26
+ when the checked attribute is present in the multiple radio-buttons for which only one can be selected at a time,
27
+ the browser will only render the last checked radio-button by default,
28
+ when a user selects any particular radio-button, the checked attribute on other buttons is not removed,
29
+ hence sometimes it shows inconsistent state as html will still show the last radio as selected.
30
+ */
31
+ cloneEl.removeAttribute('checked');
22
32
  if (elem.checked) {
23
33
  cloneEl.setAttribute('checked', '');
24
34
  }
@@ -379,16 +389,27 @@
379
389
  }
380
390
  function serializeBase64(node, resources) {
381
391
  let src = node.src;
392
+ let isHrefUsed = false;
393
+
394
+ // case for SVGAnimatedString
395
+ if (src == null && node.href) {
396
+ isHrefUsed = true;
397
+ src = node.href.baseVal;
398
+ }
382
399
  // skip if src is null
383
400
  if (src == null) return;
384
- let base64String = getBase64Substring(src);
401
+ let base64String = getBase64Substring(src.toString());
385
402
  // skip if src is not base64
386
403
  if (base64String == null) return;
387
404
 
388
405
  // create a resource from the serialized data url
389
406
  let resource = resourceFromText(uid(), mimetype, base64String);
390
407
  resources.add(resource);
391
- node.src = resource.url;
408
+ if (isHrefUsed === true) {
409
+ node.href.baseVal = resource.url;
410
+ } else {
411
+ node.src = resource.url;
412
+ }
392
413
  }
393
414
 
394
415
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.28.2",
3
+ "version": "1.28.3-alpha.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "alpha"
13
13
  },
14
14
  "main": "dist/bundle.js",
15
15
  "browser": "dist/bundle.js",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "interactor.js": "^2.0.0-beta.10"
37
37
  },
38
- "gitHead": "88105fef569632b816955fcd1320bcc4b218bf67"
38
+ "gitHead": "af2067cad8ac8f67dacf2cf7e28ab257e0bac12f"
39
39
  }