@applitools/snippets 2.6.1 → 2.6.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.6.2](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.6.1...js/snippets@2.6.2) (2024-11-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * provide a clear "stale element" exception message when passing detached regions to `check` ([#2590](https://github.com/Applitools-Dev/sdk/issues/2590)) ([1e5b49e](https://github.com/Applitools-Dev/sdk/commit/1e5b49e9aec6b8caf89f2cdb1f8e81a237d52896))
9
+
3
10
  ## [2.6.1](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.6.0...js/snippets@2.6.1) (2024-10-31)
4
11
 
5
12
 
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  exports.addElementIds=function(arg){
2
- var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){t.hasAttribute("data-applitools-fallback-selector")||t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;){var o=t.tagName.toLowerCase(),r=[].slice.call(t.parentNode.children||[]).indexOf(t)+1;r>1&&(o+=":nth-child("+r+")"),e.unshift(o),t=t.parentNode}return e.length?e.join(" > "):"html"}(t))},o=function(t){var e=t&&t[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))};function r(t,n){if(o([t])){var a=function(t){if(null==t||!t.getAttribute)throw new Error("invalid element: "+JSON.stringify(t));var e=t.getAttribute("data-applitools-fallback-selector");if(!e)throw new Error("Failed to recover from stale element");return e}(t),l=document.querySelector(a);if(!l)throw new Error("Failed to recover from stale element - selector found: "+a);return l.setAttribute("data-applitools-selector",n),l.setAttribute("data-applitools-recovered",!0),r(l,n)}e(t);var i=t.getAttribute("data-applitools-selector"),u=i?i+" "+n:n;return t.setAttribute("data-applitools-selector",u),'[data-applitools-selector~="'+n+'"]'}return t((function(t){return t.map((function(t){var e=t[0],o=t[1];return e.map((function(t){var e=function(t){var e=[t];if(t.getRootNode)for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())e.push(o.host);return e}(t);return e.map((function(t){return r(t,o)}))}))}))}))}();
2
+ var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=t&&t[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))},o=e;var r=function(t){if(!t.hasAttribute("data-applitools-fallback-selector")){if(o([t]))throw new Error("The element is not connected to the DOM: "+function(t){var e=t.attributes,o=t.tagName,r=t.children.length,n=[].slice.call(e).map((function(t){return t.name+'="'+t.value+'"'})).join(" ");return"<"+o+" "+n+(r?">":"/>")}(t));t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;)try{var o,r=t.tagName.toLowerCase(),n=[].slice.call((null==(o=t.parentNode)?void 0:o.children)||[]).indexOf(t);n>-1&&(r+=":nth-child("+(n+1)+")"),e.unshift(r),t=t.parentNode}catch(t){break}return e.length?e.join(" > "):"html"}(t))}},n=e;function a(t,e){if(n([t])){var o=function(t){if(null==t||!t.getAttribute)throw new Error("invalid element: "+JSON.stringify(t));var e=t.getAttribute("data-applitools-fallback-selector");if(!e)throw new Error("Failed to recover from stale element");return e}(t),l=document.querySelectorAll(o);if(!l||1!==l.length)throw new Error("Failed to recover from stale element - selector found: "+o);var i=l[0];return i.setAttribute("data-applitools-selector",e),i.setAttribute("data-applitools-recovered",!0),a(i,e)}r(t);var c=t.getAttribute("data-applitools-selector"),u=c?c+" "+e:e;return t.setAttribute("data-applitools-selector",u),'[data-applitools-selector~="'+e+'"]'}return t((function(t){return t.map((function(t){var e=t[0],o=t[1];return e.map((function(t){var e=function(t){var e=[t];if(t.getRootNode)for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())e.push(o.host);return e}(t);return e.map((function(t){return a(t,o)}))}))}))}))}();
3
3
  return s(arg)
4
4
  }
5
5
  exports.addFallbackSelectorIfNeeded=function(arg){
6
- var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}return t((function(t){t.hasAttribute("data-applitools-fallback-selector")||t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;){var a=t.tagName.toLowerCase(),l=[].slice.call(t.parentNode.children||[]).indexOf(t)+1;l>1&&(a+=":nth-child("+l+")"),e.unshift(a),t=t.parentNode}return e.length?e.join(" > "):"html"}(t))}))}();
6
+ var s=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(t){var e=t&&t[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))};return t((function(t){if(!t.hasAttribute("data-applitools-fallback-selector")){if(e([t]))throw new Error("The element is not connected to the DOM: "+function(t){var e=t.attributes,n=t.tagName,o=t.children.length,r=[].slice.call(e).map((function(t){return t.name+'="'+t.value+'"'})).join(" ");return"<"+n+" "+r+(o?">":"/>")}(t));t.setAttribute("data-applitools-fallback-selector",function(t){var e=[];for(;t&&t.nodeType===Node.ELEMENT_NODE;)try{var n,o=t.tagName.toLowerCase(),r=[].slice.call((null==(n=t.parentNode)?void 0:n.children)||[]).indexOf(t);r>-1&&(o+=":nth-child("+(r+1)+")"),e.unshift(o),t=t.parentNode}catch(t){break}return e.length?e.join(" > "):"html"}(t))}}))}();
7
7
  return s(arg)
8
8
  }
9
9
  exports.addPageMarker=function(arg){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/snippets",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1.git",