@applitools/dom-capture 11.6.13 → 11.7.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/CHANGELOG.md +7 -0
- package/dist/captureDom.js +3 -3
- package/dist/captureDomForIE.js +3 -3
- package/dist/captureDomPoll.js +3 -3
- package/dist/captureDomPollCjs.js +3 -3
- package/dist/captureDomPollForIE.js +3 -3
- package/dist/pollResult.js +1 -1
- package/dist/pollResultCjs.js +1 -1
- package/dist/pollResultForIE.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [11.7.0](https://github.com/Applitools-Dev/sdk/compare/js/dom-capture@11.6.13...js/dom-capture@11.7.0) (2026-04-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add elementFromPointCheckStatus to DOM capture output | AD-13066 ([#3690](https://github.com/Applitools-Dev/sdk/issues/3690)) ([4fbb117](https://github.com/Applitools-Dev/sdk/commit/4fbb117d53a9a44248772100947ed68133f5b5db))
|
|
12
|
+
|
|
6
13
|
## [11.6.13](https://github.com/Applitools-Dev/sdk/compare/js/dom-capture@11.6.12...js/dom-capture@11.6.13) (2026-03-29)
|
|
7
14
|
|
|
8
15
|
|
package/dist/captureDom.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* @applitools/dom-capture@11.
|
|
1
|
+
/* @applitools/dom-capture@11.7.0 */
|
|
2
2
|
function __captureDom() {
|
|
3
|
-
var captureDom=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=function(){const e=function(e){return function(){var t={};function n(e,t=0){const n=e.charCodeAt(t);return n>=55296&&n<56320?1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var
|
|
3
|
+
var captureDom=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=function(){const e=function(e){return function(){var t={};function n(e,t=0){const n=e.charCodeAt(t);return n>=55296&&n<56320?1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var o=function(e,t){const o=[];let r=0;for(let s=0;s<e.length;++s){const c=n(e,s);let a=0;c>0&&(a=c<128?1:c<2048?2:c<65536?3:c<2097152?4:c<67108864?5:6),r+a>t?(o.push(s),r=a):r+=a}return o};const r=function(e){return e&&e.__esModule?e:{default:e}}(o),s="WIP",c="SUCCESS",a="SUCCESS_CHUNKED",i="ERROR";var u=function(e,t,n={}){const o=function(e,{chunkByteLength:t=0}={}){if(e){if(e.value){if(t){if(!e.chunks)try{const n=JSON.stringify(e.value);e.chunks=(0,r.default)(n,t),e.chunks.length>0&&(e.from=0,e.value=n)}catch(e){return{status:i,error:e.message}}if(e.from>=0)return{status:a,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:c,value:e.value}}return e.error?{status:i,error:e.error}:{status:s}}return{status:i,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[t],n);return(o.status===c||o.status===i||o.status===a&&o.done)&&delete e[t],o};const l=u;var d=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=t.poll=t.pollify=t.chunkify=void 0;const f=d(o);t.chunkify=f.default;const m=d((function(e,t,n){return o=>function(...r){return t[n]||(t[n]={},Promise.resolve().then((()=>e(...r))).then((e=>t[n].value=e)).catch((e=>t[n].error=e.message+"\nStack:"+e.stack))),l(t,n,o)}}));t.pollify=m.default;const h=d(u);t.poll=h.default;const p=d((function(e,t){if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;let n=!0;try{n=e!==decodeURI(e)}catch(e){n=!0}try{const o=new URL(e,t).href;return n?o:decodeURI(o)}catch(t){return n?e:decodeURI(e)}}));t.absolutizeUrl=p.default;const g=d((function(e){return e.contentDocument&&e.contentDocument.location&&!/^https?:$/.test(e.contentDocument.location.protocol)}));t.isInlineFrame=g.default;const y=d((function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}));t.isAccessibleFrame=y.default;const w=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var C={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-color","background-image","background-origin","background-position","background-repeat","background-size","border-color","border-radius","border-style","border-width","color","cursor","display","font-family","font-size","font-weight","font-style","line-height","margin","opacity","overflow","padding","pointer-events","position","text-align","visibility","z-index"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{NODE_TYPES:E}=C;function b(e){return Array.prototype.filter.call(e.parentNode.childNodes,(t=>t.tagName===e.tagName)).indexOf(e)+1}var T=function(t){var n=e.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=t,n.body.appendChild(o),o.sheet},S=function(e){const t=Array.from(e.attributes).find((e=>"href"===e.name.toLowerCase()));return t&&t.value},N=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,(e=>[e.name.toLowerCase(),e.value.toLowerCase()])));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};const P=S,v=N;const{absolutizeUrl:A,isInlineFrame:R}=t,_=T,$=S,k=N,{NODE_TYPES:D}=C;const{absolutizeUrl:U,isInlineFrame:F}=t,O=function(e){const t=e?e.match(w):void 0;return t?t[1]:t},I=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map((e=>{return Promise.race([new Promise((t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e})),(o=t,new Promise((e=>{setTimeout(e,o)})))]);var o})))).reduce(((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e)),{})},L=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r&&(!o||o.nodeType!==E.DOCUMENT_FRAGMENT);)n=`${o.tagName}[${b(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")},x=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(c,a){let i,u="";try{const l=e(c);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,a),c=o(t);if(void 0!==c){const{bundledCss:e,unfetchedResources:n}=s(c,t);n&&(i=new Set(n)),u=`${u}${e}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${a}`,e)}var l,d;return u=`${u}${l=c,d=a,`\n/** ${d} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}},M=T,V=function(e,t){try{return["before","after"].reduce(((n,o)=>{const r=e.ownerDocument.defaultView.getComputedStyle(e,`:${o}`);if(r&&"none"!==r.getPropertyValue("content")){(n=n??{})[o]={};for(const e of t)n[o][e]=r.getPropertyValue(e)}return n}),void 0)}catch(e){return}},j=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then((e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")})).catch((e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")}))];return Number.isNaN(Number(t))||r.push(new Promise((e=>setTimeout(e,t))).then((()=>o.abort()))),Promise.race(r)}},z=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,c;if(n&&function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map((e=>e.nodeValue)).join(""),s=o;else if(n&&v(n)){const a=P(n);if(a)if(function(e){return e&&e.startsWith("data:")}(a)){s=o;const e=a.match(/,(.*)/);r=e?e[1]:""}else s=t(a,o),r=e(s);else r="";c=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:c}}},B=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:c,isUnfetched:a}=e(o,r);let i,u="";if(c){const{bundledCss:e,unfetchedResources:n}=t(c,s);u+=e,i=new Set(n)}else a&&(u+=`${n}${s}${n}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}},Y=function(t){return async function(n=e){const o={},r=Date.now(),s=[];return function e(n,o,r,s){function a(e){if(s.push(async function(e,n,o){let r,s;e&&k(e)&&(s=A($(e),n),r=await t(s),void 0!==r&&(o[s]=r)),r&&await c(r,s,o)}(e,o,r)),e.nodeType===D.ELEMENT)return"IFRAME"===e.tagName.toUpperCase()?u(e):i(e)}function i(e){Array.prototype.map.call(e.childNodes,a)}function u(t){if(i(t),t.contentDocument)try{const n=R(t)?t.baseURI:t.contentDocument.location.href;e(t.contentDocument,n,r,s)}catch(t){console.log(t)}}a(n.documentElement)}(n,n.location.href,o,s),await Promise.all(s),console.log("[prefetchAllCss]",Date.now()-r),function(e){return o[e]};async function c(e,n,o){try{const r=_(e),s=[];for(const e of Array.from(r.cssRules))e instanceof CSSImportRule&&s.push((async()=>{const r=A(e.href,n),s=await t(r);o[r]=s,void 0!==s&&await c(s,r,o)})());await Promise.all(s)}catch(e){console.log(`error during fetchBundledCss, resourceUrl=${n}`,e)}}}},G=function(e){const t=new WeakSet;return function e(n){if(void 0!==n){if(null===n)return"null";if("boolean"==typeof n)return n?"true":"false";if("number"==typeof n)return isFinite(n)?String(n):"null";if("string"==typeof n)return'"'+n.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\\"]/g,(e=>{switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r";case"\t":return"\\t";case"\b":return"\\b";case"\f":return"\\f";default:return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}}))+'"';if("object"==typeof n){if(t.has(n))throw new TypeError("Converting circular structure to JSON");let o;return t.add(n),o=Array.isArray(n)?"["+Array.from(n,(t=>e(t)??"null")).join(",")+"]":"{"+Object.keys(n).filter((e=>void 0!==n[e])).map((t=>e(t)+":"+e(n[t]))).join(",")+"}",t.delete(n),o}}}(e)},{NODE_TYPES:J,DEFAULT_STYLE_PROPS:W,DEFAULT_RECT_PROPS:H,DEFAULT_IGNORED_TAG_NAMES:K}=C;return function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((async function({doc:t=e,styleProps:n=W,rectProps:o=H,elementProps:r=[],ignoredTagNames:s=K,capturePseudo:c=!1,addStats:a=!1,fetchTimeLimit:i=3e4}={}){
|
|
4
4
|
/* MARKER FOR TEST - DO NOT DELETE */
|
|
5
|
-
arguments[1]&&(t=arguments[1]),arguments[2]&&(
|
|
5
|
+
arguments[1]&&(t=arguments[1]),arguments[2]&&(a=arguments[2]),arguments[3]&&(i=arguments[3]),!0===n&&(n=[...getComputedStyle(t.body)]);const u="undefined"!=typeof ShadowRoot,l={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{},elementFromPointCheck:{elapsedTimeMs:0,checked:0,skipped:0}};function d(e){e.startTime=Date.now()}function f(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const m=[];d(l.total);const h=new Set,p=[],g="@@@@@",y="#####",w="-----";d(l.prefetchCss);const C=Y(j(fetch,{fetchTimeLimit:i})),E=await C(t);f(l.prefetchCss);const b=x({parseCss:M,CSSImportRule:CSSImportRule,getCssFromCache:E,absolutizeUrl:U,unfetchedToken:y}),T=z({getCssFromCache:E,absolutizeUrl:U}),S=B({extractCssFromNode:T,getBundledCssFromCssText:b,unfetchedToken:y});d(l.doCaptureDoc);const N=function a(i,d=i.location&&i.location.href){const f=new Set;let y="";const w=C(i.documentElement||i);return w.css=y,m.push(I({bgImages:f}).then((e=>w.images=e))),w;function C(t){if(t.hasAttribute&&t.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:r}=S(t,d);if(y+=n,r)for(const e of r)h.add(e);switch(t.nodeType){case J.TEXT:return function(t){const n=e.createRange();n.selectNode(t);const r=n.getClientRects();return{tagName:"#text",text:t.textContent,rects:r&&r.length&&o.length?Array.from(r).map((e=>{const t={};for(const n of o)t[n]=e[n];return t})):void 0}}(t);case J.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?function(e){const t=E(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[a(n,F(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=L(e);p.push(n),t.childNodes=[`${g}${n}${g}`]}}(t):E(t);case J.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(t.childNodes,C).filter(Boolean)};default:return null}}function E(e){const i=Array.prototype.map.call(e.childNodes,C).filter(Boolean),m=e.shadowRoot&&a(e.shadowRoot,d),h=e.tagName.toUpperCase();if(s.indexOf(h)>-1)return null;const p=t.defaultView.getComputedStyle(e),g=e.getBoundingClientRect(),y={};for(const e of n)y[e]=p.getPropertyValue(e);!y["border-width"]&&n.includes("border-width")&&(y["border-width"]=`${p.getPropertyValue("border-top-width")} ${p.getPropertyValue("border-right-width")} ${p.getPropertyValue("border-bottom-width")} ${p.getPropertyValue("border-left-width")}`);const w={};for(const e of o)w[e]=g[e];let E;const b=g.width,T=g.height,S=0===b||0===T,N=g.right<0||g.bottom<0||g.left>t.documentElement.clientWidth||g.top>t.documentElement.clientHeight;if("none"===p.getPropertyValue("display")||"hidden"===p.getPropertyValue("visibility"))E=!1,l.elementFromPointCheck.skipped++;else if(S||N||u&&e.getRootNode()instanceof ShadowRoot)l.elementFromPointCheck.skipped++;else{const n=Date.now(),o=g.left+b/2,r=g.top+T/2,s=t.elementFromPoint(o,r);null!=s&&null!=e.parentElement&&!e.parentElement.contains(s)&&(E=!1),l.elementFromPointCheck.elapsedTimeMs+=Date.now()-n,l.elementFromPointCheck.checked++}const P=Array.from(e.attributes).map((e=>({key:e.name,value:e.value}))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});"INPUT"!==h&&"TEXTAREA"!==h||!e.value||(P.value&&console.log(`[captureFrame] Overriding element attributes value from ${P.value} to ${e.value}`),P.value=e.value);const v=O(p.getPropertyValue("background-image"));v&&f.add(v);const A=V(e,n),R=c?A:void 0;A&&(P["data-applitools-has-pseudo"]=Object.keys(A).join("_and_"));const _={};for(const t of r)_[t]=e[t];"SELECT"===h&&e.selectedOptions&&e.selectedOptions.length>0&&(_.selectedText=Array.from(e.selectedOptions).map((e=>e.innerText)));const k={tagName:h,style:$(y),rect:$(w),elementFromPointCheckStatus:E,attributes:$(P),properties:$(_),childNodes:i,pseudo:R};return m&&(k.shadowRoot=m),k}}(t);f(l.doCaptureDoc),d(l.waitForImages),await Promise.all(m),f(l.waitForImages),N.version="1.4.0",N.scriptVersion="11.7.0";const P=p.length?`${p.join("\n")}\n`:"",v=h.size?`${Array.from(h).join("\n")}\n`:"",A=JSON.stringify({separator:w,cssStartToken:y,cssEndToken:y,iframeStartToken:`"${g}`,iframeEndToken:`${g}"`});f(l.total);const R=JSON.stringify(N),_=`${A}\n${v}${w}\n${P}${w}\n${"string"==typeof R?R:G(N)}${a?`\n${w}\n${JSON.stringify(l)}`:""}`;return console.log("[captureFrame]",JSON.stringify(l)),_;function $(e){return Object.keys(e).length?e:void 0}}))}()};let t=!0;try{let n=document.head.querySelector("[data-applitools-sandbox]");n||(n=document.createElement("iframe"),n.setAttribute("data-applitools-sandbox",""),n.setAttribute("data-applitools-skip",""),document.head.appendChild(n));const o=window.crypto.getRandomValues(new Uint32Array(1))[0],r=n.contentDocument.createElement("script");r.textContent=`window['ctor-${o}'] = ${e.toString()};`,n.contentDocument.head.appendChild(r);const s=n.contentWindow[`ctor-${o}`];if("function"!=typeof s)throw new Error("Sandbox failed to extract function");return t=!1,s(document).apply(null,arguments)}catch(n){try{return e(document).apply(null,arguments)}catch(e){throw t?e:n}}};return e(t)}();
|
|
6
6
|
|
|
7
7
|
return captureDom.apply(this, arguments);
|
|
8
8
|
}
|