New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/snippets

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/snippets - npm Package Compare versions

Comparing version 2.5.1 to 2.5.2

7

CHANGELOG.md
# Changelog
## [2.5.2](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.5.1...js/snippets@2.5.2) (2024-10-28)
### Bug Fixes
* better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
## [2.5.1](https://github.com/Applitools-Dev/sdk/compare/js/snippets@2.5.0...js/snippets@2.5.1) (2024-10-21)

@@ -4,0 +11,0 @@

10

dist/index.js
exports.addElementIds=function(arg){
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=(void 0===t?[null]:t)[0];if(!e||!e.nodeType)return!0;for(var o=e;o;){if(o===document)return!1;if(null===o.parentNode&&o!==document)return!0;o=(null==o.getRootNode?void 0:o.getRootNode().host)||o.parentNode||o.host}return!0};function o(t,r){if(e([t])){var n=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),a=document.querySelector(n);if(!a)throw new Error("Failed to recover from stale element - selector found: "+n);return a.setAttribute("data-applitools-selector",r),a.setAttribute("data-applitools-recovered",!0),o(a,r)}!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))}(t);var l=t.getAttribute("data-applitools-selector"),u=l?l+" "+r:r;return t.setAttribute("data-applitools-selector",u),'[data-applitools-selector~="'+r+'"]'}return t((function(t){return t.map((function(t){var e=t[0],r=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 o(t,r)}))}))}))}))}();
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)}))}))}))}))}();
return s(arg)
}
exports.addFallbackSelectorIfNeeded=function(arg){
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))}))}();
return s(arg)
}
exports.addPageMarker=function(arg){

@@ -14,3 +18,3 @@ 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=void 0===t?[]:t,r=e[0],o=e[1],n=Object.keys(o).sort(),a=n.reduce((function(t,e){return t[e]={value:r.style.getPropertyValue(e),important:Boolean(r.style.getPropertyPriority(e))},t}),{});return n.forEach((function(t){r.style.setProperty(t,"string"!=typeof o[t]&&o[t]?o[t].value:o[t],o[t]&&o[t].important?"important":"")})),a};return t((function(t){var r=t[0],o=r.mask,n=r.size,a=void 0===n?1:n,i={1:"rgb(0, 0, 0)",0:"rgb(255, 255, 255)"},s=a,p=document.createElement("div");p.setAttribute("data-applitools-marker",""),p.style.setProperty("position","fixed","important"),p.style.setProperty("top","0","important"),p.style.setProperty("left","0","important"),p.style.setProperty("box-sizing","content-box","important"),p.style.setProperty("padding",s+"px","important"),p.style.setProperty("background","rgb(128, 128, 128)","important"),p.style.setProperty("z-index","2147483647","important");for(var l,y=0;y<o.length;y+=l){for(l=1;o[y]===o[y+l];)++l;var m=o[y],d=document.createElement("div");d.style.setProperty("display","block","important"),d.style.setProperty("float","left","important"),d.style.setProperty("width",l*a+"px","important"),d.style.setProperty("height",a+"px","important"),d.style.setProperty("background",i[m],"important"),p.appendChild(d)}var u={value:"none",important:!0},c=e([document.documentElement,{transform:u,"-webkit-transform":u}]),f=e([document.body,{transform:u,"-webkit-transform":u}]);return document.documentElement.setAttribute("data-applitools-original-transforms",JSON.stringify(c)),document.body.setAttribute("data-applitools-original-transforms",JSON.stringify(f)),document.body.appendChild(p),{mask:o,size:a,offset:s}}))}();

exports.cleanupElementIds=function(arg){
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[0].forEach((function(t){if(t.removeAttribute("data-applitools-selector"),t.getRootNode)for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())o.host.removeAttribute("data-applitools-selector")}))}))}();
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=t&&t[0])&&"function"==typeof t.forEach&&t.forEach((function(t){if(t.removeAttribute("data-applitools-selector"),t.getRootNode)try{for(var o=t.getRootNode();o!==document&&o.constructor&&"ShadowRoot"===o.constructor.name;o=o.host.getRootNode())o.host.removeAttribute("data-applitools-selector")}catch(t){}}))}))}();
return s(arg)

@@ -107,3 +111,3 @@ }

exports.isStaleElement=function(arg){
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){var e=(void 0===t?[null]:t)[0];if(!e||!e.nodeType)return!0;for(var o=e;o;){if(o===document)return!1;if(null===o.parentNode&&o!==document)return!0;o=(null==o.getRootNode?void 0:o.getRootNode().host)||o.parentNode||o.host}return!0}))}();
var s=function(){"use strict";function n(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}return n((function(n){var e=n&&n[0]||null;return!e||("isConnected"in window.Node.prototype?!e.isConnected:document.documentElement.contains?!document.documentElement.contains(e):!e.ownerDocument.documentElement.contains(e))}))}();
return s(arg)

@@ -110,0 +114,0 @@ }

{
"name": "@applitools/snippets",
"version": "2.5.1",
"version": "2.5.2",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc