@applitools/dom-capture 11.6.9 → 11.6.11
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 +40 -0
- package/LICENSE +1 -1
- 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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,46 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## [11.6.11](https://github.com/Applitools-Dev/sdk/compare/js/dom-capture@11.6.10...js/dom-capture@11.6.11) (2026-03-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* @applitools/utils bumped to 1.14.2
|
|
17
|
+
#### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
|
|
20
|
+
* @applitools/logger bumped to 2.2.9
|
|
21
|
+
#### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
* @applitools/dom-shared bumped to 1.1.2
|
|
28
|
+
#### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
|
|
31
|
+
* @applitools/test-server bumped to 1.4.1
|
|
32
|
+
#### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* unskip js/mcp ([#3618](https://github.com/Applitools-Dev/sdk/issues/3618)) ([103f9e2](https://github.com/Applitools-Dev/sdk/commit/103f9e2f18cddc225aba2f2f59556e5fa38965c0))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [11.6.10](https://github.com/Applitools-Dev/sdk/compare/js/dom-capture@11.6.9...js/dom-capture@11.6.10) (2026-03-08)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* handle empty data URLs in CSS extraction | FLD-4158 ([#3606](https://github.com/Applitools-Dev/sdk/issues/3606)) ([8adef70](https://github.com/Applitools-Dev/sdk/commit/8adef702c7136b0b4a15f150b3d7ca6f649b30a2))
|
|
45
|
+
|
|
6
46
|
## [11.6.9](https://github.com/Applitools-Dev/sdk/compare/js/dom-capture@11.6.8...js/dom-capture@11.6.9) (2026-02-16)
|
|
7
47
|
|
|
8
48
|
|
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
- -
|
|
1
|
+
- -
|
|
2
2
|
SDK LICENSE AGREEMENT
|
|
3
3
|
IMPORTANT - PLEASE READ CAREFULLY THE TERMS OF THIS LICENSE AGREEMENT (“AGREEMENT”). BY INSTALLING, ACCESSING AND/OR USING THE SOFTWARE (AS DEFINED BELOW), YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT YOU, OR THE COMPANY YOU REPRESENT, (“YOU” OR “LICENSEE”) ARE ENTERING INTO A LEGAL AGREEMENT WITH APPLITOOLS LTD. AND ITS AFFILIATES (“APPLITOOLS”), AND HAVE UNDERSTOOD AND AGREE TO COMPLY WITH, AND BE LEGALLY BOUND BY, THE TERMS AND CONDITIONS OF THIS AGREEMENT. YOU HEREBY WAIVE ANY RIGHTS OR REQUIREMENTS UNDER ANY LAWS OR REGULATIONS IN ANY JURISDICTION WHICH REQUIRE AN ORIGINAL (NON-ELECTRONIC) SIGNATURE OR DELIVERY OR RETENTION OF NON-ELECTRONIC RECORDS, TO THE EXTENT PERMITTED UNDER APPLICABLE LAW.
|
|
4
4
|
THE SOFTWARE MAY BE USED SOLELY FOR YOUR PERSONAL, NON-COMMERCIAL PURPOSES. FOR COMMERCIAL PURPOSES PLEASE CONTACT THE REGIONAL APPLITOOLS BUSINESS REPRESENTATIVE.
|
package/dist/captureDom.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* @applitools/dom-capture@11.6.
|
|
1
|
+
/* @applitools/dom-capture@11.6.11 */
|
|
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 o=function(e,t){const o=[];let r=0;for(let s=0;s<e.length;++s){const a=n(e,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>t?(o.push(s),r=c):r+=c}return o};const r=function(e){return e&&e.__esModule?e:{default:e}}(o),s="WIP",a="SUCCESS",c="SUCCESS_CHUNKED",u="ERROR";var i=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:u,error:e.message}}if(e.from>=0)return{status:c,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:a,value:e.value}}return e.error?{status:u,error:e.error}:{status:s}}return{status:u,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[t],n);return(o.status===a||o.status===u||o.status===c&&o.done)&&delete e[t],o};const l=i;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(i);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 C=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var w={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}=w;function T(e){return Array.prototype.filter.call(e.parentNode.childNodes,(t=>t.tagName===e.tagName)).indexOf(e)+1}var b=function(t){var n=e.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=t,n.body.appendChild(o),o.sheet},N=function(e){const t=Array.from(e.attributes).find((e=>"href"===e.name.toLowerCase()));return t&&t.value},S=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 v=N,A=S;const{absolutizeUrl:_,isInlineFrame:$}=t,R=b,P=N,U=S,{NODE_TYPES:D}=w;const{absolutizeUrl:O,isInlineFrame:k}=t,F=function(e){const t=e?e.match(C):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}[${T(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(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${i}${e}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,e)}var l,d;return i=`${i}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},M=b,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}},z=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)}},B=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;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&&A(n)){const c=v(n);c
|
|
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 a=n(e,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>t?(o.push(s),r=c):r+=c}return o};const r=function(e){return e&&e.__esModule?e:{default:e}}(o),s="WIP",a="SUCCESS",c="SUCCESS_CHUNKED",u="ERROR";var i=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:u,error:e.message}}if(e.from>=0)return{status:c,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:a,value:e.value}}return e.error?{status:u,error:e.error}:{status:s}}return{status:u,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[t],n);return(o.status===a||o.status===u||o.status===c&&o.done)&&delete e[t],o};const l=i;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(i);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 C=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var w={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}=w;function T(e){return Array.prototype.filter.call(e.parentNode.childNodes,(t=>t.tagName===e.tagName)).indexOf(e)+1}var b=function(t){var n=e.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=t,n.body.appendChild(o),o.sheet},N=function(e){const t=Array.from(e.attributes).find((e=>"href"===e.name.toLowerCase()));return t&&t.value},S=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 v=N,A=S;const{absolutizeUrl:_,isInlineFrame:$}=t,R=b,P=N,U=S,{NODE_TYPES:D}=w;const{absolutizeUrl:O,isInlineFrame:k}=t,F=function(e){const t=e?e.match(C):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}[${T(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(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${i}${e}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,e)}var l,d;return i=`${i}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},M=b,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}},z=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)}},B=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;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&&A(n)){const c=v(n);if(c)if(function(e){return e&&e.startsWith("data:")}(c)){s=o;const e=c.match(/,(.*)/);r=e?e[1]:""}else s=t(c,o),r=e(s);else r="";a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}},Y=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},j=function(t){return async function(n=e){const o={},r=Date.now(),s=[];return function e(n,o,r,s){function c(e){if(s.push(async function(e,n,o){let r,s;e&&U(e)&&(s=_(P(e),n),r=await t(s),void 0!==r&&(o[s]=r)),r&&await a(r,s,o)}(e,o,r)),e.nodeType===D.ELEMENT)return"IFRAME"===e.tagName.toUpperCase()?i(e):u(e)}function u(e){Array.prototype.map.call(e.childNodes,c)}function i(t){if(u(t),t.contentDocument)try{const n=$(t)?t.baseURI:t.contentDocument.location.href;e(t.contentDocument,n,r,s)}catch(t){console.log(t)}}c(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 a(e,n,o){try{const r=R(e),s=[];for(const e of Array.from(r.cssRules))e instanceof CSSImportRule&&s.push((async()=>{const r=_(e.href,n),s=await t(r);o[r]=s,void 0!==s&&await a(s,r,o)})());await Promise.all(s)}catch(e){console.log(`error during fetchBundledCss, resourceUrl=${n}`,e)}}}},{NODE_TYPES:G,DEFAULT_STYLE_PROPS:J,DEFAULT_RECT_PROPS:H,DEFAULT_IGNORED_TAG_NAMES:K}=w;return function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((async function({doc:t=e,styleProps:n=J,rectProps:o=H,elementProps:r=[],ignoredTagNames:s=K,capturePseudo:a=!1,addStats:c=!1,fetchTimeLimit:u=3e4}={}){
|
|
4
4
|
/* MARKER FOR TEST - DO NOT DELETE */
|
|
5
|
-
arguments[1]&&(t=arguments[1]),arguments[2]&&(c=arguments[2]),arguments[3]&&(u=arguments[3]),!0===n&&(n=[...getComputedStyle(t.body)]);const i={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function l(e){e.startTime=Date.now()}function d(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const f=[];l(i.total);const m=new Set,h=[],p="@@@@@",g="#####",y="-----";l(i.prefetchCss);const C=j(z(fetch,{fetchTimeLimit:u})),w=await C(t);d(i.prefetchCss);const E=x({parseCss:M,CSSImportRule:CSSImportRule,getCssFromCache:w,absolutizeUrl:O,unfetchedToken:g}),T=B({getCssFromCache:w,absolutizeUrl:O}),b=Y({extractCssFromNode:T,getBundledCssFromCssText:E,unfetchedToken:g});l(i.doCaptureDoc);const N=function c(u,i=u.location&&u.location.href){const l=new Set;let d="";const g=y(u.documentElement||u);return g.css=d,f.push(I({bgImages:l}).then((e=>g.images=e))),g;function y(t){if(t.hasAttribute&&t.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:r}=b(t,i);if(d+=n,r)for(const e of r)m.add(e);switch(t.nodeType){case G.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 G.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?function(e){const t=C(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[c(n,k(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=L(e);h.push(n),t.childNodes=[`${p}${n}${p}`]}}(t):C(t);case G.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(t.childNodes,y).filter(Boolean)};default:return null}}function C(e){const u=Array.prototype.map.call(e.childNodes,y).filter(Boolean),d=e.shadowRoot&&c(e.shadowRoot,i),f=e.tagName.toUpperCase();if(s.indexOf(f)>-1)return null;const m=t.defaultView.getComputedStyle(e),h=e.getBoundingClientRect(),p={};for(const e of n)p[e]=m.getPropertyValue(e);!p["border-width"]&&n.includes("border-width")&&(p["border-width"]=`${m.getPropertyValue("border-top-width")} ${m.getPropertyValue("border-right-width")} ${m.getPropertyValue("border-bottom-width")} ${m.getPropertyValue("border-left-width")}`);const g={};for(const e of o)g[e]=h[e];const C=Array.from(e.attributes).map((e=>({key:e.name,value:e.value}))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});"INPUT"!==f&&"TEXTAREA"!==f||!e.value||(C.value&&console.log(`[captureFrame] Overriding element attributes value from ${C.value} to ${e.value}`),C.value=e.value);const w=F(m.getPropertyValue("background-image"));w&&l.add(w);const E=V(e,n),T=a?E:void 0;E&&(C["data-applitools-has-pseudo"]=Object.keys(E).join("_and_"));const b={};for(const t of r)b[t]=e[t];"SELECT"===f&&e.selectedOptions&&e.selectedOptions.length>0&&(b.selectedText=Array.from(e.selectedOptions).map((e=>e.innerText)));const N={tagName:f,style:$(p),rect:$(g),attributes:$(C),properties:$(b),childNodes:u,pseudo:T};return d&&(N.shadowRoot=d),N}}(t);d(i.doCaptureDoc),l(i.waitForImages),await Promise.all(f),d(i.waitForImages),N.version="1.3.0",N.scriptVersion="11.6.
|
|
5
|
+
arguments[1]&&(t=arguments[1]),arguments[2]&&(c=arguments[2]),arguments[3]&&(u=arguments[3]),!0===n&&(n=[...getComputedStyle(t.body)]);const i={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function l(e){e.startTime=Date.now()}function d(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const f=[];l(i.total);const m=new Set,h=[],p="@@@@@",g="#####",y="-----";l(i.prefetchCss);const C=j(z(fetch,{fetchTimeLimit:u})),w=await C(t);d(i.prefetchCss);const E=x({parseCss:M,CSSImportRule:CSSImportRule,getCssFromCache:w,absolutizeUrl:O,unfetchedToken:g}),T=B({getCssFromCache:w,absolutizeUrl:O}),b=Y({extractCssFromNode:T,getBundledCssFromCssText:E,unfetchedToken:g});l(i.doCaptureDoc);const N=function c(u,i=u.location&&u.location.href){const l=new Set;let d="";const g=y(u.documentElement||u);return g.css=d,f.push(I({bgImages:l}).then((e=>g.images=e))),g;function y(t){if(t.hasAttribute&&t.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:r}=b(t,i);if(d+=n,r)for(const e of r)m.add(e);switch(t.nodeType){case G.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 G.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?function(e){const t=C(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[c(n,k(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=L(e);h.push(n),t.childNodes=[`${p}${n}${p}`]}}(t):C(t);case G.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(t.childNodes,y).filter(Boolean)};default:return null}}function C(e){const u=Array.prototype.map.call(e.childNodes,y).filter(Boolean),d=e.shadowRoot&&c(e.shadowRoot,i),f=e.tagName.toUpperCase();if(s.indexOf(f)>-1)return null;const m=t.defaultView.getComputedStyle(e),h=e.getBoundingClientRect(),p={};for(const e of n)p[e]=m.getPropertyValue(e);!p["border-width"]&&n.includes("border-width")&&(p["border-width"]=`${m.getPropertyValue("border-top-width")} ${m.getPropertyValue("border-right-width")} ${m.getPropertyValue("border-bottom-width")} ${m.getPropertyValue("border-left-width")}`);const g={};for(const e of o)g[e]=h[e];const C=Array.from(e.attributes).map((e=>({key:e.name,value:e.value}))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});"INPUT"!==f&&"TEXTAREA"!==f||!e.value||(C.value&&console.log(`[captureFrame] Overriding element attributes value from ${C.value} to ${e.value}`),C.value=e.value);const w=F(m.getPropertyValue("background-image"));w&&l.add(w);const E=V(e,n),T=a?E:void 0;E&&(C["data-applitools-has-pseudo"]=Object.keys(E).join("_and_"));const b={};for(const t of r)b[t]=e[t];"SELECT"===f&&e.selectedOptions&&e.selectedOptions.length>0&&(b.selectedText=Array.from(e.selectedOptions).map((e=>e.innerText)));const N={tagName:f,style:$(p),rect:$(g),attributes:$(C),properties:$(b),childNodes:u,pseudo:T};return d&&(N.shadowRoot=d),N}}(t);d(i.doCaptureDoc),l(i.waitForImages),await Promise.all(f),d(i.waitForImages),N.version="1.3.0",N.scriptVersion="11.6.11";const S=h.length?`${h.join("\n")}\n`:"",v=m.size?`${Array.from(m).join("\n")}\n`:"",A=JSON.stringify({separator:y,cssStartToken:g,cssEndToken:g,iframeStartToken:`"${p}`,iframeEndToken:`${p}"`});d(i.total);const _=`${A}\n${v}${y}\n${S}${y}\n${JSON.stringify(N)}${c?`\n${y}\n${JSON.stringify(i)}`:""}`;return console.log("[captureFrame]",JSON.stringify(i)),_;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
|
}
|