-
Notifications
You must be signed in to change notification settings - Fork 1
/
min.js
1 lines (1 loc) · 2.4 KB
/
min.js
1
self.JSDON=function(e){"use strict";var t=JSON.parse,a=function(e){var t=e.length-1,a=e[t];"number"==typeof a&&a<0?e[t]+=-1:e.push(-1)},r=function(e,t){var a=e.name,r=e.value;t.push(2,a),r&&t.push(r)},n=function(e,t,n){var s=e.attributes,o=e.childNodes,i=e.localName;t.push(1,i);for(var l=0,h=s.length;l<h;l++)r(s[l],t);for(var u=0,m=o.length;u<m;u++)c(o[u],t,n);a(t)},s=function(e,t,r){for(var n=e.childNodes,s=0,o=n.length;s<o;s++)c(n[s],t,r);a(t)},c=function(e,t,a,r){if(a(e)){var c=e.nodeType;switch(c){case 1:n(e,t,a);break;case 3:case 8:t.push(c,e.data);break;case 11:case 9:t.push(c),s(e,t,a);break;case 10:var o=e.name,i=e.publicId,l=e.systemId;t.push(c,o),i&&t.push(i),l&&t.push(l);break;default:t.push(42,r(e))}}},o=function(){return!0};return e.fromJSON=function(e){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object,n="string"==typeof e?t(e):e,s=n.length,c=a.createDocumentFragment(),o=c,i=!1,l=a,h=!0,u=0;u<s;){var m=n[u++];switch(m){case 1:for(var p=n[u++],d=p.toLowerCase(),f=[],v=0,g="";2===n[u];){var b=n[++u],w="string"==typeof n[u+1]?n[++u]:"";"is"===b&&(g=w),v=f.push({name:b,value:w}),u++}(h||d!==o.localName.toLowerCase())&&(o=o.appendChild("svg"===d||"ownerSVGElement"in o?l.createElementNS("http://www.w3.org/2000/svg",p):g?l.createElement(p,{is:g}):l.createElement(p)));for(var k=0;k<v;k++)o.setAttribute(f[k].name,f[k].value);h=!0;break;case 3:o.appendChild(l.createTextNode(n[u++]));break;case 8:o.appendChild(l.createComment(n[u++]));break;case 9:var S=new a.defaultView.DOMParser;if(10===n[u]){u++;for(var C=n[u++],N=[C];"string"==typeof n[u];)N.push('"'.concat(n[u++],'"'));switch(N.length){case 2:N[1]="".concat(/\.dtd"$/i.test(N[1])?"SYSTEM":"PUBLIC"," ").concat(N[1]);break;case 3:N[1]="PUBLIC ".concat(N[1])}switch(C){case"html":case"HTML":l=S.parseFromString("<!DOCTYPE ".concat(N.join(" "),"><html></html>"),"text/html");break;case"svg":case"SVG":l=S.parseFromString("<!DOCTYPE ".concat(N.join(" "),"><svg />"),"image/svg+xml");break;default:l=S.parseFromString("<root />","text/xml")}}else l=S.parseFromString("<html></html>","text/html");o=l.documentElement,h=!1;break;case 11:i=!0;break;case 42:o.appendChild(r(n[u++]));break;default:do{m-=-1,o=o.parentNode||c}while(m<0)}}return i?c:l!==a?l:c.firstChild},e.toJSON=function(e,t){var a=[];return c(e,a,t||o,arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object),a},e}({});