rrweb-snapshot
Advanced tools
Comparing version 0.6.10 to 0.6.11
@@ -306,2 +306,3 @@ var rrwebSnapshot = (function (exports) { | ||
if (n.type === exports.NodeType.Document) { | ||
doc.close(); | ||
doc.open(); | ||
@@ -308,0 +309,0 @@ node = doc; |
@@ -1,2 +0,2 @@ | ||
var rrwebSnapshot=function(e){"use strict";var t;(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";var r=1;function n(){r=1}var a=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function i(e,t){return e.replace(a,function(e,r,n){if(!o.test(n))return"url('"+n+"')";if("/"===n[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+n)+"')";var a,i=t.split("/"),u=n.split("/");i.pop();for(var c=0,s=u;c<s.length;c++){var l=s[c];"."!==l&&(".."===l?i.pop():i.push(l))}return"url('"+i.join("/")+"')"})}function u(e,t){var r=e.createElement("a");return r.href=t,r.href}var c="rr-block";function s(t,r){switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var n=t.classList.contains(c),a=t.tagName.toLowerCase(),o={},s=0,l=Array.from(t.attributes);s<l.length;s++){var d=l[s],p=d.name,m=d.value;o[p]="src"===p||"href"===p?u(r,m):m}if("link"===a){var y=Array.from(r.styleSheets).find(function(e){return e.href===t.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(y);f&&(o={_cssText:i(f,y.href)})}if("input"===a||"textarea"===a||"select"===a){m=t.value;"radio"!==o.type&&"checkbox"!==o.type&&m?o.value=m:t.checked&&(o.checked=t.checked)}if("option"===a){var h=t.parentElement;o.value===h.value&&(o.selected=t.selected)}if(n){var T=t.getBoundingClientRect(),v=T.width,N=T.height;o.rr_width=v+"px",o.rr_height=N+"px"}return{type:e.NodeType.Element,tagName:a,attributes:o,childNodes:[],isSVG:(g=t,"svg"===g.tagName||g instanceof SVGElement||void 0),needBlock:n};case t.TEXT_NODE:var C=t.parentNode&&t.parentNode.tagName,E=t.textContent,D="STYLE"===C||void 0;return D&&E&&(E=i(E,location.href)),"SCRIPT"===C&&(E="SCRIPT_PLACEHOLDER"),{type:e.NodeType.Text,textContent:E||"",isStyle:D};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||""};default:return!1}var g}function l(t,n,a,o){void 0===o&&(o=!1);var i=s(t,n);if(!i)return console.warn(t,"not serialized"),null;var u=Object.assign(i,{id:r++});t.__sn=u,a[u.id]=t;var c=!o;if(u.type===e.NodeType.Element&&(c=c&&!u.needBlock,delete u.needBlock),(u.type===e.NodeType.Document||u.type===e.NodeType.Element)&&c)for(var d=0,p=Array.from(t.childNodes);d<p.length;d++){var m=l(p[d],n,a);m&&u.childNodes.push(m)}return u}var d={script:"noscript"};var p=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function y(e){return e.replace(p,function(e,t,r){if(m.test(t)){var n=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+n.replace(/^\s*/,"")+r}return e})}function f(t,r){switch(t.type){case e.NodeType.Document:return r.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return r.implementation.createDocumentType(t.name,t.publicId,t.systemId);case e.NodeType.Element:var n=function(e){var t=d[e.tagName]?d[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t),a=void 0;for(var o in a=t.isSVG?r.createElementNS("http://www.w3.org/2000/svg",n):r.createElement(n),t.attributes)if(t.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var i=t.attributes[o];i="boolean"==typeof i?"":i;var u="textarea"===n&&"value"===o,c="style"===n&&"_cssText"===o;if(c&&(i=y(i)),u||c){var s=r.createTextNode(i);a.appendChild(s);continue}if("iframe"===n&&"src"===o)continue;try{a.setAttribute(o,i)}catch(e){}}else t.attributes.rr_width&&(a.style.width=t.attributes.rr_width),t.attributes.rr_height&&(a.style.height=t.attributes.rr_height);return a;case e.NodeType.Text:return r.createTextNode(t.isStyle?y(t.textContent):t.textContent);case e.NodeType.CDATA:return r.createCDATASection(t.textContent);case e.NodeType.Comment:return r.createComment(t.textContent);default:return null}}function h(t,r,n,a){void 0===a&&(a=!1);var o=f(t,r);if(!o)return null;if(t.type===e.NodeType.Document&&(r.open(),o=r),o.__sn=t,n[t.id]=o,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!a)for(var i=0,u=t.childNodes;i<u.length;i++){var c=u[i],s=h(c,r,n);s?o.appendChild(s):console.warn("Failed to rebuild",c)}return o}return e.snapshot=function(e){n();var t={};return[l(e,e,t),t]},e.serializeNodeWithId=l,e.resetId=n,e.rebuild=function(e,t){var r={};return[h(e,t,r),r]},e.buildNodeWithSN=h,e}({}); | ||
var rrwebSnapshot=function(e){"use strict";var t;(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";var r=1;function n(){r=1}var a=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function i(e,t){return e.replace(a,function(e,r,n){if(!o.test(n))return"url('"+n+"')";if("/"===n[0])return"url('"+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+n)+"')";var a,i=t.split("/"),u=n.split("/");i.pop();for(var c=0,s=u;c<s.length;c++){var l=s[c];"."!==l&&(".."===l?i.pop():i.push(l))}return"url('"+i.join("/")+"')"})}function u(e,t){var r=e.createElement("a");return r.href=t,r.href}var c="rr-block";function s(t,r){switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var n=t.classList.contains(c),a=t.tagName.toLowerCase(),o={},s=0,l=Array.from(t.attributes);s<l.length;s++){var d=l[s],p=d.name,m=d.value;o[p]="src"===p||"href"===p?u(r,m):m}if("link"===a){var y=Array.from(r.styleSheets).find(function(e){return e.href===t.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(y);f&&(o={_cssText:i(f,y.href)})}if("input"===a||"textarea"===a||"select"===a){m=t.value;"radio"!==o.type&&"checkbox"!==o.type&&m?o.value=m:t.checked&&(o.checked=t.checked)}if("option"===a){var h=t.parentElement;o.value===h.value&&(o.selected=t.selected)}if(n){var T=t.getBoundingClientRect(),v=T.width,N=T.height;o.rr_width=v+"px",o.rr_height=N+"px"}return{type:e.NodeType.Element,tagName:a,attributes:o,childNodes:[],isSVG:(g=t,"svg"===g.tagName||g instanceof SVGElement||void 0),needBlock:n};case t.TEXT_NODE:var C=t.parentNode&&t.parentNode.tagName,E=t.textContent,D="STYLE"===C||void 0;return D&&E&&(E=i(E,location.href)),"SCRIPT"===C&&(E="SCRIPT_PLACEHOLDER"),{type:e.NodeType.Text,textContent:E||"",isStyle:D};case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||""};default:return!1}var g}function l(t,n,a,o){void 0===o&&(o=!1);var i=s(t,n);if(!i)return console.warn(t,"not serialized"),null;var u=Object.assign(i,{id:r++});t.__sn=u,a[u.id]=t;var c=!o;if(u.type===e.NodeType.Element&&(c=c&&!u.needBlock,delete u.needBlock),(u.type===e.NodeType.Document||u.type===e.NodeType.Element)&&c)for(var d=0,p=Array.from(t.childNodes);d<p.length;d++){var m=l(p[d],n,a);m&&u.childNodes.push(m)}return u}var d={script:"noscript"};var p=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function y(e){return e.replace(p,function(e,t,r){if(m.test(t)){var n=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+n.replace(/^\s*/,"")+r}return e})}function f(t,r){switch(t.type){case e.NodeType.Document:return r.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return r.implementation.createDocumentType(t.name,t.publicId,t.systemId);case e.NodeType.Element:var n=function(e){var t=d[e.tagName]?d[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t),a=void 0;for(var o in a=t.isSVG?r.createElementNS("http://www.w3.org/2000/svg",n):r.createElement(n),t.attributes)if(t.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var i=t.attributes[o];i="boolean"==typeof i?"":i;var u="textarea"===n&&"value"===o,c="style"===n&&"_cssText"===o;if(c&&(i=y(i)),u||c){var s=r.createTextNode(i);a.appendChild(s);continue}if("iframe"===n&&"src"===o)continue;try{a.setAttribute(o,i)}catch(e){}}else t.attributes.rr_width&&(a.style.width=t.attributes.rr_width),t.attributes.rr_height&&(a.style.height=t.attributes.rr_height);return a;case e.NodeType.Text:return r.createTextNode(t.isStyle?y(t.textContent):t.textContent);case e.NodeType.CDATA:return r.createCDATASection(t.textContent);case e.NodeType.Comment:return r.createComment(t.textContent);default:return null}}function h(t,r,n,a){void 0===a&&(a=!1);var o=f(t,r);if(!o)return null;if(t.type===e.NodeType.Document&&(r.close(),r.open(),o=r),o.__sn=t,n[t.id]=o,(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!a)for(var i=0,u=t.childNodes;i<u.length;i++){var c=u[i],s=h(c,r,n);s?o.appendChild(s):console.warn("Failed to rebuild",c)}return o}return e.snapshot=function(e){n();var t={};return[l(e,e,t),t]},e.serializeNodeWithId=l,e.resetId=n,e.rebuild=function(e,t){var r={};return[h(e,t,r),r]},e.buildNodeWithSN=h,e}({}); | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -304,2 +304,3 @@ var NodeType; | ||
if (n.type === NodeType.Document) { | ||
doc.close(); | ||
doc.open(); | ||
@@ -306,0 +307,0 @@ node = doc; |
@@ -1,2 +0,2 @@ | ||
var NodeType;!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,r,n){if(!RELATIVE_PATH.test(n))return"url('"+n+"')";if("/"===n[0])return"url('"+(extractOrigin(t)+n)+"')";var o=t.split("/"),a=n.split("/");o.pop();for(var i=0,s=a;i<s.length;i++){var u=s[i];"."!==u&&(".."===u?o.pop():o.push(u))}return"url('"+o.join("/")+"')"})}function absoluteToDoc(e,t){var r=e.createElement("a");return r.href=t,r.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(BLOCK_CLASS),n=e.tagName.toLowerCase(),o={},a=0,i=Array.from(e.attributes);a<i.length;a++){var s=i[a],u=s.name,l=s.value;o[u]="src"===u||"href"===u?absoluteToDoc(t,l):l}if("link"===n){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),c=getCssRulesString(d);c&&(o={_cssText:absoluteToStylesheet(c,d.href)})}if("input"===n||"textarea"===n||"select"===n){l=e.value;"radio"!==o.type&&"checkbox"!==o.type&&l?o.value=l:e.checked&&(o.checked=e.checked)}if("option"===n){var p=e.parentElement;o.value===p.value&&(o.selected=e.selected)}if(r){var T=e.getBoundingClientRect(),N=T.width,y=T.height;o.rr_width=N+"px",o.rr_height=y+"px"}return{type:NodeType.Element,tagName:n,attributes:o,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:r};case e.TEXT_NODE:var h=e.parentNode&&e.parentNode.tagName,m=e.textContent,f="STYLE"===h||void 0;return f&&m&&(m=absoluteToStylesheet(m,location.href)),"SCRIPT"===h&&(m="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:m||"",isStyle:f};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,r,n){void 0===n&&(n=!1);var o=serializeNode(e,t);if(!o)return console.warn(e,"not serialized"),null;var a=Object.assign(o,{id:genId()});e.__sn=a,r[a.id]=e;var i=!n;if(a.type===NodeType.Element&&(i=i&&!a.needBlock,delete a.needBlock),(a.type===NodeType.Document||a.type===NodeType.Element)&&i)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var l=serializeNodeWithId(u[s],t,r);l&&a.childNodes.push(l)}return a}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,r){if(HOVER_SELECTOR.test(t)){var n=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+n.replace(/^\s*/,"")+r}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var r=getTagName(e),n=void 0;for(var o in n=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",r):t.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var i="textarea"===r&&"value"===o,s="style"===r&&"_cssText"===o;if(s&&(a=addHoverClass(a)),i||s){var u=t.createTextNode(a);n.appendChild(u);continue}if("iframe"===r&&"src"===o)continue;try{n.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(n.style.width=e.attributes.rr_width),e.attributes.rr_height&&(n.style.height=e.attributes.rr_height);return n;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,r,n){void 0===n&&(n=!1);var o=buildNode(e,t);if(!o)return null;if(e.type===NodeType.Document&&(t.open(),o=t),o.__sn=e,r[e.id]=o,(e.type===NodeType.Document||e.type===NodeType.Element)&&!n)for(var a=0,i=e.childNodes;a<i.length;a++){var s=i[a],u=buildNodeWithSN(s,t,r);u?o.appendChild(u):console.warn("Failed to rebuild",s)}return o}function rebuild(e,t){var r={};return[buildNodeWithSN(e,t,r),r]}export{snapshot,serializeNodeWithId,resetId,rebuild,buildNodeWithSN,NodeType}; | ||
var NodeType;!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,r,n){if(!RELATIVE_PATH.test(n))return"url('"+n+"')";if("/"===n[0])return"url('"+(extractOrigin(t)+n)+"')";var o=t.split("/"),a=n.split("/");o.pop();for(var i=0,s=a;i<s.length;i++){var u=s[i];"."!==u&&(".."===u?o.pop():o.push(u))}return"url('"+o.join("/")+"')"})}function absoluteToDoc(e,t){var r=e.createElement("a");return r.href=t,r.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(BLOCK_CLASS),n=e.tagName.toLowerCase(),o={},a=0,i=Array.from(e.attributes);a<i.length;a++){var s=i[a],u=s.name,l=s.value;o[u]="src"===u||"href"===u?absoluteToDoc(t,l):l}if("link"===n){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),c=getCssRulesString(d);c&&(o={_cssText:absoluteToStylesheet(c,d.href)})}if("input"===n||"textarea"===n||"select"===n){l=e.value;"radio"!==o.type&&"checkbox"!==o.type&&l?o.value=l:e.checked&&(o.checked=e.checked)}if("option"===n){var p=e.parentElement;o.value===p.value&&(o.selected=e.selected)}if(r){var T=e.getBoundingClientRect(),N=T.width,y=T.height;o.rr_width=N+"px",o.rr_height=y+"px"}return{type:NodeType.Element,tagName:n,attributes:o,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:r};case e.TEXT_NODE:var h=e.parentNode&&e.parentNode.tagName,m=e.textContent,f="STYLE"===h||void 0;return f&&m&&(m=absoluteToStylesheet(m,location.href)),"SCRIPT"===h&&(m="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:m||"",isStyle:f};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,r,n){void 0===n&&(n=!1);var o=serializeNode(e,t);if(!o)return console.warn(e,"not serialized"),null;var a=Object.assign(o,{id:genId()});e.__sn=a,r[a.id]=e;var i=!n;if(a.type===NodeType.Element&&(i=i&&!a.needBlock,delete a.needBlock),(a.type===NodeType.Document||a.type===NodeType.Element)&&i)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var l=serializeNodeWithId(u[s],t,r);l&&a.childNodes.push(l)}return a}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,r){if(HOVER_SELECTOR.test(t)){var n=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+n.replace(/^\s*/,"")+r}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var r=getTagName(e),n=void 0;for(var o in n=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",r):t.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var i="textarea"===r&&"value"===o,s="style"===r&&"_cssText"===o;if(s&&(a=addHoverClass(a)),i||s){var u=t.createTextNode(a);n.appendChild(u);continue}if("iframe"===r&&"src"===o)continue;try{n.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(n.style.width=e.attributes.rr_width),e.attributes.rr_height&&(n.style.height=e.attributes.rr_height);return n;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,r,n){void 0===n&&(n=!1);var o=buildNode(e,t);if(!o)return null;if(e.type===NodeType.Document&&(t.close(),t.open(),o=t),o.__sn=e,r[e.id]=o,(e.type===NodeType.Document||e.type===NodeType.Element)&&!n)for(var a=0,i=e.childNodes;a<i.length;a++){var s=i[a],u=buildNodeWithSN(s,t,r);u?o.appendChild(u):console.warn("Failed to rebuild",s)}return o}function rebuild(e,t){var r={};return[buildNodeWithSN(e,t,r),r]}export{snapshot,serializeNodeWithId,resetId,rebuild,buildNodeWithSN,NodeType}; | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -307,2 +307,3 @@ 'use strict'; | ||
if (n.type === exports.NodeType.Document) { | ||
doc.close(); | ||
doc.open(); | ||
@@ -309,0 +310,0 @@ node = doc; |
{ | ||
"name": "rrweb-snapshot", | ||
"version": "0.6.10", | ||
"version": "0.6.11", | ||
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87783
1112