the editable site (validation-lab)
This commit is contained in:
commit
3ac81d5a52
13454 files changed
+2227005
No files matched your search
+6
@@ -0,0 +1,6 @@
|
||||
[submodule "html5lib-tests"]
|
||||
path = test/html5lib-tests
|
||||
url = https://github.com/html5lib/html5lib-tests.git
|
||||
[submodule "test/web-platform-tests"]
|
||||
path = test/web-platform-tests
|
||||
url = https://github.com/w3c/web-platform-tests.git
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ui": "exports",
|
||||
"reporter": "dot",
|
||||
"require": "should",
|
||||
"slow": 20,
|
||||
"timeout": 15000,
|
||||
"check-leaks": true
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
16.13.0
|
||||
+550
@@ -0,0 +1,550 @@
|
||||
/* eslint-disable */
|
||||
//prettier-ignore
|
||||
module.exports = {
|
||||
name: "@yarnpkg/plugin-version",
|
||||
factory: function (require) {
|
||||
var plugin=(()=>{var ZB=Object.create,zy=Object.defineProperty,$B=Object.defineProperties,eU=Object.getOwnPropertyDescriptor,tU=Object.getOwnPropertyDescriptors,nU=Object.getOwnPropertyNames,uS=Object.getOwnPropertySymbols,rU=Object.getPrototypeOf,oS=Object.prototype.hasOwnProperty,iU=Object.prototype.propertyIsEnumerable;var lS=(i,o,f)=>o in i?zy(i,o,{enumerable:!0,configurable:!0,writable:!0,value:f}):i[o]=f,E0=(i,o)=>{for(var f in o||(o={}))oS.call(o,f)&&lS(i,f,o[f]);if(uS)for(var f of uS(o))iU.call(o,f)&&lS(i,f,o[f]);return i},Gf=(i,o)=>$B(i,tU(o)),uU=i=>zy(i,"__esModule",{value:!0});var ce=(i,o)=>()=>(o||i((o={exports:{}}).exports,o),o.exports),sS=(i,o)=>{for(var f in o)zy(i,f,{get:o[f],enumerable:!0})},oU=(i,o,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of nU(o))!oS.call(i,p)&&p!=="default"&&zy(i,p,{get:()=>o[p],enumerable:!(f=eU(o,p))||f.enumerable});return i},Mi=i=>oU(uU(zy(i!=null?ZB(rU(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var eD=ce((F$,aS)=>{function lU(i,o){for(var f=-1,p=i==null?0:i.length,E=Array(p);++f<p;)E[f]=o(i[f],f,i);return E}aS.exports=lU});var cS=ce((b$,fS)=>{function sU(){this.__data__=[],this.size=0}fS.exports=sU});var tD=ce((P$,dS)=>{function aU(i,o){return i===o||i!==i&&o!==o}dS.exports=aU});var qy=ce((I$,pS)=>{var fU=tD();function cU(i,o){for(var f=i.length;f--;)if(fU(i[f][0],o))return f;return-1}pS.exports=cU});var vS=ce((B$,hS)=>{var dU=qy(),pU=Array.prototype,hU=pU.splice;function vU(i){var o=this.__data__,f=dU(o,i);if(f<0)return!1;var p=o.length-1;return f==p?o.pop():hU.call(o,f,1),--this.size,!0}hS.exports=vU});var yS=ce((U$,mS)=>{var mU=qy();function yU(i){var o=this.__data__,f=mU(o,i);return f<0?void 0:o[f][1]}mS.exports=yU});var _S=ce((j$,gS)=>{var gU=qy();function _U(i){return gU(this.__data__,i)>-1}gS.exports=_U});var DS=ce((z$,ES)=>{var EU=qy();function DU(i,o){var f=this.__data__,p=EU(f,i);return p<0?(++this.size,f.push([i,o])):f[p][1]=o,this}ES.exports=DU});var Hy=ce((q$,wS)=>{var wU=cS(),SU=vS(),TU=yS(),CU=_S(),xU=DS();function jv(i){var o=-1,f=i==null?0:i.length;for(this.clear();++o<f;){var p=i[o];this.set(p[0],p[1])}}jv.prototype.clear=wU;jv.prototype.delete=SU;jv.prototype.get=TU;jv.prototype.has=CU;jv.prototype.set=xU;wS.exports=jv});var TS=ce((H$,SS)=>{var AU=Hy();function RU(){this.__data__=new AU,this.size=0}SS.exports=RU});var xS=ce((W$,CS)=>{function OU(i){var o=this.__data__,f=o.delete(i);return this.size=o.size,f}CS.exports=OU});var RS=ce((V$,AS)=>{function kU(i){return this.__data__.get(i)}AS.exports=kU});var kS=ce((G$,OS)=>{function MU(i){return this.__data__.has(i)}OS.exports=MU});var nD=ce((Y$,MS)=>{var NU=typeof global=="object"&&global&&global.Object===Object&&global;MS.exports=NU});var Yf=ce((K$,NS)=>{var LU=nD(),FU=typeof self=="object"&&self&&self.Object===Object&&self,bU=LU||FU||Function("return this")();NS.exports=bU});var zv=ce((X$,LS)=>{var PU=Yf(),IU=PU.Symbol;LS.exports=IU});var BS=ce((Q$,bS)=>{var PS=zv(),IS=Object.prototype,BU=IS.hasOwnProperty,UU=IS.toString,Wy=PS?PS.toStringTag:void 0;function jU(i){var o=BU.call(i,Wy),f=i[Wy];try{i[Wy]=void 0;var p=!0}catch(t){}var E=UU.call(i);return p&&(o?i[Wy]=f:delete i[Wy]),E}bS.exports=jU});var jS=ce((J$,US)=>{var zU=Object.prototype,qU=zU.toString;function HU(i){return qU.call(i)}US.exports=HU});var Qp=ce((Z$,zS)=>{var qS=zv(),WU=BS(),VU=jS(),GU="[object Null]",YU="[object Undefined]",HS=qS?qS.toStringTag:void 0;function KU(i){return i==null?i===void 0?YU:GU:HS&&HS in Object(i)?WU(i):VU(i)}zS.exports=KU});var qv=ce(($$,WS)=>{function XU(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}WS.exports=XU});var rD=ce((eee,VS)=>{var QU=Qp(),JU=qv(),ZU="[object AsyncFunction]",$U="[object Function]",ej="[object GeneratorFunction]",tj="[object Proxy]";function nj(i){if(!JU(i))return!1;var o=QU(i);return o==$U||o==ej||o==ZU||o==tj}VS.exports=nj});var YS=ce((tee,GS)=>{var rj=Yf(),ij=rj["__core-js_shared__"];GS.exports=ij});var QS=ce((nee,KS)=>{var iD=YS(),XS=function(){var i=/[^.]+$/.exec(iD&&iD.keys&&iD.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function uj(i){return!!XS&&XS in i}KS.exports=uj});var uD=ce((ree,JS)=>{var oj=Function.prototype,lj=oj.toString;function sj(i){if(i!=null){try{return lj.call(i)}catch(o){}try{return i+""}catch(o){}}return""}JS.exports=sj});var $S=ce((iee,ZS)=>{var aj=rD(),fj=QS(),cj=qv(),dj=uD(),pj=/[\\^$.*+?()[\]{}|]/g,hj=/^\[object .+?Constructor\]$/,vj=Function.prototype,mj=Object.prototype,yj=vj.toString,gj=mj.hasOwnProperty,_j=RegExp("^"+yj.call(gj).replace(pj,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ej(i){if(!cj(i)||fj(i))return!1;var o=aj(i)?_j:hj;return o.test(dj(i))}ZS.exports=Ej});var tT=ce((uee,eT)=>{function Dj(i,o){return i==null?void 0:i[o]}eT.exports=Dj});var sd=ce((oee,nT)=>{var wj=$S(),Sj=tT();function Tj(i,o){var f=Sj(i,o);return wj(f)?f:void 0}nT.exports=Tj});var L_=ce((lee,rT)=>{var Cj=sd(),xj=Line truncated
|
||||
in `+(X||"Unknown")+Me}var ft=1;function Ke(X){return X._status===ft?X._result:null}function jt(X,_e,Ne){var Me=_e.displayName||_e.name||"";return X.displayName||(Me!==""?Ne+"("+Me+")":Ne)}function $t(X){if(X==null)return null;if(typeof X.tag=="number"&&ct("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof X=="function")return X.displayName||X.name||null;if(typeof X=="string")return X;switch(X){case k:return"Fragment";case t:return"Portal";case N:return"Profiler";case L:return"StrictMode";case ne:return"Suspense";case m:return"SuspenseList"}if(typeof X=="object")switch(X.$$typeof){case U:return"Context.Consumer";case C:return"Context.Provider";case W:return jt(X,X.render,"ForwardRef");case we:return $t(X.type);case he:return $t(X.render);case Se:{var _e=X,Ne=Ke(_e);if(Ne)return $t(Ne);break}}return null}var at={},Q=null;function ae(X){Q=X}at.getCurrentStack=null,at.getStackAddendum=function(){var X="";if(Q){var _e=$t(Q.type),Ne=Q._owner;X+=$e(_e,Q._source,Ne&&$t(Ne.type))}var Me=at.getCurrentStack;return Me&&(X+=Me()||""),X};var Ce={current:!1},ue={ReactCurrentDispatcher:Ge,ReactCurrentBatchConfig:rt,ReactCurrentOwner:wt,IsSomeRendererActing:Ce,assign:i};i(ue,{ReactDebugCurrentFrame:at,ReactComponentTreeHook:{}});function je(X){{for(var _e=arguments.length,Ne=new Array(_e>1?_e-1:0),Me=1;Me<_e;Me++)Ne[Me-1]=arguments[Me];At("warn",X,Ne)}}function ct(X){{for(var _e=arguments.length,Ne=new Array(_e>1?_e-1:0),Me=1;Me<_e;Me++)Ne[Me-1]=arguments[Me];At("error",X,Ne)}}function At(X,_e,Ne){{var Me=Ne.length>0&&typeof Ne[Ne.length-1]=="string"&&Ne[Ne.length-1].indexOf(`
|
||||
in`)===0;if(!Me){var dt=ue.ReactDebugCurrentFrame,Hn=dt.getStackAddendum();Hn!==""&&(_e+="%s",Ne=Ne.concat([Hn]))}var Dn=Ne.map(function(Su){return""+Su});Dn.unshift("Warning: "+_e),Function.prototype.apply.call(console[X],console,Dn);try{var or=0,mi="Warning: "+_e.replace(/%s/g,function(){return Ne[or++]});throw new Error(mi)}catch(Su){}}}var en={};function ln(X,_e){{var Ne=X.constructor,Me=Ne&&(Ne.displayName||Ne.name)||"ReactClass",dt=Me+"."+_e;if(en[dt])return;ct("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",_e,Me),en[dt]=!0}}var An={isMounted:function(X){return!1},enqueueForceUpdate:function(X,_e,Ne){ln(X,"forceUpdate")},enqueueReplaceState:function(X,_e,Ne,Me){ln(X,"replaceState")},enqueueSetState:function(X,_e,Ne,Me){ln(X,"setState")}},nr={};Object.freeze(nr);function un(X,_e,Ne){this.props=X,this.context=_e,this.refs=nr,this.updater=Ne||An}un.prototype.isReactComponent={},un.prototype.setState=function(X,_e){if(!(typeof X=="object"||typeof X=="function"||X==null))throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,X,_e,"setState")},un.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};{var Wt={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},vr=function(X,_e){Object.defineProperty(un.prototype,X,{get:function(){je("%s(...) is deprecated in plain JavaScript React classes. %s",_e[0],_e[1])}})};for(var w in Wt)Wt.hasOwnProperty(w)&&vr(w,Wt[w])}function Ut(){}Ut.prototype=un.prototype;function Vn(X,_e,Ne){this.props=X,this.context=_e,this.refs=nr,this.updater=Ne||An}var fr=Vn.prototype=new Ut;fr.constructor=Vn,i(fr,un.prototype),fr.isPureReactComponent=!0;function Fr(){var X={current:null};return Object.seal(X),X}var ur=Object.prototype.hasOwnProperty,br={key:!0,ref:!0,__self:!0,__source:!0},Kt,vu,a0;a0={};function So(X){if(ur.call(X,"ref")){var _e=Object.getOwnPropertyDescriptor(X,"ref").get;if(_e&&_e.isReactWarning)return!1}return X.ref!==void 0}function Go(X){if(ur.call(X,"key")){var _e=Object.getOwnPropertyDescriptor(X,"key").get;if(_e&&_e.isReactWarning)return!1}return X.key!==void 0}function Os(X,_e){var Ne=function(){Kt||(Kt=!0,ct("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",_e))};Ne.isReactWarning=!0,Object.defineProperty(X,"key",{get:Ne,configurable:!0})}function Yo(X,_e){var Ne=function(){vu||(vu=!0,ct("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",_e))};Ne.isReactWarning=!0,Object.defineProperty(X,"ref",{get:Ne,configurable:!0})}function Ko(X){if(typeof X.ref=="string"&&wt.current&&X.__self&&wt.current.stateNode!==X.__self){var _e=$t(wt.current.type);a0[_e]||(ct('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref',$t(wt.current.type),X.ref),a0[_e]=!0)}}var qt=function(X,_e,Ne,Me,dt,Hn,Dn){var or={$$typeof:E,type:X,key:_e,ref:Ne,props:Dn,_owner:Hn};return or._store={},Object.defineProperty(or._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(or,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Me}),Object.defineProperty(or,"_source",{configurable:!1,enumerable:!1,writable:!1,value:dt}),Object.freeze&&(Object.freeze(or.props),Object.freeze(or)),or};function _i(X,_e,Ne){var Me,dt={},Hn=null,Dn=null,or=null,mi=null;if(_e!=null){So(_e)&&(Dn=_e.ref,Ko(_e)),Go(_e)&&(Hn=""+_e.key),or=_e.__self===void 0?null:_e.__self,mi=_e.__source===void 0?null:_e.__source;for(Me in _e)ur.call(_e,Me)&&!br.hasOwnProperty(Me)&&(dt[Me]=_e[Me])}var Su=arguments.length-2;if(Su===1)dt.children=Ne;else if(Su>1){for(var bu=Array(Su),Pu=0;Pu<Su;Pu++)bu[Pu]=arguments[Pu+2];Object.freeze&&Object.freeze(bu),dt.children=bu}if(X&&X.defaultProps){var mu=X.defaultProps;for(Me in mu)dt[Me]===void 0&&(dt[Me]=mu[Me])}if(Hn||Dn){var yi=typeof X=="function"?X.displayName||X.name||"Unknown":X;Hn&&Os(dt,yi),Dn&&Yo(dt,yi)}return qt(X,Hn,Dn,or,mi,wt.current,dt)}function eu
Line truncated
|
||||
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
||||
2. You might be breaking the Rules of Hooks
|
||||
3. You might have more than one copy of React in the same app
|
||||
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.`);return X}function Wl(X,_e){var Ne=Ui();if(_e!==void 0&&ct("useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",_e,typeof _e=="number"&&Array.isArray(arguments[2])?`
|
||||
|
||||
Did you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks`:""),X._context!==void 0){var Me=X._context;Me.Consumer===X?ct("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):Me.Provider===X&&ct("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return Ne.useContext(X,_e)}function xo(X){var _e=Ui();return _e.useState(X)}function ni(X,_e,Ne){var Me=Ui();return Me.useReducer(X,_e,Ne)}function oo(X){var _e=Ui();return _e.useRef(X)}function Vl(X,_e){var Ne=Ui();return Ne.useEffect(X,_e)}function Ao(X,_e){var Ne=Ui();return Ne.useLayoutEffect(X,_e)}function Ms(X,_e){var Ne=Ui();return Ne.useCallback(X,_e)}function Xn(X,_e){var Ne=Ui();return Ne.useMemo(X,_e)}function Qo(X,_e,Ne){var Me=Ui();return Me.useImperativeHandle(X,_e,Ne)}function lo(X,_e){{var Ne=Ui();return Ne.useDebugValue(X,_e)}}var b0;b0=!1;function yl(){if(wt.current){var X=$t(wt.current.type);if(X)return`
|
||||
|
||||
Check the render method of \``+X+"`."}return""}function Ro(X){if(X!==void 0){var _e=X.fileName.replace(/^.*[\\\/]/,""),Ne=X.lineNumber;return`
|
||||
|
||||
Check your code at `+_e+":"+Ne+"."}return""}function Et(X){return X!=null?Ro(X.__source):""}var Pt={};function Bn(X){var _e=yl();if(!_e){var Ne=typeof X=="string"?X:X.displayName||X.name;Ne&&(_e=`
|
||||
|
||||
Check the top-level render call using <`+Ne+">.")}return _e}function Ir(X,_e){if(!(!X._store||X._store.validated||X.key!=null)){X._store.validated=!0;var Ne=Bn(_e);if(!Pt[Ne]){Pt[Ne]=!0;var Me="";X&&X._owner&&X._owner!==wt.current&&(Me=" It was passed a child from "+$t(X._owner.type)+"."),ae(X),ct('Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',Ne,Me),ae(null)}}}function ji(X,_e){if(typeof X=="object"){if(Array.isArray(X))for(var Ne=0;Ne<X.length;Ne++){var Me=X[Ne];mr(Me)&&Ir(Me,_e)}else if(mr(X))X._store&&(X._store.validated=!0);else if(X){var dt=Ue(X);if(typeof dt=="function"&&dt!==X.entries)for(var Hn=dt.call(X),Dn;!(Dn=Hn.next()).done;)mr(Dn.value)&&Ir(Dn.value,_e)}}}function Wr(X){{var _e=X.type;if(_e==null||typeof _e=="string")return;var Ne=$t(_e),Me;if(typeof _e=="function")Me=_e.propTypes;else if(typeof _e=="object"&&(_e.$$typeof===W||_e.$$typeof===we))Me=_e.propTypes;else return;Me?(ae(X),o(Me,X.props,"prop",Ne,at.getStackAddendum),ae(null)):_e.PropTypes!==void 0&&!b0&&(b0=!0,ct("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")),typeof _e.getDefaultProps=="function"&&!_e.getDefaultProps.isReactClassApproved&&ct("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wu(X){{ae(X);for(var _e=Object.keys(X.props),Ne=0;Ne<_e.length;Ne++){var Me=_e[Ne];if(Me!=="children"&&Me!=="key"){ct("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Me);break}}X.ref!==null&&ct("Invalid attribute `ref` supplied to `React.Fragment`."),ae(null)}}function c0(X,_e,Ne){var Me=Yi(X);if(!Me){var dt="";(X===void 0||typeof X=="object"&&X!==null&&Object.keys(X).length===0)&&(dt+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Hn=Et(_e);Hn?dt+=Hn:dt+=yl();var Dn;X===null?Dn="null":Array.isArray(X)?Dn="array":X!==void 0&&X.$$typeof===E?(Dn="<"+($t(X.type)||"Unknown")+" />",dt=" Did you accidentally export a JSX literal instead of a component?"):Dn=typeof X,ct("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Dn,dt)}var or=_i.apply(this,arguments);if(or==null)return or;if(Me)for(var mi=2;mi<arguments.length;mi++)ji(arguments[mi],X);return X===k?wu(or):Wr(or),or}var Ti=!1;function d0(X){var _e=c0.bind(null,X);return _e.type=X,Ti||(Ti=!0,je("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(_e,"type",{enumerable:!1,get:function(){return je("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:X}),X}}),_e}function as(X,_e,Ne){for(var Me=ai.apply(this,arguments),dt=2;dt<arguments.length;dt++)ji(arguments[dt],Me.type);return Wr(Me),Me}try{var St=Object.freeze({}),so=new Map([[St,null]]),Jo=new Set([St]);so.set(0,0),Jo.add(0)}catch(X){}var Gl=c0,Fu=as,fs=d0,P0={map:fi,forEach:Pr,count:Zt,toArray:Ln,only:Di};pu.Children=P0,pu.Component=un,pu.Fragment=k,pu.Profiler=N,pu.PureComponent=Vn,pu.StrictMode=L,pu.Suspense=ne,pu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ue,pu.cloneElement=Fu,pu.createContext=ci,pu.createElement=Gl,pu.createFactory=fs,pu.createRef=Fr,pu.forwardRef=Du,pu.isValidElement=mr,pu.lazy=Ht,pu.memo=Y0,pu.useCallback=Ms,pu.useContext=Wl,pu.useDebugValue=lo,pu.useEffect=Vl,pu.useImperativeHandle=Qo,pu.useLayoutEffect=Ao,pu.useMemo=Xn,pu.useReducer=ni,pu.useRef=oo,pu.useState=xo,pu.version=f}()});var su=ce((Ene,WD)=>{"use strict";process.env.NODE_ENV==="production"?WD.exports=k5():WD.exports=I5()});var B5=ce((nm,rg)=>{(function(){var i,o="4.17.21",f=200,p="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",E="Expected a function",t="Invalid `variable` option passed into `_.template`",k="__lodash_hash_undefined__",L=500,N="__lodash_placeholder__",C=1,U=2,q=4,W=1,ne=2,m=1,we=2,Se=4,he=8,ge=16,ze=32,pe=64,Oe=128,le=256,Ue=512,Ge=30,rt="...",wt=800,xt=16,$e=1,ft=2,Ke=3,jt=1/0,$t=9007199254740991,at=17976931348623157e292,Q=0/0,ae=4294967295,Ce=ae-1,ue=ae>>>1,je=[["ary",Oe],["bind",m],["bindKey",we],["curry",he],["curryRight",ge],["flip",Ue],["partial",ze],["partialRight",pe],["rearg",le]],ct="[object Arguments]",At="[object Array]",en="[object AsyncFunction]",ln="[object Boolean]",An="[object Date]",nr="[object DOMException]",un="[object Error]",Wt="[object Function]",vr="[object GeneratorFunction]",w="[object Map]",Ut="[object Number]",Vn="[object Null]",fr="[object Object]",Fr="[object Promise]",ur="[object Proxy]",br="[object RegExp]",Kt="[object Set]",vu="[object String]",a0="[object Symbol]",So="[object Undefined]",Go="[object WeakMap]",Os="[object We
Line truncated
|
||||
/* [wrapped with `+v+`] */
|
||||
`)}function $l(d){return Jn(d)||sl(d)||!!(co&&d&&d[co])}function go(d,v){var x=typeof d;return v=v==null?$t:v,!!v&&(x=="number"||x!="symbol"&&Ms.test(d))&&d>-1&&d%1==0&&d<v}function io(d,v,x){if(!ku(x))return!1;var b=typeof v;return(b=="number"?al(x)&&go(v,x.length):b=="string"&&v in x)?Eo(x[v],d):!1}function Hi(d,v){if(Jn(d))return!1;var x=typeof d;return x=="number"||x=="symbol"||x=="boolean"||d==null||Nl(d)?!0:Ei.test(d)||!Pr.test(d)||v!=null&&d in wn(v)}function zr(d){var v=typeof d;return v=="string"||v=="number"||v=="symbol"||v=="boolean"?d!=="__proto__":d===null}function Cf(d){var v=Bo(d),x=Y[v];if(typeof x!="function"||!(v in lt.prototype))return!1;if(d===x)return!0;var b=Un(x);return!!b&&d===b[0]}function _m(d){return!!Ps&&Ps in d}var Al=C0?Ea:Ip;function xf(d){var v=d&&d.constructor,x=typeof v=="function"&&v.prototype||Sn;return d===x}function Af(d){return d===d&&!ku(d)}function v2(d,v){return function(x){return x==null?!1:x[d]===v&&(v!==i||d in wn(x))}}function m2(d){var v=T2(d,function(b){return x.size===L&&x.clear(),b}),x=v.cache;return v}function mc(d,v){var x=d[1],b=v[1],H=x|b,ee=H<(m|we|Oe),de=b==Oe&&x==he||b==Oe&&x==le&&d[7].length<=v[8]||b==(Oe|le)&&v[7].length<=v[8]&&x==he;if(!(ee||de))return d;b&m&&(d[2]=v[2],H|=x&m?0:Se);var ye=v[3];if(ye){var be=d[3];d[3]=be?js(be,ye,v[4]):ye,d[4]=be?T0(d[3],N):v[4]}return ye=v[5],ye&&(be=d[5],d[5]=be?fa(be,ye,v[6]):ye,d[6]=be?T0(d[5],N):v[6]),ye=v[7],ye&&(d[7]=ye),b&Oe&&(d[8]=d[8]==null?v[8]:Wn(d[8],v[8])),d[9]==null&&(d[9]=v[9]),d[0]=v[0],d[1]=H,d}function e1(d){var v=[];if(d!=null)for(var x in wn(d))v.push(x);return v}function Ha(d){return Uu.call(d)}function Nd(d,v,x){return v=Xr(v===i?d.length-1:v,0),function(){for(var b=arguments,H=-1,ee=Xr(b.length-v,0),de=Ve(ee);++H<ee;)de[H]=b[v+H];H=-1;for(var ye=Ve(v+1);++H<v;)ye[H]=b[H];return ye[v]=x(de),ie(d,this,ye)}}function y2(d,v){return v.length<2?d:J(d,rl(v,0,-1))}function t1(d,v){for(var x=d.length,b=Wn(v.length,x),H=Ji(d);b--;){var ee=v[b];d[b]=go(ee,x)?H[ee]:i}return d}function Rf(d,v){if(!(v==="constructor"&&typeof d[v]=="function")&&v!="__proto__")return d[v]}var n1=g2(Wc),Wa=df||function(d,v){return Ni.setTimeout(d,v)},r1=g2(Sd);function Ld(d,v,x){var b=v+"";return r1(d,an(b,wh(Tf(b),x)))}function g2(d){var v=0,x=0;return function(){var b=Xu(),H=xt-(b-x);if(x=b,H>0){if(++v>=wt)return arguments[0]}else v=0;return d.apply(i,arguments)}}function yc(d,v){var x=-1,b=d.length,H=b-1;for(v=v===i?b:v;++x<v;){var ee=o2(x,H),de=d[ee];d[ee]=d[x],d[x]=de}return d.length=v,d}var i1=m2(function(d){var v=[];return d.charCodeAt(0)===46&&v.push(""),d.replace(G0,function(x,b,H,ee){v.push(H?ee.replace(Ui,"$1"):b||x)}),v});function Rl(d){if(typeof d=="string"||Nl(d))return d;var v=d+"";return v=="0"&&1/d==-jt?"-0":v}function pa(d){if(d!=null){try{return Au.call(d)}catch(v){}try{return d+""}catch(v){}}return""}function wh(d,v){return tt(je,function(x){var b="_."+x[0];v&x[1]&&!on(d,b)&&d.push(b)}),d.sort()}function Fd(d){if(d instanceof lt)return d.clone();var v=new Ur(d.__wrapped__,d.__chain__);return v.__actions__=Ji(d.__actions__),v.__index__=d.__index__,v.__values__=d.__values__,v}function bd(d,v,x){(x?io(d,v,x):v===i)?v=1:v=Xr(Cr(v),0);var b=d==null?0:d.length;if(!b||v<1)return[];for(var H=0,ee=0,de=Ve(Ku(b/v));H<b;)de[ee++]=rl(d,H,H+=v);return de}function Sh(d){for(var v=-1,x=d==null?0:d.length,b=0,H=[];++v<x;){var ee=d[v];ee&&(H[b++]=ee)}return H}function _2(){var d=arguments.length;if(!d)return[];for(var v=Ve(d-1),x=arguments[0],b=d;b--;)v[b-1]=arguments[b];return gn(Jn(x)?Ji(x):[x],bi(v,1))}var Th=Mr(function(d,v){return n0(d)?Sl(d,bi(v,1,n0,!0)):[]}),Ol=Mr(function(d,v){var x=kl(v);return n0(x)&&(x=i),n0(d)?Sl(d,bi(v,1,n0,!0),zn(x,2)):[]}),es=Mr(function(d,v){var x=kl(v);return n0(x)&&(x=i),n0(d)?Sl(d,bi(v,1,n0,!0),i,x):[]});function Ds(d,v,x){var b=d==null?0:d.length;return b?(v=x||v===i?1:Cr(v),rl(d,v<0?0:v,b)):[]}function zs(d,v,x){var b=d==null?0:d.length;return b?(v=x||v===i?1:Cr(v),v=b-v,rl(d,0,v<0?0:v)):[]}function Pd(d,v){return d&&d.length?ac(d,zn(v,3),!0,!0):[]}function Ch(d,v){return d&&d.length?ac(d,zn(v,3),!0):[]}function Id(d,v,x,b){var H=d==null?0:d.length;return H?(x&&typeof x!="number"&&io(d,v,x)&&(x=0,b=H),sc(d,v,x,b)):[]}function Bd(d,v,x){var b=d==null?0:d.length;if(!b)return-1;var H=x==null?0:Cr(x);return H<0&&(H=Xr(b+H,0)),nt(d,zn(v,3),H)}function u1(d,v,x){var b=d==null?0:d.length;if(!b)return-1;var H=b-1;return x!==i&&(H=Cr(x),H=x<0?Xr(b+H,0):Wn(H,b-1)),nt(d,zn(v,3),H,!0)}function o1(d){var v=d==null?0:d.length;return v?bi(d,1):[]}function xh(d){var v=d==null?0:d.length;return v?bi(d,jt):[]}function Ud(d,v){var x=d==null?0:d.length;return x?(v=v===i?1:Cr(v),bi(d,v)):[]}function jd(d){for(var v=-1,x=d==null?0:d.length,b={};++v<x;){var H=d[v];b[H[0]]=H[1]}return b}function ws(d){return d&&d.length?d[0]:i}function Va(d,v,x){var b=d==null?0:d.length;if(!b)return-1;var H=x==null?0:Cr(x);return H<0&&(H=Xr(b+H,0)),_t(d,v,H)}function Ah(d){var v=d==null?0:d.length;return v?rl(d,0,-1):[]}va
Line truncated
|
||||
`;d.replace(rn,function(ir,Zr,ui,bl,Wi,uo){return ui||(ui=bl),Rt+=d.slice(gt,uo).replace(lo,bs),Zr&&(ye=!0,Rt+=`' +
|
||||
__e(`+Zr+`) +
|
||||
'`),Wi&&(be=!0,Rt+=`';
|
||||
`+Wi+`;
|
||||
__p += '`),ui&&(Rt+=`' +
|
||||
((__t = (`+ui+`)) == null ? '' : __t) +
|
||||
'`),gt=uo+ir.length,ir}),Rt+=`';
|
||||
`;var $n=ei.call(v,"variable")&&v.variable;if(!$n)Rt=`with (obj) {
|
||||
`+Rt+`
|
||||
}
|
||||
`;else if(Y0.test($n))throw new Yt(t);Rt=(be?Rt.replace(Hr,""):Rt).replace(To,"$1").replace(Co,"$1;"),Rt="function("+($n||"obj")+`) {
|
||||
`+($n?"":`obj || (obj = {});
|
||||
`)+"var __t, __p = ''"+(ye?", __e = _.escape":"")+(be?`, __j = Array.prototype.join;
|
||||
function print() { __p += __j.call(arguments, '') }
|
||||
`:`;
|
||||
`)+Rt+`return __p
|
||||
}`;var Nr=_v(function(){return sr(ee,Rn+"return "+Rt).apply(i,de)});if(Nr.source=Rt,mp(Nr))throw Nr;return Nr}function hv(d){return ki(d).toLowerCase()}function W2(d){return ki(d).toUpperCase()}function V2(d,v,x){if(d=ki(d),d&&(x||v===i))return xu(d);if(!d||!(v=il(v)))return d;var b=Yr(d),H=Yr(v),ee=sf(b,H),de=gl(b,H)+1;return aa(b,ee,de).join("")}function Ap(d,v,x){if(d=ki(d),d&&(x||v===i))return d.slice(0,fo(d)+1);if(!d||!(v=il(v)))return d;var b=Yr(d),H=gl(b,Yr(v))+1;return aa(b,0,H).join("")}function vv(d,v,x){if(d=ki(d),d&&(x||v===i))return d.replace(Ln,"");if(!d||!(v=il(v)))return d;var b=Yr(d),H=sf(b,Yr(v));return aa(b,H).join("")}function G2(d,v){var x=Ge,b=rt;if(ku(v)){var H="separator"in v?v.separator:H;x="length"in v?Cr(v.length):x,b="omission"in v?il(v.omission):b}d=ki(d);var ee=d.length;if(Lo(d)){var de=Yr(d);ee=de.length}if(x>=ee)return d;var ye=x-Ki(b);if(ye<1)return b;var be=de?aa(de,0,ye).join(""):d.slice(0,ye);if(H===i)return be+b;if(de&&(ye+=be.length-ye),g1(H)){if(d.slice(ye).search(H)){var gt,Dt=be;for(H.global||(H=fu(H.source,ki(xo.exec(H))+"g")),H.lastIndex=0;gt=H.exec(Dt);)var Rt=gt.index;be=be.slice(0,Rt===i?ye:Rt)}}else if(d.indexOf(il(H),ye)!=ye){var rn=be.lastIndexOf(H);rn>-1&&(be=be.slice(0,rn))}return be+b}function mv(d){return d=ki(d),d&&Si.test(d)?d.replace(L0,Oi):d}var yv=_f(function(d,v,x){return d+(x?" ":"")+v.toUpperCase()}),Rp=_h("toUpperCase");function gv(d,v,x){return d=ki(d),v=x?i:v,v===i?ps(d)?cf(d):v0(d):d.match(v)||[]}var _v=Mr(function(d,v){try{return ie(d,i,v)}catch(x){return mp(x)?x:new Yt(x)}}),uy=ol(function(d,v){return tt(v,function(x){x=Rl(x),ju(d,x,y1(d[x],d))}),d});function Ev(d){var v=d==null?0:d.length,x=zn();return d=v?Lt(d,function(b){if(typeof b[1]!="function")throw new Kr(E);return[x(b[0]),b[1]]}):[],Mr(function(b){for(var H=-1;++H<v;){var ee=d[H];if(ie(ee[0],this,b))return ie(ee[1],this,b)}})}function oy(d){return vf(U0(d,C))}function Y2(d){return function(){return d}}function Dv(d,v){return d==null||d!==d?v:d}var Op=Jc(),ly=Jc(!0);function r0(d){return d}function kp(d){return gu(typeof d=="function"?d:U0(d,C))}function sy(d){return Dd(U0(d,C))}function ay(d,v){return mf(d,U0(v,C))}var Mp=Mr(function(d,v){return function(x){return Tl(x,d,v)}}),Xa=Mr(function(d,v){return function(x){return Tl(d,x,v)}});function Np(d,v,x){var b=M0(v),H=I(v,b);x==null&&!(ku(v)&&(H.length||!b.length))&&(x=v,v=d,d=this,H=I(v,M0(v)));var ee=!(ku(x)&&"chain"in x)||!!x.chain,de=Ea(d);return tt(H,function(ye){var be=v[ye];d[ye]=be,de&&(d.prototype[ye]=function(){var gt=this.__chain__;if(ee||gt){var Dt=d(this.__wrapped__),Rt=Dt.__actions__=Ji(this.__actions__);return Rt.push({func:be,args:arguments,thisArg:d}),Dt.__chain__=gt,Dt}return be.apply(d,gn([this.value()],arguments))})}),d}function Lp(){return Ni._===this&&(Ni._=zi),this}function Fp(){}function fy(d){return d=Cr(d),Mr(function(v){return qc(v,d)})}var cy=Or(Lt),wv=Or(kt),Pf=Or(_r);function bp(d){return Hi(d)?sn(Rl(d)):mo(d)}function Sv(d){return function(v){return d==null?i:J(d,v)}}var dy=Zc(),py=Zc(!0);function Pp(){return[]}function Ip(){return!1}function hy(){return{}}function vy(){return""}function Tv(){return!0}function Bp(d,v){if(d=Cr(d),d<1||d>$t)return[];var x=ae,b=Wn(d,ae);v=zn(v),d-=ae;for(var H=S0(b,v);++x<d;)v(x);return H}function Up(d){return Jn(d)?Lt(d,Rl):Nl(d)?[d]:Ji(i1(ki(d)))}function K2(d){var v=++_l;return ki(d)+v}var my=d2(function(d,v){return d+v},0),R1=Md("ceil"),yy=d2(function(d,v){return d/v},1),Cv=Md("floor");function xv(d){return d&&d.length?la(d,r0,Ct):i}function gy(d,v){return d&&d.length?la(d,zn(v,2),Ct):i}function If(d){return nn(d,r0)}function jp(d,v){return nn(d,zn(v,2))}function Av(d){return d&&d.length?la(d,r0,r2):i}function _y(d,v){return d&&d.length?la(d,zn(v,2),r2):i}var Ey=d2(function(d,v){return d*v},1),zp=Md("round"),Dy=d2(function(d,v){return d-v},0);function Ys(d){return d&&d.length?Cu(d,r0):0}function wy(d,v){return d&&d.length?Cu(d,zn(v,2)):0}return Y.after=op,Y.ary=Yh,Y.assign=Dp,Y.assignIn=F2,Y.assignInWith=Do,Y.assignWith=Ss,Y.at=Mf,Y.before=S2,Y.bind=y1,Y.bindAll=uy,Y.bindKey=Kh,Y.castArray=$h,Y.chain=Bh,Y.chunk=bd,Y.compact=Sh,Y.concat=_2,Y.cond=Ev,Y.conforms=oy,Y.constant=Y2,Y.countBy=D2,Y.create=b2,Y.curry=lp,Y.curryRight=Xh,Y.debounce=sp,Y.defaults=wp,Y.defaultsDeep=D1,Y.defer=Qh,Y.delay=Jh,Y.difference=Th,Y.differenceBy=Ol,Y.differenceWith=es,Y.drop=Ds,Y.dropRight=zs,Y.dropRightWhile=Pd,Y.dropWhile=Ch,Y.fill=Id,Y.filter=Zd,Y.flatMap=qh,Y.flatMapDeep=ep,Y.flatMapDepth=Hh,Y.flatten=o1,Y.flattenDeep=xh,Y.flattenDepth=Ud,Y.flip=ap,Y.flow=Op,Y.flowRight=ly,Y.fromPairs=jd,Y.functions=k0,Y.functionsIn=P2,Y.groupBy=Rm,Y.initial=Ah,Y.intersection=uu,Y.intersectionBy=l1,Y.intersectionWith=Rh,Y.invert=wc,Y.invertBy=I2,Y.invokeMap=km,Y.iteratee=kp,Y.keyBy=Vh,Y.keys=M0,Y.keysIn=fn,Y.map=v1,Y.mapKeys=B2,Y.mapValues=U2,Y.matches=sy,Y.matchesProperty=ay,Y.memoize=T2,Y.merge=Sc,Y.mergeWith=Tc,Y.method=Mp,Y.methodOf=Xa,Y.mixin=Np,Y.negate=C2,Y.nthArg=fy,Y.omit=Cc,Y.omitBy=T1,Y.once
Line truncated
|
||||
`;L!==p&&(p=L,i.write(Q5.default.eraseLines(f)+L),f=L.split(`
|
||||
`).length)};return t.clear=()=>{i.write(Q5.default.eraseLines(f)),p="",f=0},t.done=()=>{p="",f=0,o||(J5.default.show(),E=!1)},t};sg.default={create:YK}});var e9=ce((One,$5)=>{$5.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var r9=ce(Ra=>{"use strict";var t9=e9(),bc=process.env;Object.defineProperty(Ra,"_vendors",{value:t9.map(function(i){return i.constant})});Ra.name=null;Ra.isPR=null;t9.forEach(function(i){var o=Array.isArray(i.env)?i.env:[i.env],f=o.every(function(p){return n9(p)});if(Ra[i.constant]=f,f)switch(Ra.name=i.name,typeof i.pr){case"string":Ra.isPR=!!bc[i.pr];break;case"object":"env"in i.pr?Ra.isPR=i.pr.env in bc&&bc[i.pr.env]!==i.pr.ne:"any"in i.pr?Ra.isPR=i.pr.any.some(function(p){return!!bc[p]}):Ra.isPR=n9(i.pr);break;default:Ra.isPR=null}});Ra.isCI=!!(bc.CI||bc.CONTINUOUS_INTEGRATION||bc.BUILD_NUMBER||bc.RUN_ID||Ra.name);function n9(i){return typeof i=="string"?!!bc[i]:Object.keys(i).every(function(o){return bc[o]===i[o]})}});var u9=ce((Mne,i9)=>{"use strict";i9.exports=r9().isCI});var l9=ce((Nne,o9)=>{"use strict";var KK=i=>{let o=new Set;do for(let f of Reflect.ownKeys(i))o.add([i,f]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return o};o9.exports=(i,{include:o,exclude:f}={})=>{let p=E=>{let t=k=>typeof k=="string"?E===k:k.test(E);return o?o.some(t):f?!f.some(t):!0};for(let[E,t]of KK(i.constructor.prototype)){if(t==="constructor"||!p(t))continue;let k=Reflect.getOwnPropertyDescriptor(E,t);k&&typeof k.value=="function"&&(i[t]=i[t].bind(i))}return i}});var h9=ce($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});var om,ag,u4,o4,$D;typeof window=="undefined"||typeof MessageChannel!="function"?(lm=null,ew=null,tw=function(){if(lm!==null)try{var i=$i.unstable_now();lm(!0,i),lm=null}catch(o){throw setTimeout(tw,0),o}},s9=Date.now(),$i.unstable_now=function(){return Date.now()-s9},om=function(i){lm!==null?setTimeout(om,0,i):(lm=i,setTimeout(tw,0))},ag=function(i,o){ew=setTimeout(i,o)},u4=function(){clearTimeout(ew)},o4=function(){return!1},$D=$i.unstable_forceFrameRate=function(){}):(l4=window.performance,nw=window.Date,a9=window.setTimeout,f9=window.clearTimeout,typeof console!="undefined"&&(c9=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof c9!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),typeof l4=="object"&&typeof l4.now=="function"?$i.unstable_now=function(){return l4.now()}:(d9=nw.now(),$i.unstable_now=function(){return nw.now()-d9}),fg=!1,cg=null,s4=-1,rw=5,iw=0,o4=function(){return $i.unstable_now()>=iw},$D=function(){},$i.unstable_forceFrameRate=function(i){0>i||125<i?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not un
Line truncated
|
||||
in `+(F||"Unknown")+J}y+=A,g=g.return}while(g);return y}new Set;var Ei=[],G0=-1;function fi(g){0>G0||(g.current=Ei[G0],Ei[G0]=null,G0--)}function Zt(g,y){G0++,Ei[G0]=g.current,g.current=y}var Ln={},Di={current:Ln},ci={current:!1},Ht=Ln;function Du(g,y){var A=g.type.contextTypes;if(!A)return Ln;var F=g.stateNode;if(F&&F.__reactInternalMemoizedUnmaskedChildContext===y)return F.__reactInternalMemoizedMaskedChildContext;var I={},J;for(J in A)I[J]=y[J];return F&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=y,g.__reactInternalMemoizedMaskedChildContext=I),I}function Yi(g){return g=g.childContextTypes,g!=null}function Y0(g){fi(ci,g),fi(Di,g)}function Ui(g){fi(ci,g),fi(Di,g)}function Wl(g,y,A){if(Di.current!==Ln)throw Error(t(168));Zt(Di,y,g),Zt(ci,A,g)}function xo(g,y,A){var F=g.stateNode;if(g=y.childContextTypes,typeof F.getChildContext!="function")return A;F=F.getChildContext();for(var I in F)if(!(I in g))throw Error(t(108,Ge(y)||"Unknown",I));return f({},A,{},F)}function ni(g){var y=g.stateNode;return y=y&&y.__reactInternalMemoizedMergedChildContext||Ln,Ht=Di.current,Zt(Di,y,g),Zt(ci,ci.current,g),!0}function oo(g,y,A){var F=g.stateNode;if(!F)throw Error(t(169));A?(y=xo(g,y,Ht),F.__reactInternalMemoizedMergedChildContext=y,fi(ci,g),fi(Di,g),Zt(Di,y,g)):fi(ci,g),Zt(ci,A,g)}var Vl=E.unstable_runWithPriority,Ao=E.unstable_scheduleCallback,Ms=E.unstable_cancelCallback,Xn=E.unstable_shouldYield,Qo=E.unstable_requestPaint,lo=E.unstable_now,b0=E.unstable_getCurrentPriorityLevel,yl=E.unstable_ImmediatePriority,Ro=E.unstable_UserBlockingPriority,Et=E.unstable_NormalPriority,Pt=E.unstable_LowPriority,Bn=E.unstable_IdlePriority,Ir={},ji=Qo!==void 0?Qo:function(){},Wr=null,wu=null,c0=!1,Ti=lo(),d0=1e4>Ti?lo:function(){return lo()-Ti};function as(){switch(b0()){case yl:return 99;case Ro:return 98;case Et:return 97;case Pt:return 96;case Bn:return 95;default:throw Error(t(332))}}function St(g){switch(g){case 99:return yl;case 98:return Ro;case 97:return Et;case 96:return Pt;case 95:return Bn;default:throw Error(t(332))}}function so(g,y){return g=St(g),Vl(g,y)}function Jo(g,y,A){return g=St(g),Ao(g,y,A)}function Gl(g){return Wr===null?(Wr=[g],wu=Ao(yl,fs)):Wr.push(g),Ir}function Fu(){if(wu!==null){var g=wu;wu=null,Ms(g)}fs()}function fs(){if(!c0&&Wr!==null){c0=!0;var g=0;try{var y=Wr;so(99,function(){for(;g<y.length;g++){var A=y[g];do A=A(!0);while(A!==null)}}),Wr=null}catch(A){throw Wr!==null&&(Wr=Wr.slice(g+1)),Ao(yl,Fu),A}finally{c0=!1}}}var P0=3;function X(g,y,A){return A/=10,1073741821-(((1073741821-g+y/10)/A|0)+1)*A}function _e(g,y){return g===y&&(g!==0||1/g==1/y)||g!==g&&y!==y}var Ne=typeof Object.is=="function"?Object.is:_e,Me=Object.prototype.hasOwnProperty;function dt(g,y){if(Ne(g,y))return!0;if(typeof g!="object"||g===null||typeof y!="object"||y===null)return!1;var A=Object.keys(g),F=Object.keys(y);if(A.length!==F.length)return!1;for(F=0;F<A.length;F++)if(!Me.call(y,A[F])||!Ne(g[A[F]],y[A[F]]))return!1;return!0}function Hn(g,y){if(g&&g.defaultProps){y=f({},y),g=g.defaultProps;for(var A in g)y[A]===void 0&&(y[A]=g[A])}return y}var Dn={current:null},or=null,mi=null,Su=null;function bu(){Su=mi=or=null}function Pu(g,y){var A=g.type._context;un?(Zt(Dn,A._currentValue,g),A._currentValue=y):(Zt(Dn,A._currentValue2,g),A._currentValue2=y)}function mu(g){var y=Dn.current;fi(Dn,g),g=g.type._context,un?g._currentValue=y:g._currentValue2=y}function yi(g,y){for(;g!==null;){var A=g.alternate;if(g.childExpirationTime<y)g.childExpirationTime=y,A!==null&&A.childExpirationTime<y&&(A.childExpirationTime=y);else if(A!==null&&A.childExpirationTime<y)A.childExpirationTime=y;else break;g=g.return}}function Oo(g,y){or=g,Su=mi=null,g=g.dependencies,g!==null&&g.firstContext!==null&&(g.expirationTime>=y&&(fo=!0),g.firstContext=null)}function Tu(g,y){if(Su!==g&&y!==!1&&y!==0)if((typeof y!="number"||y===1073741823)&&(Su=g,y=1073741823),y={context:g,observedBits:y,next:null},mi===null){if(or===null)throw Error(t(308));mi=y,or.dependencies={expirationTime:0,firstContext:y,responders:null}}else mi=mi.next=y;return un?g._currentValue:g._currentValue2}var ao=!1;function Iu(g){return{baseState:g,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Oa(g){return{baseState:g.baseState,firstUpdate:g.firstUpdate,lastUpdate:g.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function p0(g,y){return{expirationTime:g,suspenseConfig:y,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Zs(g,y){g.lastUpdate===null?g.firstUpdate=g.lastUpdate=y:(g.lastUpdate.next=y,g.lastUpdate=y)}function K0(g,y){var A=g.alternate;if(A===null){var F=g.updateQueue,I=null;F===null&&(F=g.updateQueue=Iu(g.memoizedState))}else F=g.updateQueue,I=A.updateQueue,F===null?I===null?(F=g.updateQueue=Iu(g.memoizedState),I=A.updateQueue=Iu(A.me
Line truncated
|
||||
|
||||
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+Pr(I))}Ae!==y0&&(Ae=Wn),J=_l(J,I),Ct=F;do{switch(Ct.tag){case 3:fe=J,Ct.effectTag|=4096,Ct.expirationTime=y;var Be=hs(Ct,fe,y);$s(Ct,Be);break e;case 1:fe=J;var ut=Ct.type,Jt=Ct.stateNode;if((Ct.effectTag&64)==0&&(typeof ut.getDerivedStateFromError=="function"||Jt!==null&&typeof Jt.componentDidCatch=="function"&&(cr===null||!cr.has(Jt)))){Ct.effectTag|=4096,Ct.expirationTime=y;var jn=ra(Ct,fe,y);$s(Ct,jn);break e}}Ct=Ct.return}while(Ct!==null)}re=ho(re)}catch(ti){y=ti;continue}break}while(1)}function B0(){var g=Ku.current;return Ku.current=No,g===null?No:g}function oc(g,y){g<vt&&2<g&&(vt=g),y!==null&&g<Xt&&2<g&&(Xt=g,xn=y)}function La(g){g>_n&&(_n=g)}function gd(){for(;re!==null;)re=e2(re)}function $1(){for(;re!==null&&!Xn();)re=e2(re)}function e2(g){var y=Pa(g.alternate,g,Le);return g.memoizedProps=g.pendingProps,y===null&&(y=ho(g)),vs.current=null,y}function ho(g){re=g;do{var y=re.alternate;if(g=re.return,(re.effectTag&2048)==0){e:{var A=y;y=re;var F=Le,I=y.pendingProps;switch(y.tag){case 2:break;case 16:break;case 15:case 0:break;case 1:Yi(y.type)&&Y0(y);break;case 3:Xe(y),Ui(y),I=y.stateNode,I.pendingContext&&(I.context=I.pendingContext,I.pendingContext=null),(A===null||A.child===null)&&Kl(y)&&Gu(y),Vr(y);break;case 5:ie(y);var J=Z(xe.current);if(F=y.type,A!==null&&y.stateNode!=null)Bu(A,y,F,I,J),A.ref!==y.ref&&(y.effectTag|=128);else if(I){if(A=Z(De.current),Kl(y)){if(I=y,!w)throw Error(t(175));A=tu(I.stateNode,I.type,I.memoizedProps,J,A,I),I.updateQueue=A,A=A!==null,A&&Gu(y)}else{var fe=ae(F,I,J,A,y);Kr(fe,y,!1,!1),y.stateNode=fe,ue(fe,F,I,J,A)&&Gu(y)}y.ref!==null&&(y.effectTag|=128)}else if(y.stateNode===null)throw Error(t(166));break;case 6:if(A&&y.stateNode!=null)Sn(A,y,A.memoizedProps,I);else{if(typeof I!="string"&&y.stateNode===null)throw Error(t(166));if(A=Z(xe.current),J=Z(De.current),Kl(y)){if(A=y,!w)throw Error(t(176));(A=Si(A.stateNode,A.memoizedProps,A))&&Gu(y)}else y.stateNode=en(I,A,J,y)}break;case 11:break;case 13:if(fi(qe,y),I=y.memoizedState,(y.effectTag&64)!=0){y.expirationTime=F;break e}I=I!==null,J=!1,A===null?y.memoizedProps.fallback!==void 0&&Kl(y):(F=A.memoizedState,J=F!==null,I||F===null||(F=A.child.sibling,F!==null&&(fe=y.firstEffect,fe!==null?(y.firstEffect=F,F.nextEffect=fe):(y.firstEffect=y.lastEffect=F,F.nextEffect=null),F.effectTag=8))),I&&!J&&(y.mode&2)!=0&&(A===null&&y.memoizedProps.unstable_avoidThisFallback!==!0||(qe.current&1)!=0?Ae===Ci&&(Ae=Xu):((Ae===Ci||Ae===Xu)&&(Ae=m0),_n!==0&&se!==null&&(Sl(se,Le),_s(se,_n)))),vr&&I&&(y.effectTag|=4),Wt&&(I||J)&&(y.effectTag|=4);break;case 7:break;case 8:break;case 12:break;case 4:Xe(y),Vr(y);break;case 10:mu(y);break;case 9:break;case 14:break;case 17:Yi(y.type)&&Y0(y);break;case 19:if(fi(qe,y),I=y.memoizedState,I===null)break;if(J=(y.effectTag&64)!=0,fe=I.rendering,fe===null){if(J)Au(I,!1);else if(Ae!==Ci||A!==null&&(A.effectTag&64)!=0)for(A=y.child;A!==null;){if(fe=tt(A),fe!==null){for(y.effectTag|=64,Au(I,!1),A=fe.updateQueue,A!==null&&(y.updateQueue=A,y.effectTag|=4),I.lastEffect===null&&(y.firstEffect=null),y.lastEffect=I.lastEffect,A=F,I=y.child;I!==null;)J=I,F=A,J.effectTag&=2,J.nextEffect=null,J.firstEffect=null,J.lastEffect=null,fe=J.alternate,fe===null?(J.childExpirationTime=0,J.expirationTime=F,J.child=null,J.memoizedProps=null,J.memoizedState=null,J.updateQueue=null,J.dependencies=null):(J.childExpirationTime=fe.childExpirationTime,J.expirationTime=fe.expirationTime,J.child=fe.child,J.memoizedProps=fe.memoizedProps,J.memoizedState=fe.memoizedState,J.updateQueue=fe.updateQueue,F=fe.dependencies,J.dependencies=F===null?null:{expirationTime:F.expirationTime,firstContext:F.firstContext,responders:F.responders}),I=I.sibling;Zt(qe,qe.current&1|2,y),y=y.child;break e}A=A.sibling}}else{if(!J)if(A=tt(fe),A!==null){if(y.effectTag|=64,J=!0,A=A.updateQueue,A!==null&&(y.updateQueue=A,y.effectTag|=4),Au(I,!0),I.tail===null&&I.tailMode==="hidden"&&!fe.alternate){y=y.lastEffect=I.lastEffect,y!==null&&(y.nextEffect=null);break}}else d0()>I.tailExpiration&&1<F&&(y.effectTag|=64,J=!0,Au(I,!1),y.expirationTime=y.childExpirationTime=F-1);I.isBackwards?(fe.sibling=y.child,y.child=fe):(A=I.last,A!==null?A.sibling=fe:y.child=fe,I.last=fe)}if(I.tail!==null){I.tailExpiration===0&&(I.tailExpiration=d0()+500),A=I.tail,I.rendering=A,I.tail=A.sibling,I.lastEffect=y.lastEffect,A.sibling=null,I=qe.current,I=J?I&1|2:I&1,Zt(qe,I,y),y=A;break e}break;case 20:break;case 21:break;default:throw Error(t(156,y.tag))}y=null}if(A=re,Le===1||A.childExpirationTime!==1){for(I=0,J=A.child;J!==null;)F=J.expirationTime,fe=J.childExpirationTime,F>I&&(I=F),fe>I&&(I=fe),J=J.sibling;A.childExpirationTime=I}if(y!==null)return y;g!==null&&(g.effectTag&2048)==0&&(g.firstEffect===null&&(g.firstEffect=re.firstEffect),re.lastEffect!==null&&(g.lastEffect!==null&&(g.lastEffect.nextEffect=re.firstEffect),g.lastEffect=re.lastEffect),1<re.effectTag&&(g.lastEff
Line truncated
|
||||
|
||||
Your code should look like:
|
||||
const MyComponent = lazy(() => import('./MyComponent'))`,T),a._status=So,a._result=R}},function(T){a._status===a0&&(a._status=Go,a._result=T)})}}function Ko(a,c,_){var T=c.displayName||c.name||"";return a.displayName||(T!==""?_+"("+T+")":_)}function qt(a){if(a==null)return null;if(typeof a.tag=="number"&&Ke(!1,"Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case ue:return"Fragment";case Ce:return"Portal";case ct:return"Profiler";case je:return"StrictMode";case nr:return"Suspense";case un:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case en:return"Context.Consumer";case At:return"Context.Provider";case An:return Ko(a,a.render,"ForwardRef");case Wt:return qt(a.type);case vr:{var c=a,_=Os(c);if(_)return qt(_);break}}return null}var _i=0,eu=1,ai=2,mr=4,Xo=6,W0=8,Lu=16,V0=32,Hr=64,To=128,Co=256,L0=512,tu=1024,Si=1028,ks=932,Hl=2047,F0=2048,f0=4096,Pr=!0,Ei=!0,G0=!0,fi=!0,Zt=!0,Ln=!0,Di=!1,ci=!1,Ht=!1,Du=!1,Yi=!1,Y0=!0,Ui=!1,Wl=!1,xo=!1,ni=!1,oo=!1,Vl=at.ReactCurrentOwner;function Ao(a){var c=a,_=a;if(a.alternate)for(;c.return;)c=c.return;else{var T=c;do c=T,(c.effectTag&(ai|tu))!==_i&&(_=c.return),T=c.return;while(T)}return c.tag===U?_:null}function Ms(a){return Ao(a)===a}function Xn(a){{var c=Vl.current;if(c!==null&&c.tag===N){var _=c,T=_.stateNode;T._warnedAboutRefsInRender||Ke(!1,"%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",qt(_.type)||"A component"),T._warnedAboutRefsInRender=!0}}var R=jt(a);return R?Ao(R)===R:!1}function Qo(a){if(Ao(a)!==a)throw Error("Unable to find node on an unmounted component.")}function lo(a){var c=a.alternate;if(!c){var _=Ao(a);if(_===null)throw Error("Unable to find node on an unmounted component.");return _!==a?null:a}for(var T=a,R=c;;){var j=T.return;if(j===null)break;var V=j.alternate;if(V===null){var te=j.return;if(te!==null){T=R=te;continue}break}if(j.child===V.child){for(var oe=j.child;oe;){if(oe===T)return Qo(j),a;if(oe===R)return Qo(j),c;oe=oe.sibling}throw Error("Unable to find node on an unmounted component.")}if(T.return!==R.return)T=j,R=V;else{for(var Ie=!1,Ye=j.child;Ye;){if(Ye===T){Ie=!0,T=j,R=V;break}if(Ye===R){Ie=!0,R=j,T=V;break}Ye=Ye.sibling}if(!Ie){for(Ye=V.child;Ye;){if(Ye===T){Ie=!0,T=V,R=j;break}if(Ye===R){Ie=!0,R=V,T=j;break}Ye=Ye.sibling}if(!Ie)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(T.alternate!==R)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(T.tag!==U)throw Error("Unable to find node on an unmounted component.");return T.stateNode.current===T?a:c}function b0(a){var c=lo(a);if(!c)return null;for(var _=c;;){if(_.tag===W||_.tag===ne)return _;if(_.child){_.child.return=_,_=_.child;continue}if(_===c)return null;for(;!_.sibling;){if(!_.return||_.return===c)return null;_=_.return}_.sibling.return=_.return,_=_.sibling}return null}function yl(a){var c=lo(a);if(!c)return null;for(var _=c;;){if(_.tag===W||_.tag===ne||Ht&&_.tag===xt)return _;if(_.child&&_.tag!==q){_.child.return=_,_=_.child;continue}if(_===c)return null;for(;!_.sibling;){if(!_.return||_.return===c)return null;_=_.return}_.sibling.return=_.return,_=_.sibling}return null}var Ro=o.getPublicInstance,Et=o.getRootHostContext,Pt=o.getChildHostContext,Bn=o.prepareForCommit,Ir=o.resetAfterCommit,ji=o.createInstance,Wr=o.appendInitialChild,wu=o.finalizeInitialChildren,c0=o.prepareUpdate,Ti=o.shouldSetTextContent,d0=o.shouldDeprioritizeSubtree,as=o.createTextInstance,St=o.setTimeout,so=o.clearTimeout,Jo=o.noTimeout,Gl=o.now,Fu=o.isPrimaryRenderer,fs=o.warnsIfNotActing,P0=o.supportsMutation,X=o.supportsPersistence,_e=o.supportsHydration,Ne=o.mountResponderInstance,Me=o.unmountResponderInstance,dt=o.getFundamentalComponentInstance,Hn=o.mountFundamentalComponent,Dn=o.shouldUpdateFundamentalComponent,or=o.getInstanceFromNode,mi=o.appendChild,Su=o.appendChildToContainer,bu=o.commitTextUpdate,Pu=o.commitMount,mu=o.commitUpdate,yi=o.insertBefore,Oo=o.insertInContainerBefore,Tu=o.removeChild,ao=o.removeChildFromContainer,Iu=o.resetTextContent,Oa=o.hideInstance,p0=o.hideTextInstance,Zs=o.unhideInstance,K0=o.unhideTextInstance,$s=o.updateFundamentalComponent,ka=o.unmountFundamentalComponent,cs=o.cloneInstance,w0=o.createContainerChildSet,Gn=o.appendChildToContainerChildSet,ic=o.finalizeContainerChildren,ri=o.replaceContainerChildren,Gr=o.cloneHiddenInstance,Yl=o.cloneHiddenTextInstance,ea=o.cloneInstance,lf=o.canHydrateInstance,Ns=o.canHydrateTextInstance,Ma=o.canHydrateSuspenseInstance,Ls=o.isSuspenseInstancePending,h0
Line truncated
|
||||
in `+(a||"Unknown")+T},lr=at.ReactDebugCurrentFrame;function Qn(a){switch(a.tag){case U:case q:case ne:case m:case he:case Se:return"";default:var c=a._debugOwner,_=a._debugSource,T=qt(a.type),R=null;return c&&(R=qt(c.type)),gn(T,_,R)}}function _r(a){var c="",_=a;do c+=Qn(_),_=_.return;while(_);return c}var Cn=null,Ar=null;function v0(){{if(Cn===null)return null;var a=Cn._debugOwner;if(a!==null&&typeof a!="undefined")return qt(a.type)}return null}function Rr(){return Cn===null?"":_r(Cn)}function nt(){lr.getCurrentStack=null,Cn=null,Ar=null}function _t(a){lr.getCurrentStack=Rr,Cn=a,Ar=null}function Ze(a){Ar=a}var Ft="\u269B",nn="\u26D4",sn=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.clearMarks=="function"&&typeof performance.measure=="function"&&typeof performance.clearMeasures=="function",Yn=null,yr=null,nu=null,Cu=!1,S0=!1,X0=!1,xu=0,di=0,ko=new Set,Zo=function(a){return Ft+" "+a},sf=function(a,c){var _=c?nn+" ":Ft+" ",T=c?" Warning: "+c:"";return""+_+a+T},gl=function(a){performance.mark(Zo(a))},af=function(a){performance.clearMarks(Zo(a))},Mo=function(a,c,_){var T=Zo(c),R=sf(a,_);try{performance.measure(R,T)}catch(j){}performance.clearMarks(T),performance.clearMeasures(R)},ds=function(a,c){return a+" (#"+c+")"},bs=function(a,c,_){return _===null?a+" ["+(c?"update":"mount")+"]":a+"."+_},No=function(a,c){var _=qt(a.type)||"Unknown",T=a._debugID,R=a.alternate!==null,j=bs(_,R,c);if(Cu&&ko.has(j))return!1;ko.add(j);var V=ds(j,T);return gl(V),!0},Lo=function(a,c){var _=qt(a.type)||"Unknown",T=a._debugID,R=a.alternate!==null,j=bs(_,R,c),V=ds(j,T);af(V)},ps=function(a,c,_){var T=qt(a.type)||"Unknown",R=a._debugID,j=a.alternate!==null,V=bs(T,j,c),te=ds(V,R);Mo(V,te,_)},Vu=function(a){switch(a.tag){case U:case W:case ne:case q:case m:case he:case Se:case we:return!0;default:return!1}},yu=function(){yr!==null&&nu!==null&&Lo(nu,yr),nu=null,yr=null,X0=!1},pi=function(){for(var a=Yn;a;)a._debugIsCurrentlyTiming&&ps(a,null,null),a=a.return},T0=function(a){a.return!==null&&T0(a.return),a._debugIsCurrentlyTiming&&No(a,null)},Q0=function(){Yn!==null&&T0(Yn)};function Fo(){Pr&&di++}function ta(){Pr&&(Cu&&(S0=!0),yr!==null&&yr!=="componentWillMount"&&yr!=="componentWillReceiveProps"&&(X0=!0))}function Kl(a){if(Pr){if(!sn||Vu(a)||(Yn=a,!No(a,null)))return;a._debugIsCurrentlyTiming=!0}}function Ki(a){if(Pr){if(!sn||Vu(a))return;a._debugIsCurrentlyTiming=!1,Lo(a,null)}}function Yr(a){if(Pr){if(!sn||Vu(a)||(Yn=a.return,!a._debugIsCurrentlyTiming))return;a._debugIsCurrentlyTiming=!1,ps(a,null,null)}}function fo(a){if(Pr){if(!sn||Vu(a)||(Yn=a.return,!a._debugIsCurrentlyTiming))return;a._debugIsCurrentlyTiming=!1;var c=a.tag===pe?"Rendering was suspended":"An error was thrown inside this error boundary";ps(a,null,c)}}function Oi(a,c){if(Pr){if(!sn||(yu(),!No(a,c)))return;nu=a,yr=c}}function gi(){if(Pr){if(!sn)return;if(yr!==null&&nu!==null){var a=X0?"Scheduled a cascading update":null;ps(nu,yr,a)}yr=null,nu=null}}function ff(a){if(Pr){if(Yn=a,!sn)return;xu=0,gl("(React Tree Reconciliation)"),Q0()}}function cf(a,c){if(Pr){if(!sn)return;var _=null;if(a!==null)if(a.tag===U)_="A top-level update interrupted the previous render";else{var T=qt(a.type)||"Unknown";_="An update to "+T+" interrupted the previous render"}else xu>1&&(_="There were cascading updates");xu=0;var R=c?"(React Tree Reconciliation: Completed Root)":"(React Tree Reconciliation: Yielded)";pi(),Mo(R,"(React Tree Reconciliation)",_)}}function J0(){if(Pr){if(!sn)return;Cu=!0,S0=!1,ko.clear(),gl("(Committing Changes)")}}function Z0(){if(Pr){if(!sn)return;var a=null;S0?a="Lifecycle hook scheduled a cascading update":xu>0&&(a="Caused by a cascading update in earlier commit"),S0=!1,xu++,Cu=!1,ko.clear(),Mo("(Committing Changes)","(Committing Changes)",a)}}function Te(){if(Pr){if(!sn)return;di=0,gl("(Committing Snapshot Effects)")}}function et(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Committing Snapshot Effects: "+a+" Total)","(Committing Snapshot Effects)",null)}}function Ve(){if(Pr){if(!sn)return;di=0,gl("(Committing Host Effects)")}}function Gt(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Committing Host Effects: "+a+" Total)","(Committing Host Effects)",null)}}function Yt(){if(Pr){if(!sn)return;di=0,gl("(Calling Lifecycle Methods)")}}function sr(){if(Pr){if(!sn)return;var a=di;di=0,Mo("(Calling Lifecycle Methods: "+a+" Total)","(Calling Lifecycle Methods)",null)}}var Br=[],wn;wn=[];var fu=-1;function Gu(a){return{current:a}}function Kr(a,c){if(fu<0){Ke(!1,"Unexpected pop.");return}c!==wn[fu]&&Ke(!1,"Unexpected Fiber popped."),a.current=Br[fu],Br[fu]=null,wn[fu]=null,fu--}function Vr(a,c,_){fu++,Br[fu]=a.current,wn[fu]=_,a.current=c}var Bu;Bu={};var Sn={};Object.freeze(Sn);var C0=Gu(Sn),Au=Gu(!1),ei=Sn;function _l(a,c,_){return ni?Sn:_&&zi(c)?ei:C0.current}function Ps(a,c,_){if(!ni){var T=a.stateNode;T.__reactInternalMemoizedUnmaskedChildContext=c,T.__reactInternalMemoizedMaskedChildContext=_}}function Uu(a,c){if(ni)return Sn;
Line truncated
|
||||
|
||||
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
||||
|
||||
Please update the following components: %s`,V)}if(T.size>0){var te=Po(T);Ke(!1,`Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
|
||||
|
||||
Please update the following components: %s`,te)}if(j.size>0){var oe=Po(j);Ke(!1,`Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
|
||||
Please update the following components: %s`,oe)}if(a.size>0){var Ie=Po(a);Bs(!1,`componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
||||
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
||||
|
||||
Please update the following components: %s`,Ie)}if(_.size>0){var Ye=Po(_);Bs(!1,`componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
|
||||
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
||||
|
||||
Please update the following components: %s`,Ye)}if(R.size>0){var pt=Po(R);Bs(!1,`componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
|
||||
|
||||
Please update the following components: %s`,pt)}};var Io=new Map,hf=new Set;wl.recordLegacyContextWarning=function(a,c){var _=t2(a);if(_===null){Ke(!1,"Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");return}if(!hf.has(a.type)){var T=Io.get(_);(a.type.contextTypes!=null||a.type.childContextTypes!=null||c!==null&&typeof c.getChildContext=="function")&&(T===void 0&&(T=[],Io.set(_,T)),T.push(a))}},wl.flushLegacyContextWarning=function(){Io.forEach(function(a,c){var _=new Set;a.forEach(function(j){_.add(qt(j.type)||"Component"),hf.add(j.type)});var T=Po(_),R=_r(c);Ke(!1,`Legacy context API has been detected within a strict-mode tree.
|
||||
|
||||
The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
|
||||
|
||||
Please update the following components: %s
|
||||
|
||||
Learn more about this warning here: https://fb.me/react-legacy-context%s`,T,R)})},wl.discardPendingWarnings=function(){Fa=[],ba=[],Pa=[],ua=[],ys=[],gs=[],Io=new Map}}var tl=null,ju=null,Ia=function(a){tl=a};function Zu(a){{if(tl===null)return a;var c=tl(a);return c===void 0?a:c.current}}function U0(a){return Zu(a)}function vf(a){{if(tl===null)return a;var c=tl(a);if(c===void 0){if(a!=null&&typeof a.render=="function"){var _=Zu(a.render);if(a.render!==_){var T={$$typeof:An,render:_};return a.displayName!==void 0&&(T.displayName=a.displayName),T}}return a}return c.current}}function jc(a,c){{if(tl===null)return!1;var _=a.elementType,T=c.type,R=!1,j=typeof T=="object"&&T!==null?T.$$typeof:null;switch(a.tag){case N:{typeof T=="function"&&(R=!0);break}case L:{(typeof T=="function"||j===vr)&&(R=!0);break}case ge:{(j===An||j===vr)&&(R=!0);break}case Oe:case le:{(j===Wt||j===vr)&&(R=!0);break}default:return!1}if(R){var V=tl(_);if(V!==void 0&&V===tl(T))return!0}return!1}}function lc(a){{if(tl===null||typeof WeakSet!="function")return;ju===null&&(ju=new WeakSet),ju.add(a)}}var Sl=function(a,c){{if(tl===null)return;var _=c.staleFamilies,T=c.updatedFamilies;Xa(),xp(function(){oa(a.current,T,_)})}},_s=function(a,c){{if(a.context!==Sn)return;Xa(),fv(function(){l_(c,a,null,null)})}};function oa(a,c,_){{var T=a.alternate,R=a.child,j=a.sibling,V=a.tag,te=a.type,oe=null;switch(V){case L:case le:case N:oe=te;break;case ge:oe=te.render;break;default:break}if(tl===null)throw new Error("Expected resolveFamily to be set during hot reload.");var Ie=!1,Ye=!1;if(oe!==null){var pt=tl(oe);pt!==void 0&&(_.has(pt)?Ye=!0:c.has(pt)&&(V===N?Ye=!0:Ie=!0))}ju!==null&&(ju.has(a)||T!==null&&ju.has(T))&&(Ye=!0),Ye&&(a._debugNeedsRemount=!0),(Ye||Ie)&&dl(a,bn),R!==null&&!Ye&&oa(R,c,_),j!==null&&oa(j,c,_)}}var n2=function(a,c){{var _=new Set,T=new Set(c.map(function(R){return R.current}));return la(a.current,T,_),_}};function la(a,c,_){{var T=a.child,R=a.sibling,j=a.tag,V=a.type,te=null;switch(j){case L:case le:case N:te=V;break;case ge:te=V.render;break;default:break}var oe=!1;te!==null&&c.has(te)&&(oe=!0),oe?sc(a,_):T!==null&&la(T,c,_),R!==null&&la(R,c,_)}}function sc(a,c){{var _=zc(a,c);if(_)return;for(var T=a;;){switch(T.tag){case W:c.add(T.stateNode);return;case q:c.add(T.stateNode.containerInfo);return;case U:c.add(T.stateNode.containerInfo);return}if(T.return===null)throw new Error("Expected to reach root first.");T=T.return}}}function zc(a,c){for(var _=a,T=!1;;){if(_.tag===W)T=!0,c.add(_.stateNode);else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)return T;for(;_.sibling===null;){if(_.return===null||_.return===a)return T;_=_.return}_.sibling.return=_.return,_=_.sibling}return!1}function bi(a,c){if(a&&a.defaultProps){var _=f({},c),T=a.defaultProps;for(var R in T)_[R]===void 0&&(_[R]=T[R]);return _}return c}function g(a){if(Yo(a),a._status!==So)throw a._result;return a._result}var y=Gu(null),A;A={};var F=null,I=null,J=null,fe=!1;function mt(){F=null,I=null,J=null,fe=!1}function Ct(){fe=!0}function Mt(){fe=!1}function Er(a,c){var _=a.type._context;Fu?(Vr(y,_._currentValue,a),_._currentValue=c,_._currentRenderer===void 0||_._currentRenderer===null||_._currentRenderer===A||Ke(!1,"Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),_._currentRenderer=A):(Vr(y,_._currentValue2,a),_._currentValue2=c,_._currentRenderer2===void 0||_._currentRenderer2===null||_._currentRenderer2===A||Ke(!1,"Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),_._currentRenderer2=A)}function $u(a){var c=y.current;Kr(y,a);var _=a.type._context;Fu?_._currentValue=c:_._currentValue2=c}function iu(a,c,_){if(ho(_,c))return 0;var T=typeof a._calculateChangedBits=="function"?a._calculateChangedBits(_,c):Ur;return(T&Ur)!==T&&Kt(!1,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",T),T|0}function j0(a,c){for(var _=a;_!==null;){var T=_.alternate;if(_.childExpirationTime<c)_.childExpirationTime=c,T!==null&&T.childExpirationTime<c&&(T.childExpirationTime=c);else if(T!==null&&T.childExpirationTime<c)T.childExpirationTime=c;else break;_=_.return}}function Tl(a,c,_,T){var R=a.child;for(R!==null&&(R.return=a);R!==null;){var j=void 0,V=R.dependencies;if(V!==null){j=R.child;for(var te=V.firstContext;te!==null;){if(te.context===c&&(te.observedBits&_)!=0){if(R.tag===N){var oe=gu(T,null);oe.tag=Jt,Ua(R,oe)}R.expirationTime<T&&(R.expirationTime=T);var Ie=R.alternate;Ie!==null&&Ie.expirationTime<T&&(Ie.expirationTime=T),j0(R.return,T),V.expirationTime<T&&(V.expirationTime=T);break}te=te.next}}else if(R.tag===he)j=R.type===a.type?null:R.child;else if(Di&&R.tag===rt){var Ye=R.return;if(Ye===null)throw Error("We just came from a parent so we must have had a parent. This is a bug in React.");Ye.expirationTime<T&&(Ye.expirationTime=T);var pt=Ye.alternate;pt!==null&&pt.expirationTime<T&&(pt.expirationTime=T),j0(Ye,T)
Line truncated
|
||||
|
||||
%s uses %s but also contains the following legacy lifecycles:%s%s%s
|
||||
|
||||
The above lifecycles should be removed. Learn more about this warning here:
|
||||
https://fb.me/react-unsafe-component-lifecycles`,$r,wi,zt!==null?`
|
||||
`+zt:"",vn!==null?`
|
||||
`+vn:"",xr!==null?`
|
||||
`+xr:""))}}}return R&&Ps(a,j,V),pt}function Cd(a,c){Oi(a,"componentWillMount");var _=c.state;typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),gi(),_!==c.state&&(Ke(!1,"%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",qt(a.type)||"Component"),Vc.enqueueReplaceState(c,c.state,null))}function xd(a,c,_,T){var R=c.state;if(Oi(a,"componentWillReceiveProps"),typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(_,T),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(_,T),gi(),c.state!==R){{var j=qt(a.type)||"Component";wd.has(j)||(wd.add(j),Ke(!1,"%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",j))}Vc.enqueueReplaceState(c,c.state,null)}}function ac(a,c,_,T){vh(a,c,_);var R=a.stateNode;R.props=_,R.state=a.memoizedState,R.refs=o2;var j=c.contextType;if(typeof j=="object"&&j!==null)R.context=He(j);else if(ni)R.context=Sn;else{var V=_l(a,c,!0);R.context=Uu(a,V)}{if(R.state===_){var te=qt(c)||"Component";Sd.has(te)||(Sd.add(te),Ke(!1,"%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.",te))}a.mode&cr&&wl.recordLegacyContextWarning(a,R),fi&&wl.recordUnsafeLifecycleWarnings(a,R)}var oe=a.updateQueue;oe!==null&&(mf(a,oe,_,R,T),R.state=a.memoizedState);var Ie=c.getDerivedStateFromProps;typeof Ie=="function"&&(yf(a,c,Ie,_),R.state=a.memoizedState),typeof c.getDerivedStateFromProps!="function"&&typeof R.getSnapshotBeforeUpdate!="function"&&(typeof R.UNSAFE_componentWillMount=="function"||typeof R.componentWillMount=="function")&&(Cd(a,R),oe=a.updateQueue,oe!==null&&(mf(a,oe,_,R,T),R.state=a.memoizedState)),typeof R.componentDidMount=="function"&&(a.effectTag|=mr)}function mh(a,c,_,T){var R=a.stateNode,j=a.memoizedProps;R.props=j;var V=R.context,te=c.contextType,oe=Sn;if(typeof te=="object"&&te!==null)oe=He(te);else if(!ni){var Ie=_l(a,c,!0);oe=Uu(a,Ie)}var Ye=c.getDerivedStateFromProps,pt=typeof Ye=="function"||typeof R.getSnapshotBeforeUpdate=="function";!pt&&(typeof R.UNSAFE_componentWillReceiveProps=="function"||typeof R.componentWillReceiveProps=="function")&&(j!==_||V!==oe)&&xd(a,R,_,oe),ch();var Nt=a.memoizedState,Vt=R.state=Nt,zt=a.updateQueue;if(zt!==null&&(mf(a,zt,_,R,T),Vt=a.memoizedState),j===_&&Nt===Vt&&!na()&&!qc())return typeof R.componentDidMount=="function"&&(a.effectTag|=mr),!1;typeof Ye=="function"&&(yf(a,c,Ye,_),Vt=a.memoizedState);var vn=qc()||Td(a,c,j,_,Nt,Vt,oe);return vn?(!pt&&(typeof R.UNSAFE_componentWillMount=="function"||typeof R.componentWillMount=="function")&&(Oi(a,"componentWillMount"),typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount(),gi()),typeof R.componentDidMount=="function"&&(a.effectTag|=mr)):(typeof R.componentDidMount=="function"&&(a.effectTag|=mr),a.memoizedProps=_,a.memoizedState=Vt),R.props=_,R.state=Vt,R.context=oe,vn}function Ad(a,c,_,T,R){var j=c.stateNode,V=c.memoizedProps;j.props=c.type===c.elementType?V:bi(c.type,V);var te=j.context,oe=_.contextType,Ie=Sn;if(typeof oe=="object"&&oe!==null)Ie=He(oe);else if(!ni){var Ye=_l(c,_,!0);Ie=Uu(c,Ye)}var pt=_.getDerivedStateFromProps,Nt=typeof pt=="function"||typeof j.getSnapshotBeforeUpdate=="function";!Nt&&(typeof j.UNSAFE_componentWillReceiveProps=="function"||typeof j.componentWillReceiveProps=="function")&&(V!==T||te!==Ie)&&xd(c,j,T,Ie),ch();var Vt=c.memoizedState,zt=j.state=Vt,vn=c.updateQueue;if(vn!==null&&(mf(c,vn,T,j,R),zt=c.memoizedState),V===T&&Vt===zt&&!na()&&!qc())return typeof j.componentDidUpdate=="function"&&(V!==a.memoizedProps||Vt!==a.memoizedState)&&(c.effectTag|=mr),typeof j.getSnapshotBeforeUpdate=="function"&&(V!==a.memoizedProps||Vt!==a.memoizedState)&&(c.effectTag|=Co),!1;typeof pt=="function"&&(yf(c,_,pt,T),zt=c.memoizedState);var xr=qc()||Td(c,_,V,T,Vt,zt,Ie);return xr?(!Nt&&(typeof j.UNSAFE_componentWillUpdate=="function"||typeof j.componentWillUpdate=="function")&&(Oi(c,"componentWillUpdate"),typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(T,zt,Ie),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(T,zt,Ie),gi()),typeof j.componentDidUpdate=="function"&&(c.effectTag|=mr),typeof j.getSnapshotBeforeUpdate=="function"&&(c.effectTag|=Co)):(typeof j.componentDidUpdate=="function"&&(V!==a.memoizedProps||Vt!==a.memoizedState)&&(c.effectTag|=mr),typeof j.getSnapshotBeforeUpdate=="function"&&(V!==a.memoizedProps||Vt!==a.memoizedState)&&(c.effectTag|=Co),c.memoizedProps=T,c.memoizedState=zt),j.props=T,j.state=zt,j.context=Ie,xr}var a2,Gc,Yc,Us,Rd,aa=function(a){};a2=!1,Gc=!1,Yc={},Us={},Rd={},aa=function(a){if(!(a===null||typeof a!="objec
Line truncated
|
||||
1. You may be adding a ref to a function component
|
||||
2. You may be adding a ref to a component that was not created inside a component's render method
|
||||
3. You have multiple copies of React loaded
|
||||
See https://fb.me/react-refs-must-have-owner for more information.`)}}return T}function cc(a,c){if(a.type!=="textarea"){var _="";throw _=" If you meant to render a collection of children, use an array instead."+Rr(),Error("Objects are not valid as a React child (found: "+(Object.prototype.toString.call(c)==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":c)+")."+_)}}function f2(){var a="Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it."+Rr();Rd[a]||(Rd[a]=!0,Kt(!1,"Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it."))}function yh(a){function c(it,Ot){if(!!a){var Je=it.lastEffect;Je!==null?(Je.nextEffect=Ot,it.lastEffect=Ot):it.firstEffect=it.lastEffect=Ot,Ot.nextEffect=null,Ot.effectTag=W0}}function _(it,Ot){if(!a)return null;for(var Je=Ot;Je!==null;)c(it,Je),Je=Je.sibling;return null}function T(it,Ot){for(var Je=new Map,Bt=Ot;Bt!==null;)Bt.key!==null?Je.set(Bt.key,Bt):Je.set(Bt.index,Bt),Bt=Bt.sibling;return Je}function R(it,Ot,Je){var Bt=wo(it,Ot,Je);return Bt.index=0,Bt.sibling=null,Bt}function j(it,Ot,Je){if(it.index=Je,!a)return Ot;var Bt=it.alternate;if(Bt!==null){var Mn=Bt.index;return Mn<Ot?(it.effectTag=ai,Ot):Mn}else return it.effectTag=ai,Ot}function V(it){return a&&it.alternate===null&&(it.effectTag=ai),it}function te(it,Ot,Je,Bt){if(Ot===null||Ot.tag!==ne){var Mn=Cy(Je,it.mode,Bt);return Mn.return=it,Mn}else{var pn=R(Ot,Je,Bt);return pn.return=it,pn}}function oe(it,Ot,Je,Bt){if(Ot!==null&&(Ot.elementType===Je.type||jc(Ot,Je))){var Mn=R(Ot,Je.props,Bt);return Mn.ref=fc(it,Ot,Je),Mn.return=it,Mn._debugSource=Je._source,Mn._debugOwner=Je._owner,Mn}else{var pn=Ty(Je,it.mode,Bt);return pn.ref=fc(it,Ot,Je),pn.return=it,pn}}function Ie(it,Ot,Je,Bt){if(Ot===null||Ot.tag!==q||Ot.stateNode.containerInfo!==Je.containerInfo||Ot.stateNode.implementation!==Je.implementation){var Mn=xy(Je,it.mode,Bt);return Mn.return=it,Mn}else{var pn=R(Ot,Je.children||[],Bt);return pn.return=it,pn}}function Ye(it,Ot,Je,Bt,Mn){if(Ot===null||Ot.tag!==m){var pn=Qa(Je,it.mode,Bt,Mn);return pn.return=it,pn}else{var Pi=R(Ot,Je,Bt);return Pi.return=it,Pi}}function pt(it,Ot,Je){if(typeof Ot=="string"||typeof Ot=="number"){var Bt=Cy(""+Ot,it.mode,Je);return Bt.return=it,Bt}if(typeof Ot=="object"&&Ot!==null){switch(Ot.$$typeof){case ae:{var Mn=Ty(Ot,it.mode,Je);return Mn.ref=fc(it,null,Ot),Mn.return=it,Mn}case Ce:{var pn=xy(Ot,it.mode,Je);return pn.return=it,pn}}if(Kc(Ot)||ur(Ot)){var Pi=Qa(Ot,it.mode,Je,null);return Pi.return=it,Pi}cc(it,Ot)}return typeof Ot=="function"&&f2(),null}function Nt(it,Ot,Je,Bt){var Mn=Ot!==null?Ot.key:null;if(typeof Je=="string"||typeof Je=="number")return Mn!==null?null:te(it,Ot,""+Je,Bt);if(typeof Je=="object"&&Je!==null){switch(Je.$$typeof){case ae:return Je.key===Mn?Je.type===ue?Ye(it,Ot,Je.props.children,Bt,Mn):oe(it,Ot,Je,Bt):null;case Ce:return Je.key===Mn?Ie(it,Ot,Je,Bt):null}if(Kc(Je)||ur(Je))return Mn!==null?null:Ye(it,Ot,Je,Bt,null);cc(it,Je)}return typeof Je=="function"&&f2(),null}function Vt(it,Ot,Je,Bt,Mn){if(typeof Bt=="string"||typeof Bt=="number"){var pn=it.get(Je)||null;return te(Ot,pn,""+Bt,Mn)}if(typeof Bt=="object"&&Bt!==null){switch(Bt.$$typeof){case ae:{var Pi=it.get(Bt.key===null?Je:Bt.key)||null;return Bt.type===ue?Ye(Ot,Pi,Bt.props.children,Mn,Bt.key):oe(Ot,Pi,Bt,Mn)}case Ce:{var oi=it.get(Bt.key===null?Je:Bt.key)||null;return Ie(Ot,oi,Bt,Mn)}}if(Kc(Bt)||ur(Bt)){var qu=it.get(Je)||null;return Ye(Ot,qu,Bt,Mn,null)}cc(Ot,Bt)}return typeof Bt=="function"&&f2(),null}function zt(it,Ot){{if(typeof it!="object"||it===null)return Ot;switch(it.$$typeof){case ae:case Ce:aa(it);var Je=it.key;if(typeof Je!="string")break;if(Ot===null){Ot=new Set,Ot.add(Je);break}if(!Ot.has(Je)){Ot.add(Je);break}Kt(!1,"Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.",Je);break;default:break}}return Ot}function vn(it,Ot,Je,Bt){for(var Mn=null,pn=0;pn<Je.length;pn++){var Pi=Je[pn];Mn=zt(Pi,Mn)}for(var oi=null,qu=null,ar=Ot,ou=0,qr=0,_u=null;ar!==null&&qr<Je.length;qr++){ar.index>qr?(_u=ar,ar=null):_u=ar.sibling;var _0=Nt(it,ar,Je[qr],Bt);if(_0===null){ar===null&&(ar=_u);break}a&&ar&&_0.alternate===null&&c(it,ar),ou=j(_0,ou,qr),qu===null?oi=_0:qu.sibling=_0,qu=_0,ar=_u}if(qr===Je.length)return _(it,ar),oi;if(ar===null){for(;qr<Je.length;qr++){var H0=pt(it,Je[qr],Bt);H0!==null&&(ou=j(H0,ou,qr),qu===null?oi=H0:qu.sibling=H0,qu=H0)}return oi}for(var Cs=T(it,ar);qr<Je.length;qr++){var Hu=Vt(Cs,it,qr,Je[qr],Bt);Hu!==null&&(a&&Hu.alternate!==null&&Cs.delete(Hu.key===null?qr:Hu.key),ou=j(Hu,ou,qr),qu===null?oi=Hu:
Line truncated
|
||||
`,_+=te}Kt(!1,`React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks
|
||||
|
||||
Previous render Next render
|
||||
------------------------------------------------------
|
||||
%s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`,c,_)}}}function Al(){throw Error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
||||
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
||||
2. You might be breaking the Rules of Hooks
|
||||
3. You might have more than one copy of React in the same app
|
||||
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.`)}function xf(a,c){if(io)return!1;if(c===null)return Kt(!1,"%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.",an),!1;a.length!==c.length&&Kt(!1,`The final argument passed to %s changed size between renders. The order and size of this array must remain constant.
|
||||
|
||||
Previous: %s
|
||||
Incoming: %s`,an,"["+c.join(", ")+"]","["+a.join(", ")+"]");for(var _=0;_<c.length&&_<a.length;_++)if(!ho(a[_],c[_]))return!1;return!0}function Af(a,c,_,T,R,j){zn=j,ll=c,yo=a!==null?a.memoizedState:null,$l=a!==null?a._debugHookTypes:null,go=-1,io=a!==null&&a.type!==c.type,yo!==null?Un.current=jd:$l!==null?Un.current=Ud:Un.current=xh;var V=_(T,R);if(hc){do hc=!1,vc+=1,io=!1,yo=a!==null?a.memoizedState:null,qa=pc,Pn=null,ro=null,Zl=null,go=-1,Un.current=jd,V=_(T,R);while(hc);Es=null,vc=0}Un.current=o1;var te=ll;te.memoizedState=pc,te.expirationTime=Ou,te.updateQueue=Zl,te.effectTag|=Tf,te._debugHookTypes=$l;var oe=Pn!==null&&Pn.next!==null;if(zn=lt,ll=null,Pn=null,yo=null,pc=null,ro=null,qa=null,an=null,$l=null,go=-1,Ou=lt,Zl=null,Tf=0,oe)throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return V}function v2(a,c,_){c.updateQueue=a.updateQueue,c.effectTag&=~(L0|mr),a.expirationTime<=_&&(a.expirationTime=lt)}function m2(){Un.current=o1,zn=lt,ll=null,Pn=null,yo=null,pc=null,ro=null,qa=null,$l=null,go=-1,an=null,Ou=lt,Zl=null,Tf=0,hc=!1,Es=null,vc=0}function mc(){var a={memoizedState:null,baseState:null,queue:null,baseUpdate:null,next:null};return ro===null?pc=ro=a:ro=ro.next=a,ro}function e1(){if(qa!==null)ro=qa,qa=ro.next,Pn=yo,yo=Pn!==null?Pn.next:null;else{if(yo===null)throw Error("Rendered more hooks than during the previous render.");Pn=yo;var a={memoizedState:Pn.memoizedState,baseState:Pn.baseState,queue:Pn.queue,baseUpdate:Pn.baseUpdate,next:null};ro===null?ro=pc=a:ro=ro.next=a,yo=Pn.next}return ro}function Ha(){return{lastEffect:null}}function Nd(a,c){return typeof c=="function"?c(a):c}function y2(a,c,_){var T=mc(),R;_!==void 0?R=_(c):R=c,T.memoizedState=T.baseState=R;var j=T.queue={last:null,dispatch:null,lastRenderedReducer:a,lastRenderedState:R},V=j.dispatch=u1.bind(null,ll,j);return[T.memoizedState,V]}function t1(a,c,_){var T=e1(),R=T.queue;if(R===null)throw Error("Should have a queue. This is likely a bug in React. Please file an issue.");if(R.lastRenderedReducer=a,vc>0){var j=R.dispatch;if(Es!==null){var V=Es.get(R);if(V!==void 0){Es.delete(R);var te=T.memoizedState,oe=V;do{var Ie=oe.action;te=a(te,Ie),oe=oe.next}while(oe!==null);return ho(te,T.memoizedState)||up(),T.memoizedState=te,T.baseUpdate===R.last&&(T.baseState=te),R.lastRenderedState=te,[te,j]}}return[T.memoizedState,j]}var Ye=R.last,pt=T.baseUpdate,Nt=T.baseState,Vt;if(pt!==null?(Ye!==null&&(Ye.next=null),Vt=pt.next):Vt=Ye!==null?Ye.next:null,Vt!==null){var zt=Nt,vn=null,xr=null,$r=pt,wi=Vt,N0=!1;do{var Vi=wi.expirationTime;if(Vi<zn)N0||(N0=!0,xr=$r,vn=zt),Vi>Ou&&(Ou=Vi,G2(Ou));else if(vv(Vi,wi.suspenseConfig),wi.eagerReducer===a)zt=wi.eagerState;else{var it=wi.action;zt=a(zt,it)}$r=wi,wi=wi.next}while(wi!==null&&wi!==Vt);N0||(xr=$r,vn=zt),ho(zt,T.memoizedState)||up(),T.memoizedState=zt,T.baseUpdate=xr,T.baseState=vn,R.lastRenderedState=zt}var Ot=R.dispatch;return[T.memoizedState,Ot]}function Rf(a){var c=mc();typeof a=="function"&&(a=a()),c.memoizedState=c.baseState=a;var _=c.queue={last:null,dispatch:null,lastRenderedReducer:Nd,lastRenderedState:a},T=_.dispatch=u1.bind(null,ll,_);return[c.memoizedState,T]}function n1(a){return t1(Nd,a)}function Wa(a,c,_,T){var R={tag:a,create:c,destroy:_,deps:T,next:null};if(Zl===null)Zl=Ha(),Zl.lastEffect=R.next=R;else{var j=Zl.lastEffect;if(j===null)Zl.lastEffect=R.next=R;else{var V=j.next;j.next=R,R.next=V,Zl.lastEffect=R}}return R}function r1(a){var c=mc(),_={current:a};return Object.seal(_),c.memoizedState=_,_}function Ld(a){var c=e1();return c.memoizedState}function g2(a,c,_,T){var R=mc(),j=T===void 0?null:T;Tf|=a,R.memoizedState=Wa(c,_,void 0,j)}function yc(a,c,_,T){var R=e1(),j=T===void 0?null:T,V=void 0;if(Pn!==null){var te=Pn.memoizedState;if(V=te.destroy,j!==null){var oe=te.deps;if(xf(j,oe)){Wa(wf,_,V,j);return}}}Tf|=a,R.memoizedState=Wa(c,_,V,j)}function i1(a,c){return typeof jest!="undefined"&&Av(ll),g2(mr|L0,rr|$c,a,c)}function Rl(a,c){return typeof jest!="undefined"&&Av(ll),yc(mr|L0,rr|$c,a,c)}function pa(a,c){return g2(mr,Sf|ol,a,c)}function wh(a,c){return yc(mr,Sf|ol,a,c)}function Fd(a,c){if(typeof c=="function"){var _=c,T=a();return _(T),function(){_(null)}}else if(c!=null){var R=c;R.hasOwnProperty("current")||Kt(!1,"Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(R).join(", ")+"}");var j=a();return R.current=j,function(){R.current=null}}}function bd(a,c,_){typeof c!="function"&&Kt(!1,"Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",c!==null?typeof c:"null");var T=_!=null?_.concat([a]):null;return g2(mr,Sf|ol,Fd.bind(null,c,a),T)}function Sh(a,c,_){typeof c!="function"&&Kt(!1,"Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",c!==null?typeof c:"null");var T=_!=null?_.concat([a]):null;return yc(
Line truncated
|
||||
|
||||
Check the render method of \``+T+"`.");var R=T||a._debugID||"",j=a._debugSource;j&&(R=j.fileName+":"+j.lineNumber),Kd[R]||(Kd[R]=!0,Kt(!1,"Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",_))}if(Wl&&c.defaultProps!==void 0){var V=qt(c)||"Unknown";Xd[V]||(Ke(!1,"%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.",V),Xd[V]=!0)}if(typeof c.getDerivedStateFromProps=="function"){var te=qt(c)||"Unknown";Ws[te]||(Ke(!1,"%s: Function components do not support getDerivedStateFromProps.",te),Ws[te]=!0)}if(typeof c.contextType=="object"&&c.contextType!==null){var oe=qt(c)||"Unknown";Hs[oe]||(Ke(!1,"%s: Function components do not support contextType.",oe),Hs[oe]=!0)}}var w2={dehydrated:null,retryTime:lt};function $d(a,c,_){return Jc(a,Qc)&&(c===null||c.memoizedState!==null)}function qh(a,c,_){var T=c.mode,R=c.pendingProps;a_(c)&&(c.effectTag|=Hr);var j=xl.current,V=!1,te=(c.effectTag&Hr)!==_i;if(te||$d(j,a,c)?(V=!0,c.effectTag&=~Hr):(a===null||a.memoizedState!==null)&&R.fallback!==void 0&&R.unstable_avoidThisFallback!==!0&&(j=d2(j,Ef)),j=ca(j),Or(c,j),"maxDuration"in R&&(p1||(p1=!0,Kt(!1,"maxDuration has been removed from React. Remove the maxDuration prop."))),a===null){if(R.fallback!==void 0&&(Vd(c),Di)){var oe=c.memoizedState;if(oe!==null){var Ie=oe.dehydrated;if(Ie!==null)return Hh(c,Ie,_)}}if(V){var Ye=R.fallback,pt=Qa(null,T,lt,null);if(pt.return=c,(c.mode&Y)===Sr){var Nt=c.memoizedState,Vt=Nt!==null?c.child.child:c.child;pt.child=Vt;for(var zt=Vt;zt!==null;)zt.return=pt,zt=zt.sibling}var vn=Qa(Ye,T,_,null);return vn.return=c,pt.sibling=vn,c.memoizedState=w2,c.child=pt,vn}else{var xr=R.children;return c.memoizedState=null,c.child=Xc(c,null,xr,_)}}else{var $r=a.memoizedState;if($r!==null){if(Di){var wi=$r.dehydrated;if(wi!==null)if(te){if(c.memoizedState!==null)return c.child=a.child,c.effectTag|=Hr,null;var N0=R.fallback,Vi=Qa(null,T,lt,null);if(Vi.return=c,Vi.child=null,(c.mode&Y)===Sr)for(var it=Vi.child=c.child;it!==null;)it.return=Vi,it=it.sibling;else gf(c,a.child,null,_);if(Zt&&c.mode&Jr){for(var Ot=0,Je=Vi.child;Je!==null;)Ot+=Je.treeBaseDuration,Je=Je.sibling;Vi.treeBaseDuration=Ot}var Bt=Qa(N0,T,_,null);return Bt.return=c,Vi.sibling=Bt,Bt.effectTag|=ai,Vi.childExpirationTime=lt,c.memoizedState=w2,c.child=Vi,Bt}else return Wh(a,c,wi,$r,_)}var Mn=a.child,pn=Mn.sibling;if(V){var Pi=R.fallback,oi=wo(Mn,Mn.pendingProps,lt);if(oi.return=c,(c.mode&Y)===Sr){var qu=c.memoizedState,ar=qu!==null?c.child.child:c.child;if(ar!==Mn.child){oi.child=ar;for(var ou=ar;ou!==null;)ou.return=oi,ou=ou.sibling}}if(Zt&&c.mode&Jr){for(var qr=0,_u=oi.child;_u!==null;)qr+=_u.treeBaseDuration,_u=_u.sibling;oi.treeBaseDuration=qr}var _0=wo(pn,Pi,pn.expirationTime);return _0.return=c,oi.sibling=_0,oi.childExpirationTime=lt,c.memoizedState=w2,c.child=oi,_0}else{var H0=R.children,Cs=Mn.child,Hu=gf(c,Cs,H0,_);return c.memoizedState=null,c.child=Hu}}else{var pl=a.child;if(V){var Ja=R.fallback,jo=Qa(null,T,lt,null);if(jo.return=c,jo.child=pl,pl!==null&&(pl.return=jo),(c.mode&Y)===Sr){var xs=c.memoizedState,X2=xs!==null?c.child.child:c.child;jo.child=X2;for(var Uf=X2;Uf!==null;)Uf.return=jo,Uf=Uf.sibling}if(Zt&&c.mode&Jr){for(var Rc=0,Pl=jo.child;Pl!==null;)Rc+=Pl.treeBaseDuration,Pl=Pl.sibling;jo.treeBaseDuration=Rc}var zo=Qa(Ja,T,_,null);return zo.return=c,jo.sibling=zo,zo.effectTag|=ai,jo.childExpirationTime=lt,c.memoizedState=w2,c.child=jo,zo}else{c.memoizedState=null;var O1=R.children;return c.child=gf(c,pl,O1,_)}}}}function ep(a,c,_){c.memoizedState=null;var T=c.pendingProps,R=T.children;return _o(a,c,R,_),c.child}function Hh(a,c,_){if((a.mode&Y)===Sr)Kt(!1,"Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOM.createBlockingRoot(container, { hydrate: true }).render(element) or remove the Suspense components from the server rendered components."),a.expirationTime=bn;else if(h0(c)){var T=Fl(),R=ms(T);Ln&&x(R),a.expirationTime=R}else a.expirationTime=hi,Ln&&x(hi);return null}function Wh(a,c,_,T,R){if(qd(),(c.mode&Y)===Sr||h0(_))return ep(a,c,R);var j=a.childExpirationTime>=R;if(va||j){if(R<bn&&T.retryTime<=R){var V=R+1;T.retryTime=V,dl(a,V)}return yv(),ep(a,c,R)}else{if(Ls(_))return c.effectTag|=Hr,c.child=a.child,Fs(_,dy.bind(null,a)),null;Em(c,_);for(var te=c.pendingProps,oe=te.children,Ie=Xc(c,null,oe,R),Ye=Ie;Ye;)Ye.effectTag|=tu,Ye=Ye.sibling;return c.child=Ie,c.child}}function tp(a,c){a.expirationTime<c&&(a.expirationTime=c);var _=a.alternate;_!==null&&_.expirationTime<c&&(_.expirationTime=c),j0(a.return,c)}function Rm(a,c,_){for(var T=c;T!==null;){if(T.tag===pe){var R=T.memoizedState;R!==null&&tp(T,_)}else if(T.tag===wt)tp(T,_);else if(T.child!==null){T.child.return=T,T=T.child;continue}if(T===a)return;for(;T.sibling===null;){if(T.return===null||T.return===a)return;T=T.return}T.sibling.return=T.return,T=T.sibling}}functioLine truncated
|
||||
Recreating the tree from scratch failed so React will unmount the tree.`:Ie=`Consider adding an error boundary to your tree to customize error handling behavior.
|
||||
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.`;var Ye=""+oe+R+`
|
||||
|
||||
`+(""+Ie);console.error(Ye)}}}var ev=null;ev=new Set;var Gs=typeof WeakSet=="function"?WeakSet:Set;function hp(a,c){var _=c.source,T=c.stack;T===null&&_!==null&&(T=_r(_));var R={componentName:_!==null?qt(_.type):null,componentStack:T!==null?T:"",error:c.value,errorBoundary:null,errorBoundaryName:null,errorBoundaryFound:!1,willRetry:!1};a!==null&&a.tag===N&&(R.errorBoundary=a.stateNode,R.errorBoundaryName=qt(a.type),R.errorBoundaryFound=!0,R.willRetry=!0);try{n0(R)}catch(j){setTimeout(function(){throw j})}}var jm=function(a,c){Oi(a,"componentWillUnmount"),c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount(),gi()};function tv(a,c){if(sl(null,jm,null,a,c),Jn()){var _=Vs();Pf(a,_)}}function vp(a){var c=a.ref;if(c!==null)if(typeof c=="function"){if(sl(null,c,null,null),Jn()){var _=Vs();Pf(a,_)}}else c.current=null}function zm(a,c){if(sl(null,c,null),Jn()){var _=Vs();Pf(a,_)}}function mp(a,c){switch(c.tag){case L:case ge:case le:{_c(ym,wf,c);return}case N:{if(c.effectTag&Co&&a!==null){var _=a.memoizedProps,T=a.memoizedState;Oi(c,"getSnapshotBeforeUpdate");var R=c.stateNode;c.type===c.elementType&&!ma&&(R.props!==c.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(c.type)||"instance"),R.state!==c.memoizedState&&Kt(!1,"Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(c.type)||"instance"));var j=R.getSnapshotBeforeUpdate(c.elementType===c.type?_:bi(c.type,_),T);{var V=ev;j===void 0&&!V.has(c.type)&&(V.add(c.type),Ke(!1,"%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",qt(c.type)))}R.__reactInternalSnapshotBeforeUpdate=j,gi()}return}case U:case W:case ne:case q:case Ge:return;default:throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}}function _c(a,c,_){var T=_.updateQueue,R=T!==null?T.lastEffect:null;if(R!==null){var j=R.next,V=j;do{if((V.tag&a)!==wf){var te=V.destroy;V.destroy=void 0,te!==void 0&&te()}if((V.tag&c)!==wf){var oe=V.create;V.destroy=oe();{var Ie=V.destroy;if(Ie!==void 0&&typeof Ie!="function"){var Ye=void 0;Ie===null?Ye=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof Ie.then=="function"?Ye=`
|
||||
|
||||
It looks like you wrote useEffect(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
// You can await here
|
||||
const response = await MyAPI.getData(someId);
|
||||
// ...
|
||||
}
|
||||
fetchData();
|
||||
}, [someId]); // Or [] if effect doesn't need props or state
|
||||
|
||||
Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching`:Ye=" You returned: "+Ie,Ke(!1,"An effect function must not return anything besides a function, which is used for clean-up.%s%s",Ye,_r(_))}}}V=V.next}while(V!==j)}}function Ea(a){if((a.effectTag&L0)!==_i)switch(a.tag){case L:case ge:case le:{_c(rr,wf,a),_c(wf,$c,a);break}default:break}}function yp(a,c,_,T){switch(_.tag){case L:case ge:case le:{_c(gm,ol,_);break}case N:{var R=_.stateNode;if(_.effectTag&mr)if(c===null)Oi(_,"componentDidMount"),_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),R.componentDidMount(),gi();else{var j=_.elementType===_.type?c.memoizedProps:bi(_.type,c.memoizedProps),V=c.memoizedState;Oi(_,"componentDidUpdate"),_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),R.componentDidUpdate(j,V,R.__reactInternalSnapshotBeforeUpdate),gi()}var te=_.updateQueue;te!==null&&(_.type===_.elementType&&!ma&&(R.props!==_.memoizedProps&&Kt(!1,"Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance"),R.state!==_.memoizedState&&Kt(!1,"Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",qt(_.type)||"instance")),vo(_,te,R,T));return}case U:{var oe=_.updateQueue;if(oe!==null){var Ie=null;if(_.child!==null)switch(_.child.tag){case W:Ie=Ro(_.child.stateNode);break;case N:Ie=_.child.stateNode;break}vo(_,oe,Ie,T)}return}case W:{var Ye=_.stateNode;if(c===null&&_.effectTag&mr){var pt=_.type,Nt=_.memoizedProps;Pu(Ye,pt,Nt,_)}return}case ne:return;case q:return;case ze:{if(Zt){var Vt=_.memoizedProps.onRender;typeof Vt=="function"&&(Ln?Vt(_.memoizedProps.id,c===null?"mount":"update",_.actualDuration,_.treeBaseDuration,_.actualStartTime,kl(),a.memoizedInteractions):Vt(_.memoizedProps.id,c===null?"mount":"update",_.actualDuration,_.treeBaseDuration,_.actualStartTime,kl()))}return}case pe:{Nl(a,_);return}case wt:case Ge:case xt:case $e:return;default:throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}}function M2(a,c){if(P0)for(var _=a;;){if(_.tag===W){var T=_.stateNode;c?Oa(T):Zs(_.stateNode,_.memoizedProps)}else if(_.tag===ne){var R=_.stateNode;c?p0(R):K0(R,_.memoizedProps)}else if(_.tag===pe&&_.memoizedState!==null&&_.memoizedState.dehydrated===null){var j=_.child.sibling;j.return=_,_=j;continue}else if(_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)return;for(;_.sibling===null;){if(_.return===null||_.return===a)return;_=_.return}_.sibling.return=_.return,_=_.sibling}}function ku(a){var c=a.ref;if(c!==null){var _=a.stateNode,T;switch(a.tag){case W:T=Ro(_);break;default:T=_}Du&&a.tag===$e&&(T=_.methods),typeof c=="function"?c(T):(c.hasOwnProperty("current")||Ke(!1,"Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().%s",qt(a.type),_r(a)),c.current=T)}}function zu(a){var c=a.ref;c!==null&&(typeof c=="function"?c(null):c.current=null)}function gp(a,c,_){switch(Rn(c),c.tag){case L:case ge:case Oe:case le:{var T=c.updateQueue;if(T!==null){var R=T.lastEffect;if(R!==null){var j=R.next,V=_>Wn?Wn:_;_n(V,function(){var $r=j;do{var wi=$r.destroy;wi!==void 0&&zm(c,wi),$r=$r.next}while($r!==j)})}}break}case N:{vp(c);var te=c.stateNode;typeof te.componentWillUnmount=="function"&&tv(c,te);return}case W:{if(ci){var oe=c.dependencies;if(oe!==null){var Ie=oe.responders;if(Ie!==null){for(var Ye=Array.from(Ie.values()),pt=0,Nt=Ye.length;pt<Nt;pt++){var Vt=Ye[pt];Me(Vt)}oe.responders=null}}}vp(c);return}case q:{P0?g1(a,c,_):X&&qm(c);return}case xt:{if(Ht){var zt=c.stateNode;zt!==null&&(ka(zt),c.stateNode=null)}return}case rt:{if(Ui){var vn=a.hydrationCallbacks;if(vn!==null){var xr=vn.onDeleted;xr&&xr(c.stateNode)}}return}case $e:Du&&vp(c)}}functio
Line truncated
|
||||
|
||||
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`+_r(_))}Rp(),T=cp(T,_);var Nt=c;do{switch(Nt.tag){case U:{var Vt=T;Nt.effectTag|=f0,Nt.expirationTime=R;var zt=uv(Nt,Vt,R);r2(Nt,zt);return}case N:var vn=T,xr=Nt.type,$r=Nt.stateNode;if((Nt.effectTag&Hr)===_i&&(typeof xr.getDerivedStateFromError=="function"||$r!==null&&typeof $r.componentDidCatch=="function"&&!Lp($r))){Nt.effectTag|=f0,Nt.expirationTime=R;var wi=ov(Nt,vn,R);r2(Nt,wi);return}break;default:break}Nt=Nt.return}while(Nt!==null)}var wa=Math.ceil,Cr=at.ReactCurrentDispatcher,Ep=at.ReactCurrentOwner,fl=at.IsSomeRendererActing,cu=0,E1=1,ki=2,Dp=4,F2=8,Do=16,Ss=32,Mf=0,b2=1,wp=2,D1=3,w1=4,Sp=5,Zn=cu,cl=null,qn=null,q0=lt,k0=Mf,P2=null,Ll=bn,S1=bn,Dc=null,wc=lt,I2=!1,Tp=0,M0=500,fn=null,B2=!1,U2=null,Sc=null,Tc=!1,Cc=null,T1=y0,Cp=lt,Ka=null,Km=50,xc=0,j2=null,sv=50,C1=0,Nf=null,Lf=null,x1=lt;function Fl(){return(Zn&(Do|Ss))!==cu?Ju(vt()):(x1!==lt||(x1=Ju(vt())),x1)}function Ac(){return Ju(vt())}function Ff(a,c,_){var T=c.mode;if((T&Y)===Sr)return bn;var R=Xt();if((T&Qr)===Sr)return R===Ci?bn:Qu;if((Zn&Do)!==cu)return q0;var j;if(_!==null)j=ia(a,_.timeoutMs|0||pf);else switch(R){case Ci:j=bn;break;case Xr:j=La(a);break;case Wn:case Xu:j=ms(a);break;case m0:j=Qi;break;default:throw Error("Expected a valid priority level")}return cl!==null&&j===q0&&(j-=1),j}function Xm(a,c){hy(),gy(a);var _=z2(a,c);if(_===null){my(a);return}Up(a,c),ta();var T=Xt();if(c===bn?(Zn&F2)!==cu&&(Zn&(Do|Ss))===cu?(H(_,c),A1(_)):(Uo(_),H(_,c),Zn===cu&&It()):(Uo(_),H(_,c)),(Zn&Dp)!==cu&&(T===Xr||T===Ci))if(Ka===null)Ka=new Map([[_,c]]);else{var R=Ka.get(_);(R===void 0||R>c)&&Ka.set(_,c)}}var dl=Xm;function z2(a,c){a.expirationTime<c&&(a.expirationTime=c);var _=a.alternate;_!==null&&_.expirationTime<c&&(_.expirationTime=c);var T=a.return,R=null;if(T===null&&a.tag===U)R=a.stateNode;else for(;T!==null;){if(_=T.alternate,T.childExpirationTime<c&&(T.childExpirationTime=c),_!==null&&_.childExpirationTime<c&&(_.childExpirationTime=c),T.return===null&&T.tag===U){R=T.stateNode;break}T=T.return}return R!==null&&(cl===R&&(G2(c),k0===w1&&Bf(R,q0)),o_(R,c)),R}function q2(a){var c=a.lastExpiredTime;if(c!==lt)return c;var _=a.firstPendingTime;if(!u_(a,_))return _;var T=a.lastPingedTime,R=a.nextKnownPendingLevel;return T>R?T:R}function Uo(a){var c=a.lastExpiredTime;if(c!==lt){a.callbackExpirationTime=bn,a.callbackPriority=Ci,a.callbackNode=En(A1.bind(null,a));return}var _=q2(a),T=a.callbackNode;if(_===lt){T!==null&&(a.callbackNode=null,a.callbackExpirationTime=lt,a.callbackPriority=y0);return}var R=Fl(),j=$1(R,_);if(T!==null){var V=a.callbackPriority,te=a.callbackExpirationTime;if(te===_&&V>=j)return;er(T)}a.callbackExpirationTime=_,a.callbackPriority=j;var oe;_===bn?oe=En(A1.bind(null,a)):oo?oe=yn(j,H2.bind(null,a)):oe=yn(j,H2.bind(null,a),{timeout:bo(_)-vt()}),a.callbackNode=oe}function H2(a,c){if(x1=lt,c){var _=Fl();return qp(a,_),Uo(a),null}var T=q2(a);if(T!==lt){var R=a.callbackNode;if((Zn&(Do|Ss))!==cu)throw Error("Should not already be working.");if(Xa(),(a!==cl||T!==q0)&&(bf(a,T),ee(a,T)),qn!==null){var j=Zn;Zn|=Do;var V=pv(a),te=W2(a);ff(qn);do try{oy();break}catch(Ye){dv(a,Ye)}while(!0);if(mt(),Zn=j,hv(V),Ln&&V2(te),k0===b2){var oe=P2;throw Bp(),bf(a,T),Bf(a,T),Uo(a),oe}if(qn!==null)Bp();else{Tv();var Ie=a.finishedWork=a.current.alternate;a.finishedExpirationTime=T,Qm(a,Ie,k0,T)}if(Uo(a),a.callbackNode===R)return H2.bind(null,a)}}return null}function Qm(a,c,_,T){switch(cl=null,_){case Mf:case b2:throw Error("Root did not complete. This is a bug in React.");case wp:{qp(a,T>Qi?Qi:T);break}case D1:{Bf(a,T);var R=a.lastSuspendedTime;T===R&&(a.nextKnownPendingLevel=Op(c)),d();var j=Ll===bn;if(j&&!(Y0&&If.current)){var V=Tp+M0-vt();if(V>10){if(I2){var te=a.lastPingedTime;if(te===lt||te>=T){a.lastPingedTime=T,bf(a,T);break}}var oe=q2(a);if(oe!==lt&&oe!==T)break;if(R!==lt&&R!==T){a.lastPingedTime=R;break}a.timeoutHandle=St(r0.bind(null,a),V);break}}r0(a);break}case w1:{Bf(a,T);var Ie=a.lastSuspendedTime;if(T===Ie&&(a.nextKnownPendingLevel=Op(c)),d(),!(Y0&&If.current)){if(I2){var Ye=a.lastPingedTime;if(Ye===lt||Ye>=T){a.lastPingedTime=T,bf(a,T);break}}var pt=q2(a);if(pt!==lt&&pt!==T)break;if(Ie!==lt&&Ie!==T){a.lastPingedTime=Ie;break}var Nt;if(S1!==bn)Nt=bo(S1)-vt();else if(Ll===bn)Nt=0;else{var Vt=_v(Ll),zt=vt(),vn=bo(T)-zt,xr=zt-Vt;xr<0&&(xr=0),Nt=Pp(xr)-xr,vn<Nt&&(Nt=vn)}if(Nt>10){a.timeoutHandle=St(r0.bind(null,a),Nt);break}}r0(a);break}case Sp:{if(!(Y0&&If.current)&&Ll!==bn&&Dc!==null){var $r=Ip(Ll,T,Dc);if($r>10){Bf(a,T),a.timeoutHandle=St(r0.bind(null,a),$r);break}}r0(a);break}default:throw Error("Unknown root exit status.")}}function A1(a){var c=a.lastExpiredTime,_=c!==lt?c:bn;if(a.finishedExpirationTime===_)r0(a);else{if((Zn&(Do|Ss))!==cu)throw Error("Should not already be working.");if(Xa(),(a!==cl||_!==q0)&&(bf(a,_),ee(a,_)),qn!==null){var T=Zn;Zn|=Do;var R=pv(a),j=W2(a);ff(qn);do try{Ev();break}catch(te){dv(a,te)}whi
Line truncated
|
||||
Be sure to use the matching version of act() corresponding to your renderer:
|
||||
|
||||
// for react-dom:
|
||||
import {act} from 'react-dom/test-utils';
|
||||
// ...
|
||||
act(() => ...);
|
||||
|
||||
// for react-test-renderer:
|
||||
import TestRenderer from 'react-test-renderer';
|
||||
const {act} = TestRenderer;
|
||||
// ...
|
||||
act(() => ...);%s`,_r(a))}function Av(a){fs===!0&&(a.mode&cr)!==Sr&&fl.current===!1&&If.current===!1&&Ke(!1,`An update to %s ran an effect, but was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act%s`,qt(a.type),_r(a))}function _y(a){fs===!0&&Zn===cu&&fl.current===!1&&If.current===!1&&Ke(!1,`An update to %s inside a test was not wrapped in act(...).
|
||||
|
||||
When testing, code that causes React state updates should be wrapped into act(...):
|
||||
|
||||
act(() => {
|
||||
/* fire events that update state */
|
||||
});
|
||||
/* assert on the output */
|
||||
|
||||
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act%s`,qt(a.type),_r(a))}var Ey=_y,zp=!1;function Dy(a){zp===!1&&t.unstable_flushAllWithoutAsserting===void 0&&(a.mode&Y||a.mode&Qr?(zp=!0,Ke(!1,`In Concurrent or Sync modes, the "scheduler" module needs to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest:
|
||||
jest.mock('scheduler', () => require('scheduler/unstable_mock'));
|
||||
|
||||
For more info, visit https://fb.me/react-mock-scheduler`)):Yi===!0&&(zp=!0,Ke(!1,`Starting from React v17, the "scheduler" module will need to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest:
|
||||
jest.mock('scheduler', () => require('scheduler/unstable_mock'));
|
||||
|
||||
For more info, visit https://fb.me/react-mock-scheduler`)))}var Ys=null;function wy(a){{var c=Xt();if((a.mode&Qr)!==_i&&(c===Xr||c===Ci))for(var _=a;_!==null;){var T=_.alternate;if(T!==null)switch(_.tag){case N:var R=T.updateQueue;if(R!==null)for(var j=R.firstUpdate;j!==null;){var V=j.priority;if(V===Xr||V===Ci){Ys===null?Ys=new Set([qt(_.type)]):Ys.add(qt(_.type));break}j=j.next}break;case L:case ge:case le:if(_.memoizedState!==null&&_.memoizedState.baseUpdate!==null)for(var te=_.memoizedState.baseUpdate;te!==null;){var oe=te.priority;if(oe===Xr||oe===Ci){Ys===null?Ys=new Set([qt(_.type)]):Ys.add(qt(_.type));break}if(te.next===_.memoizedState.baseUpdate)break;te=te.next}break;default:break}_=_.return}}}function d(){if(Ys!==null){var a=[];Ys.forEach(function(c){return a.push(c)}),Ys=null,a.length>0&&Ke(!1,`%s triggered a user-blocking update that suspended.
|
||||
|
||||
The fix is to split the update into multiple parts: a user-blocking update to provide immediate feedback, and another update that triggers the bulk of the changes.
|
||||
|
||||
Refer to the documentation for useTransition to learn how to implement this pattern.`,a.sort().join(", "))}}function v(a,c){return c*1e3+a.interactionThreadID}function x(a){!Ln||(Lf===null?Lf=[a]:Lf.push(a))}function b(a,c,_){if(!!Ln&&_.size>0){var T=a.pendingInteractionMap,R=T.get(c);R!=null?_.forEach(function(te){R.has(te)||te.__count++,R.add(te)}):(T.set(c,new Set(_)),_.forEach(function(te){te.__count++}));var j=k.__subscriberRef.current;if(j!==null){var V=v(a,c);j.onWorkScheduled(_,V)}}}function H(a,c){!Ln||b(a,c,k.__interactionsRef.current)}function ee(a,c){if(!!Ln){var _=new Set;if(a.pendingInteractionMap.forEach(function(j,V){V>=c&&j.forEach(function(te){return _.add(te)})}),a.memoizedInteractions=_,_.size>0){var T=k.__subscriberRef.current;if(T!==null){var R=v(a,c);try{T.onWorkStarted(_,R)}catch(j){yn(Ci,function(){throw j})}}}}}function de(a,c){if(!!Ln){var _=a.firstPendingTime,T;try{if(T=k.__subscriberRef.current,T!==null&&a.memoizedInteractions.size>0){var R=v(a,c);T.onWorkStopped(a.memoizedInteractions,R)}}catch(V){yn(Ci,function(){throw V})}finally{var j=a.pendingInteractionMap;j.forEach(function(V,te){te>_&&(j.delete(te),V.forEach(function(oe){if(oe.__count--,T!==null&&oe.__count===0)try{T.onInteractionScheduledWorkCompleted(oe)}catch(Ie){yn(Ci,function(){throw Ie})}}))})}}}var ye=null,be=null,gt=!1,Dt=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined";function Rt(a){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")return!1;var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled)return!0;if(!c.supportsFiber)return Ke(!1,"The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://fb.me/react-devtools"),!0;try{var _=c.inject(a);ye=function(T,R){try{var j=(T.current.effectTag&Hr)===Hr;if(Zt){var V=Ac(),te=$1(V,R);c.onCommitFiberRoot(_,T,te,j)}else c.onCommitFiberRoot(_,T,void 0,j)}catch(oe){gt||(gt=!0,Ke(!1,"React DevTools encountered an error: %s",oe))}},be=function(T){try{c.onCommitFiberUnmount(_,T)}catch(R){gt||(gt=!0,Ke(!1,"React DevTools encountered an error: %s",R))}}}catch(T){Ke(!1,"React DevTools encountered an error: %s.",T)}return!0}function rn(a,c){typeof ye=="function"&&ye(a,c)}function Rn(a){typeof be=="function"&&be(a)}var $n;{$n=!1;try{var Nr=Object.preventExtensions({}),ir=new Map([[Nr,null]]),Zr=new Set([Nr]);ir.set(0,0),Zr.add(0)}catch(a){$n=!0}}var ui=1;function bl(a,c,_,T){this.tag=a,this.key=_,this.elementType=null,this.type=null,this.stateNode=null,this.return=null,this.child=null,this.sibling=null,this.index=0,this.ref=null,this.pendingProps=c,this.memoizedProps=null,this.updateQueue=null,this.memoizedState=null,this.dependencies=null,this.mode=T,this.effectTag=_i,this.nextEffect=null,this.firstEffect=null,this.lastEffect=null,this.expirationTime=lt,this.childExpirationTime=lt,this.alternate=null,Zt&&(this.actualDuration=Number.NaN,this.actualStartTime=Number.NaN,this.selfBaseDuration=Number.NaN,this.treeBaseDuration=Number.NaN,this.actualDuration=0,this.actualStartTime=-1,this.selfBaseDuration=0,this.treeBaseDuration=0),Pr&&(this._debugID=ui++,this._debugIsCurrentlyTiming=!1),this._debugSource=null,this._debugOwner=null,this._debugNeedsRemount=!1,this._debugHookTypes=null,!$n&&typeof Object.preventExtensions=="function"&&Object.preventExtensions(this)}var Wi=function(a,c,_,T){return new bl(a,c,_,T)};function uo(a){var c=a.prototype;return!!(c&&c.isReactComponent)}function i0(a){return typeof a=="function"&&!uo(a)&&a.defaultProps===void 0}function Ts(a){if(typeof a=="function")return uo(a)?N:L;if(a!=null){var c=a.$$typeof;if(c===An)return ge;if(c===Wt)return Oe}return C}function wo(a,c,_){var T=a.alternate;T===null?(T=Wi(a.tag,c,a.key,a.mode),T.elementType=a.elementType,T.type=a.type,T.stateNode=a.stateNode,T._debugID=a._debugID,T._debugSource=a._debugSource,T._debugOwner=a._debugOwner,T._debugHookTypes=a._debugHookTypes,T.alternate=a,a.alternate=T):(T.pendingProps=c,T.effectTag=_i,T.nextEffect=null,T.firstEffect=null,T.lastEffect=null,Zt&&(T.actualDuration=0,T.actualStartTime=-1)),T.childExpirationTime=a.childExpirationTime,T.expirationTime=a.expirationTime,T.child=a.child,T.memoizedProps=a.memoizedProps,T.memoizedState=a.memoizedState,T.updateQueue=a.updateQueue;var R=a.dependencies;switch(T.dependencies=R===null?null:{expirationTime:R.expirationTime,firstContext:R.firstContext,responders:R.responders},T.sibling=a.sibling,T.index=a.index,T.ref=a.ref,Zt&&(T.selfBaseDuration=a.selfBaseDuration,T.treeBaseDuration=a.treeBaseDuration),T._debugNeedsRemount=a._debugNeedsRemount,T.tag){case C:case L:case le:T.type=Zu(a.type);break;case N:T.type=U0(a.type);break;case ge:T.type=vf(a.type);break;default:break}return T}function Rv(a,c){a.effectTag&=ai,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null;var _=a.alternate;if(_===null)a.childExpirationTime=lt,a.expirationTime=c,a.child=null,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,Zt&&(a.selfBaseDuration=0,a.t
Line truncated
|
||||
|
||||
Check the render method of \``+Ye+"`.")}throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: "+(a==null?a:typeof a)+"."+Ie)}}}return V=Wi(te,_,c,R),V.elementType=a,V.type=oe,V.expirationTime=j,V}function Ty(a,c,_){var T=null;T=a._owner;var R=a.type,j=a.key,V=a.props,te=Sy(R,j,V,T,c,_);return te._debugSource=a._source,te._debugOwner=a._owner,te}function Qa(a,c,_,T){var R=Wi(m,a,T,c);return R.expirationTime=_,R}function r_(a,c,_,T,R){var j=Wi(xt,c,R,_);return j.elementType=a,j.type=a,j.expirationTime=T,j}function Q4(a,c,_,T,R){var j=Wi($e,c,R,_);return j.type=a,j.elementType=a,j.expirationTime=T,j}function J4(a,c,_,T){(typeof a.id!="string"||typeof a.onRender!="function")&&Ke(!1,'Profiler must specify an "id" string and "onRender" function as props');var R=Wi(ze,a,T,c|Jr);return R.elementType=ct,R.type=ct,R.expirationTime=_,R}function Z4(a,c,_,T){var R=Wi(pe,a,T,c);return R.type=nr,R.elementType=nr,R.expirationTime=_,R}function $4(a,c,_,T){var R=Wi(wt,a,T,c);return R.type=un,R.elementType=un,R.expirationTime=_,R}function Cy(a,c,_){var T=Wi(ne,a,null,c);return T.expirationTime=_,T}function eE(){var a=Wi(W,null,null,Sr);return a.elementType="DELETED",a.type="DELETED",a}function tE(a){var c=Wi(rt,null,null,Sr);return c.stateNode=a,c}function xy(a,c,_){var T=a.children!==null?a.children:[],R=Wi(q,T,a.key,c);return R.expirationTime=_,R.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},R}function i_(a,c){return a===null&&(a=Wi(C,null,null,Sr)),a.tag=c.tag,a.key=c.key,a.elementType=c.elementType,a.type=c.type,a.stateNode=c.stateNode,a.return=c.return,a.child=c.child,a.sibling=c.sibling,a.index=c.index,a.ref=c.ref,a.pendingProps=c.pendingProps,a.memoizedProps=c.memoizedProps,a.updateQueue=c.updateQueue,a.memoizedState=c.memoizedState,a.dependencies=c.dependencies,a.mode=c.mode,a.effectTag=c.effectTag,a.nextEffect=c.nextEffect,a.firstEffect=c.firstEffect,a.lastEffect=c.lastEffect,a.expirationTime=c.expirationTime,a.childExpirationTime=c.childExpirationTime,a.alternate=c.alternate,Zt&&(a.actualDuration=c.actualDuration,a.actualStartTime=c.actualStartTime,a.selfBaseDuration=c.selfBaseDuration,a.treeBaseDuration=c.treeBaseDuration),a._debugID=c._debugID,a._debugSource=c._debugSource,a._debugOwner=c._debugOwner,a._debugIsCurrentlyTiming=c._debugIsCurrentlyTiming,a._debugNeedsRemount=c._debugNeedsRemount,a._debugHookTypes=c._debugHookTypes,a}function nE(a,c,_){this.tag=c,this.current=null,this.containerInfo=a,this.pendingChildren=null,this.pingCache=null,this.finishedExpirationTime=lt,this.finishedWork=null,this.timeoutHandle=Jo,this.context=null,this.pendingContext=null,this.hydrate=_,this.callbackNode=null,this.callbackPriority=y0,this.firstPendingTime=lt,this.firstSuspendedTime=lt,this.lastSuspendedTime=lt,this.nextKnownPendingLevel=lt,this.lastPingedTime=lt,this.lastExpiredTime=lt,Ln&&(this.interactionThreadID=k.unstable_getThreadID(),this.memoizedInteractions=new Set,this.pendingInteractionMap=new Map),Ui&&(this.hydrationCallbacks=null)}function rE(a,c,_,T){var R=new nE(a,c,_);Ui&&(R.hydrationCallbacks=T);var j=X4(c);return R.current=j,j.stateNode=R,R}function u_(a,c){var _=a.firstSuspendedTime,T=a.lastSuspendedTime;return _!==lt&&_>=c&&T<=c}function Bf(a,c){var _=a.firstSuspendedTime,T=a.lastSuspendedTime;_<c&&(a.firstSuspendedTime=c),(T>c||_===lt)&&(a.lastSuspendedTime=c),c<=a.lastPingedTime&&(a.lastPingedTime=lt),c<=a.lastExpiredTime&&(a.lastExpiredTime=lt)}function o_(a,c){var _=a.firstPendingTime;c>_&&(a.firstPendingTime=c);var T=a.firstSuspendedTime;T!==lt&&(c>=T?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=lt:c>=a.lastSuspendedTime&&(a.lastSuspendedTime=c+1),c>a.nextKnownPendingLevel&&(a.nextKnownPendingLevel=c))}function iE(a,c,_){a.firstPendingTime=_,c<=a.lastSuspendedTime?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=lt:c<=a.firstSuspendedTime&&(a.firstSuspendedTime=c-1),c<=a.lastPingedTime&&(a.lastPingedTime=lt),c<=a.lastExpiredTime&&(a.lastExpiredTime=lt)}function qp(a,c){var _=a.lastExpiredTime;(_===lt||_>c)&&(a.lastExpiredTime=c)}var uE={debugTool:null},Ov=uE,Ay,Ry;Ay=!1,Ry={};function oE(a){if(!a)return Sn;var c=jt(a),_=El(c);if(c.tag===N){var T=c.type;if(zi(T))return A0(c,T,_)}return _}function Oy(a){var c=jt(a);if(c===void 0)throw typeof a.render=="function"?Error("Unable to find node on an unmounted component."):Error("Argument appears to not be a ReactComponent. Keys: "+Object.keys(a));var _=b0(c);return _===null?null:_.stateNode}function lE(a,c){{var _=jt(a);if(_===void 0)throw typeof a.render=="function"?Error("Unable to find node on an unmounted component."):Error("Argument appears to not be a ReactComponent. Keys: "+Object.keys(a));var T=b0(_);if(T===null)return null;if(T.mode&cr){var R=qt(_.type)||"Component";Ry[R]||(Ry[R]=!0,_.mode&cr?Ke(!1,"%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictLine truncated
|
||||
|
||||
Check the render method of %s.`,qt(Cn.type)||"Unknown"));var Ie=gu(te,V);return Ie.payload={element:a},T=T===void 0?null:T,T!==null&&(typeof T!="function"&&Ke(!1,"render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",T),Ie.callback=T),Ua(R,Ie),dl(R,te),te}function aE(a){var c=a.current;if(!c.child)return null;switch(c.child.tag){case W:return Ro(c.child.stateNode);default:return c.child.stateNode}}function fE(a){switch(a.tag){case U:var c=a.stateNode;c.hydrate&&Zm(c,c.firstPendingTime);break;case pe:xp(function(){return dl(a,bn)});var _=La(Fl());kv(a,_);break}}function s_(a,c){var _=a.memoizedState;_!==null&&_.dehydrated!==null&&_.retryTime<c&&(_.retryTime=c)}function kv(a,c){s_(a,c);var _=a.alternate;_&&s_(_,c)}function cE(a){if(a.tag===pe){var c=La(Fl());dl(a,c),kv(a,c)}}function ky(a){if(a.tag===pe){var c=gd(Fl());dl(a,c),kv(a,c)}}function dE(a){if(a.tag===pe){var c=Fl(),_=Ff(c,a,null);dl(a,_),kv(a,_)}}function pE(a){var c=yl(a);return c===null?null:c.tag===xt?c.stateNode.instance:c.stateNode}var My=function(a){return!1};function a_(a){return My(a)}var f_=null,c_=null,d_=null,p_=null;{var Ny=function(a,c,_,T){if(_>=c.length)return T;var R=c[_],j=Array.isArray(a)?a.slice():f({},a);return j[R]=Ny(a[R],c,_+1,T),j},h_=function(a,c,_){return Ny(a,c,0,_)};f_=function(a,c,_,T){for(var R=a.memoizedState;R!==null&&c>0;)R=R.next,c--;if(R!==null){var j=h_(R.memoizedState,_,T);R.memoizedState=j,R.baseState=j,a.memoizedProps=f({},a.memoizedProps),dl(a,bn)}},c_=function(a,c,_){a.pendingProps=h_(a.memoizedProps,c,_),a.alternate&&(a.alternate.pendingProps=a.pendingProps),dl(a,bn)},d_=function(a){dl(a,bn)},p_=function(a){My=a}}function hE(a){var c=a.findFiberByHostInstance,_=at.ReactCurrentDispatcher;return Rt(f({},a,{overrideHookState:f_,overrideProps:c_,setSuspenseHandler:p_,scheduleUpdate:d_,currentDispatcherRef:_,findHostInstanceByFiber:function(T){var R=b0(T);return R===null?null:R.stateNode},findFiberByHostInstance:function(T){return c?c(T):null},findHostInstancesForRefresh:n2,scheduleRefresh:Sl,scheduleRoot:_s,setRefreshHandler:Ia,getCurrentFiber:function(){return Cn}}))}var v_=Object.freeze({createContainer:sE,updateContainer:l_,batchedEventUpdates:ny,batchedUpdates:ty,unbatchedUpdates:ry,deferredUpdates:$m,syncUpdates:fv,discreteUpdates:cv,flushDiscreteUpdates:av,flushControlled:iy,flushSync:xp,flushPassiveEffects:Xa,IsThisRendererActing:If,getPublicRootInstance:aE,attemptSynchronousHydration:fE,attemptUserBlockingHydration:cE,attemptContinuousHydration:ky,attemptHydrationAtCurrentPriority:dE,findHostInstance:Oy,findHostInstanceWithWarning:lE,findHostInstanceWithNoPortals:pE,shouldSuspend:a_,injectIntoDevTools:hE}),vE=v_.default||v_;hg.exports=vE;var mE=hg.exports;return hg.exports=i,mE})});var D9=ce((zne,cw)=>{"use strict";process.env.NODE_ENV==="production"?cw.exports=m9():cw.exports=E9()});var S9=ce((qne,w9)=>{"use strict";var ZK={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};w9.exports=ZK});var A9=ce((Hne,T9)=>{"use strict";var $K=Object.assign||function(i){for(var o=1;o<arguments.length;o++){var f=arguments[o];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(i[p]=f[p])}return i},v4=function(){function i(o,f){for(var p=0;p<f.length;p++){var E=f[p];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(o,E.key,E)}}return function(o,f,p){return f&&i(o.prototype,f),p&&i(o,p),o}}();function dw(i,o,f){return o in i?Object.defineProperty(i,o,{value:f,enumerable:!0,configurable:!0,writable:!0}):i[o]=f,i}function pw(i,o){if(!(i instanceof o))throw new T
Line truncated
|
||||
`+Module.extraStackTrace()),demangleAll(i)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY<TOTAL_STACK&&Module.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+TOTAL_MEMORY+"! (TOTAL_STACK="+TOTAL_STACK+")"),Module.buffer?buffer=Module.buffer:buffer=new ArrayBuffer(TOTAL_MEMORY),updateGlobalBufferViews();function getTotalMemory(){return TOTAL_MEMORY}if(HEAP32[0]=1668509029,HEAP16[1]=25459,HEAPU8[2]!==115||HEAPU8[3]!==99)throw"Runtime error: expected the system to be little-endian!";Module.HEAP=HEAP,Module.buffer=buffer,Module.HEAP8=HEAP8,Module.HEAP16=HEAP16,Module.HEAP32=HEAP32,Module.HEAPU8=HEAPU8,Module.HEAPU16=HEAPU16,Module.HEAPU32=HEAPU32,Module.HEAPF32=HEAPF32,Module.HEAPF64=HEAPF64;function callRuntimeCallbacks(i){for(;i.length>0;){var o=i.shift();if(typeof o=="function"){o();continue}var f=o.func;typeof f=="number"?o.arg===void 0?Module.dynCall_v(f):Module.dynCall_vi(f,o.arg):f(o.arg===void 0?null:o.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(i){__ATPRERUN__.unshift(i)}Module.addOnPreRun=addOnPreRun;function addOnInit(i){__ATINIT__.unshift(i)}Module.addOnInit=addOnInit;function addOnPreMain(i){__ATMAIN__.unshift(i)}Module.addOnPreMain=addOnPreMain;function addOnExit(i){__ATEXIT__.unshift(i)}Module.addOnExit=addOnExit;function addOnPostRun(i){__ATPOSTRUN__.unshift(i)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(i,o,f){var p=f>0?f:lengthBytesUTF8(i)+1,E=new Array(p),t=stringToUTF8Array(i,E,0,E.length);return o&&(E.length=t),E}Module.intArrayFromString=intArrayFromString;function intArrayToString(i){for(var o=[],f=0;f<i.length;f++){var p=i[f];p>255&&(p&=255),o.push(String.fromCharCode(p))}return o.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(i,o,f){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var p,E;f&&(E=o+lengthBytesUTF8(i),p=HEAP8[E]),stringToUTF8(i,o,Infinity),f&&(HEAP8[E]=p)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(i,o){HEAP8.set(i,o)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(i,o,f){for(var p=0;p<i.length;++p)HEAP8[o++>>0]=i.charCodeAt(p);f||(HEAP8[o>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function(o,f){var p=o>>>16,E=o&65535,t=f>>>16,k=f&65535;return E*k+(p*k+E*t<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(i){return froundBuffer[0]=i,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(i){i=i>>>0;for(var o=0;o<32;o++)if(i&1<<31-o)return o;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.
Line truncated
|
||||
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,f="abort("+i+") at "+stackTrace()+o;throw abortDecorators&&abortDecorators.forEach(function(p){f=p(f,i)}),f}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var eh=ce((Wne,O9)=>{"use strict";var tX=A9(),nX=R9(),hw=!1,vw=null;nX({},function(i,o){if(!hw){if(hw=!0,i)throw i;vw=o}});if(!hw)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");O9.exports=tX(vw.bind,vw.lib)});var M9=ce((Vne,k9)=>{"use strict";k9.exports=({onlyFirst:i=!1}={})=>{let o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(o,i?void 0:"g")}});var mw=ce((Gne,N9)=>{"use strict";var rX=M9();N9.exports=i=>typeof i=="string"?i.replace(rX(),""):i});var gw=ce((Yne,yw)=>{"use strict";var L9=i=>Number.isNaN(i)?!1:i>=4352&&(i<=4447||i===9001||i===9002||11904<=i&&i<=12871&&i!==12351||12880<=i&&i<=19903||19968<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65131||65281<=i&&i<=65376||65504<=i&&i<=65510||110592<=i&&i<=110593||127488<=i&&i<=127569||131072<=i&&i<=262141);yw.exports=L9;yw.exports.default=L9});var b9=ce((Kne,F9)=>{"use strict";F9.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C
Line truncated
|
||||
`))o=Math.max(o,lX(f));return o};Ew.exports=I9;Ew.exports.default=I9});var B9=ce(vg=>{"use strict";var sX=vg&&vg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(vg,"__esModule",{value:!0});var aX=sX(Dw()),ww={};vg.default=i=>{if(i.length===0)return{width:0,height:0};if(ww[i])return ww[i];let o=aX.default(i),f=i.split(`
|
||||
`).length;return ww[i]={width:o,height:f},{width:o,height:f}}});var U9=ce(mg=>{"use strict";var fX=mg&&mg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(mg,"__esModule",{value:!0});var Ii=fX(eh()),cX=(i,o)=>{"position"in o&&i.setPositionType(o.position==="absolute"?Ii.default.POSITION_TYPE_ABSOLUTE:Ii.default.POSITION_TYPE_RELATIVE)},dX=(i,o)=>{"marginLeft"in o&&i.setMargin(Ii.default.EDGE_START,o.marginLeft||0),"marginRight"in o&&i.setMargin(Ii.default.EDGE_END,o.marginRight||0),"marginTop"in o&&i.setMargin(Ii.default.EDGE_TOP,o.marginTop||0),"marginBottom"in o&&i.setMargin(Ii.default.EDGE_BOTTOM,o.marginBottom||0)},pX=(i,o)=>{"paddingLeft"in o&&i.setPadding(Ii.default.EDGE_LEFT,o.paddingLeft||0),"paddingRight"in o&&i.setPadding(Ii.default.EDGE_RIGHT,o.paddingRight||0),"paddingTop"in o&&i.setPadding(Ii.default.EDGE_TOP,o.paddingTop||0),"paddingBottom"in o&&i.setPadding(Ii.default.EDGE_BOTTOM,o.paddingBottom||0)},hX=(i,o)=>{var f;"flexGrow"in o&&i.setFlexGrow((f=o.flexGrow)!==null&&f!==void 0?f:0),"flexShrink"in o&&i.setFlexShrink(typeof o.flexShrink=="number"?o.flexShrink:1),"flexDirection"in o&&(o.flexDirection==="row"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_ROW),o.flexDirection==="row-reverse"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_ROW_REVERSE),o.flexDirection==="column"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_COLUMN),o.flexDirection==="column-reverse"&&i.setFlexDirection(Ii.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in o&&(typeof o.flexBasis=="number"?i.setFlexBasis(o.flexBasis):typeof o.flexBasis=="string"?i.setFlexBasisPercent(Number.parseInt(o.flexBasis,10)):i.setFlexBasis(NaN)),"alignItems"in o&&((o.alignItems==="stretch"||!o.alignItems)&&i.setAlignItems(Ii.default.ALIGN_STRETCH),o.alignItems==="flex-start"&&i.setAlignItems(Ii.default.ALIGN_FLEX_START),o.alignItems==="center"&&i.setAlignItems(Ii.default.ALIGN_CENTER),o.alignItems==="flex-end"&&i.setAlignItems(Ii.default.ALIGN_FLEX_END)),"alignSelf"in o&&((o.alignSelf==="auto"||!o.alignSelf)&&i.setAlignSelf(Ii.default.ALIGN_AUTO),o.alignSelf==="flex-start"&&i.setAlignSelf(Ii.default.ALIGN_FLEX_START),o.alignSelf==="center"&&i.setAlignSelf(Ii.default.ALIGN_CENTER),o.alignSelf==="flex-end"&&i.setAlignSelf(Ii.default.ALIGN_FLEX_END)),"justifyContent"in o&&((o.justifyContent==="flex-start"||!o.justifyContent)&&i.setJustifyContent(Ii.default.JUSTIFY_FLEX_START),o.justifyContent==="center"&&i.setJustifyContent(Ii.default.JUSTIFY_CENTER),o.justifyContent==="flex-end"&&i.setJustifyContent(Ii.default.JUSTIFY_FLEX_END),o.justifyContent==="space-between"&&i.setJustifyContent(Ii.default.JUSTIFY_SPACE_BETWEEN),o.justifyContent==="space-around"&&i.setJustifyContent(Ii.default.JUSTIFY_SPACE_AROUND))},vX=(i,o)=>{var f,p;"width"in o&&(typeof o.width=="number"?i.setWidth(o.width):typeof o.width=="string"?i.setWidthPercent(Number.parseInt(o.width,10)):i.setWidthAuto()),"height"in o&&(typeof o.height=="number"?i.setHeight(o.height):typeof o.height=="string"?i.setHeightPercent(Number.parseInt(o.height,10)):i.setHeightAuto()),"minWidth"in o&&(typeof o.minWidth=="string"?i.setMinWidthPercent(Number.parseInt(o.minWidth,10)):i.setMinWidth((f=o.minWidth)!==null&&f!==void 0?f:0)),"minHeight"in o&&(typeof o.minHeight=="string"?i.setMinHeightPercent(Number.parseInt(o.minHeight,10)):i.setMinHeight((p=o.minHeight)!==null&&p!==void 0?p:0))},mX=(i,o)=>{"display"in o&&i.setDisplay(o.display==="flex"?Ii.default.DISPLAY_FLEX:Ii.default.DISPLAY_NONE)},yX=(i,o)=>{if("borderStyle"in o){let f=typeof o.borderStyle=="string"?1:0;i.setBorder(Ii.default.EDGE_TOP,f),i.setBorder(Ii.default.EDGE_BOTTOM,f),i.setBorder(Ii.default.EDGE_LEFT,f),i.setBorder(Ii.default.EDGE_RIGHT,f)}};mg.default=(i,o={})=>{cX(i,o),dX(i,o),pX(i,o),hX(i,o),vX(i,o),mX(i,o),yX(i,o)}});var z9=ce(($ne,j9)=>{"use strict";j9.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:
Line truncated
|
||||
`);for(let[N,C]of[...p].entries()){if(E+=C,xw.has(C)){let q=parseFloat(/\d[^m]*/.exec(p.slice(N,N+4)));t=q===kX?null:q}let U=OX.codes.get(Number(t));t&&U&&(p[N+1]===`
|
||||
`?E+=eA(U):C===`
|
||||
`&&(E+=eA(t)))}return E};$9.exports=(i,o,f)=>String(i).normalize().replace(/\r\n/g,`
|
||||
`).split(`
|
||||
`).map(p=>LX(p,o,f)).join(`
|
||||
`)});var iA=ce((ure,nA)=>{"use strict";var rA="[\uD800-\uDBFF][\uDC00-\uDFFF]",FX=i=>i&&i.exact?new RegExp(`^${rA}$`):new RegExp(rA,"g");nA.exports=FX});var Rw=ce((ore,uA)=>{"use strict";var bX=gw(),PX=iA(),oA=_4(),lA=["","\x9B"],E4=i=>`${lA[0]}[${i}m`,sA=(i,o,f)=>{let p=[];i=[...i];for(let E of i){let t=E;E.match(";")&&(E=E.split(";")[0][0]+"0");let k=oA.codes.get(parseInt(E,10));if(k){let L=i.indexOf(k.toString());L>=0?i.splice(L,1):p.push(E4(o?k:t))}else if(o){p.push(E4(0));break}else p.push(E4(t))}if(o&&(p=p.filter((E,t)=>p.indexOf(E)===t),f!==void 0)){let E=E4(oA.codes.get(parseInt(f,10)));p=p.reduce((t,k)=>k===E?[k,...t]:[...t,k],[])}return p.join("")};uA.exports=(i,o,f)=>{let p=[...i.normalize()],E=[];f=typeof f=="number"?f:p.length;let t=!1,k,L=0,N="";for(let[C,U]of p.entries()){let q=!1;if(lA.includes(U)){let W=/\d[^m]*/.exec(i.slice(C,C+18));k=W&&W.length>0?W[0]:void 0,L<f&&(t=!0,k!==void 0&&E.push(k))}else t&&U==="m"&&(t=!1,q=!0);if(!t&&!q&&++L,!PX({exact:!0}).test(U)&&bX(U.codePointAt())&&++L,L>o&&L<=f)N+=U;else if(L===o&&!t&&k!==void 0)N=sA(E);else if(L>=f){N+=sA(E,!0,k);break}}return N}});var fA=ce((lre,aA)=>{"use strict";var pd=Rw(),IX=m4();function D4(i,o,f){if(i.charAt(o)===" ")return o;for(let p=1;p<=3;p++)if(f){if(i.charAt(o+p)===" ")return o+p}else if(i.charAt(o-p)===" ")return o-p;return o}aA.exports=(i,o,f)=>{f=E0({position:"end",preferTruncationOnSpace:!1},f);let{position:p,space:E,preferTruncationOnSpace:t}=f,k="\u2026",L=1;if(typeof i!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof i}`);if(typeof o!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof o}`);if(o<1)return"";if(o===1)return k;let N=IX(i);if(N<=o)return i;if(p==="start"){if(t){let C=D4(i,N-o+1,!0);return k+pd(i,C,N).trim()}return E===!0&&(k+=" ",L=2),k+pd(i,N-o+L,N)}if(p==="middle"){E===!0&&(k=" "+k+" ",L=3);let C=Math.floor(o/2);if(t){let U=D4(i,C),q=D4(i,N-(o-C)+1,!0);return pd(i,0,U)+k+pd(i,q,N).trim()}return pd(i,0,C)+k+pd(i,N-(o-C)+L,N)}if(p==="end"){if(t){let C=D4(i,o-1);return pd(i,0,C)+k}return E===!0&&(k=" "+k,L=2),pd(i,0,o-L)+k}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${p}`)}});var kw=ce(_g=>{"use strict";var cA=_g&&_g.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(_g,"__esModule",{value:!0});var BX=cA(tA()),UX=cA(fA()),Ow={};_g.default=(i,o,f)=>{let p=i+String(o)+String(f);if(Ow[p])return Ow[p];let E=i;if(f==="wrap"&&(E=BX.default(i,o,{trim:!1,hard:!0})),f.startsWith("truncate")){let t="end";f==="truncate-middle"&&(t="middle"),f==="truncate-start"&&(t="start"),E=UX.default(i,o,{position:t})}return Ow[p]=E,E}});var Nw=ce(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});var dA=i=>{let o="";if(i.childNodes.length>0)for(let f of i.childNodes){let p="";f.nodeName==="#text"?p=f.nodeValue:((f.nodeName==="ink-text"||f.nodeName==="ink-virtual-text")&&(p=dA(f)),p.length>0&&typeof f.internal_transform=="function"&&(p=f.internal_transform(p))),o+=p}return o};Mw.default=dA});var Lw=ce(l0=>{"use strict";var Eg=l0&&l0.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(l0,"__esModule",{value:!0});l0.setTextNodeValue=l0.createTextNode=l0.setStyle=l0.setAttribute=l0.removeChildNode=l0.insertBeforeNode=l0.appendChildNode=l0.createNode=l0.TEXT_NAME=void 0;var jX=Eg(eh()),pA=Eg(B9()),zX=Eg(U9()),qX=Eg(kw()),HX=Eg(Nw());l0.TEXT_NAME="#text";l0.createNode=i=>{var o;let f={nodeName:i,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:i==="ink-virtual-text"?void 0:jX.default.Node.create()};return i==="ink-text"&&((o=f.yogaNode)===null||o===void 0||o.setMeasureFunc(WX.bind(null,f))),f};l0.appendChildNode=(i,o)=>{var f;o.parentNode&&l0.removeChildNode(o.parentNode,o),o.parentNode=i,i.childNodes.push(o),o.yogaNode&&((f=i.yogaNode)===null||f===void 0||f.insertChild(o.yogaNode,i.yogaNode.getChildCount())),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.insertBeforeNode=(i,o,f)=>{var p,E;o.parentNode&&l0.removeChildNode(o.parentNode,o),o.parentNode=i;let t=i.childNodes.indexOf(f);if(t>=0){i.childNodes.splice(t,0,o),o.yogaNode&&((p=i.yogaNode)===null||p===void 0||p.insertChild(o.yogaNode,t));return}i.childNodes.push(o),o.yogaNode&&((E=i.yogaNode)===null||E===void 0||E.insertChild(o.yogaNode,i.yogaNode.getChildCount())),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.removeChildNode=(i,o)=>{var f,p;o.yogaNode&&((p=(f=o.parentNode)===null||f===void 0?void 0:f.yogaNode)===null||p===void 0||p.removeChild(o.yogaNode)),o.parentNode=null;let E=i.childNodes.indexOf(o);E>=0&&i.childNodes.splice(E,1),(i.nodeName==="ink-text"||i.nodeName==="ink-virtual-text")&&w4(i)};l0.setAttribute=(i,o,f)=>{i.attributes[o]=f};l0.setStyle=(i,o)=>{i.style=o,i.yogaNode&&zX.default(i.yogaNode,o)};l0.createTextNode=i=>{let o={nodeName:"#text",nodeValue:i,yogaNode:void 0,parentNode:null,style:{}};return l0Line truncated
|
||||
`).join(`\r
|
||||
`)),E.removeListener("error",Qw),C.setSocket(E,t,this.options.maxPayload),this.clients&&(this.clients.add(C),C.on("close",()=>this.clients.delete(C))),k(C,p)}};sR.exports=aR;function KQ(i,o){for(let f of Object.keys(o))i.on(f,o[f]);return function(){for(let p of Object.keys(o))i.removeListener(p,o[p])}}function XQ(i){i.emit("close")}function Qw(){this.destroy()}function A4(i,o,f,p){i.writable&&(f=f||Xw[o],p=E0({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(f)},p),i.write(`HTTP/1.1 ${o} ${Xw[o]}\r
|
||||
`+Object.keys(p).map(E=>`${E}: ${p[E]}`).join(`\r
|
||||
`)+`\r
|
||||
\r
|
||||
`+f)),i.removeListener("error",Qw),i.destroy()}function QQ(i){return i.trim()}});var dR=ce((Sre,cR)=>{"use strict";var Rg=Kw();Rg.createWebSocketStream=lR();Rg.Server=fR();Rg.Receiver=zw();Rg.Sender=qw();cR.exports=Rg});var pR=ce(R4=>{"use strict";var JQ=R4&&R4.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(R4,"__esModule",{value:!0});var ZQ=JQ(dR()),Og=global;Og.WebSocket||(Og.WebSocket=ZQ.default);Og.window||(Og.window=global);Og.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}]});var hR=ce((O4,Jw)=>{(function(i,o){typeof O4=="object"&&typeof Jw=="object"?Jw.exports=o():typeof define=="function"&&define.amd?define([],o):typeof O4=="object"?O4.ReactDevToolsBackend=o():i.ReactDevToolsBackend=o()})(window,function(){return function(i){var o={};function f(p){if(o[p])return o[p].exports;var E=o[p]={i:p,l:!1,exports:{}};return i[p].call(E.exports,E,E.exports,f),E.l=!0,E.exports}return f.m=i,f.c=o,f.d=function(p,E,t){f.o(p,E)||Object.defineProperty(p,E,{enumerable:!0,get:t})},f.r=function(p){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},f.t=function(p,E){if(1&E&&(p=f(p)),8&E||4&E&&typeof p=="object"&&p&&p.__esModule)return p;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:p}),2&E&&typeof p!="string")for(var k in p)f.d(t,k,function(L){return p[L]}.bind(null,k));return t},f.n=function(p){var E=p&&p.__esModule?function(){return p.default}:function(){return p};return f.d(E,"a",E),E},f.o=function(p,E){return Object.prototype.hasOwnProperty.call(p,E)},f.p="",f(f.s=20)}([function(i,o,f){"use strict";i.exports=f(12)},function(i,o,f){"use strict";var p=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function k(L){if(L==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(L)}i.exports=function(){try{if(!Object.assign)return!1;var L=new String("abc");if(L[5]="de",Object.getOwnPropertyNames(L)[0]==="5")return!1;for(var N={},C=0;C<10;C++)N["_"+String.fromCharCode(C)]=C;if(Object.getOwnPropertyNames(N).map(function(q){return N[q]}).join("")!=="0123456789")return!1;var U={};return"abcdefghijklmnopqrst".split("").forEach(function(q){U[q]=q}),Object.keys(Object.assign({},U)).join("")==="abcdefghijklmnopqrst"}catch(q){return!1}}()?Object.assign:function(L,N){for(var C,U,q=k(L),W=1;W<arguments.length;W++){for(var ne in C=Object(arguments[W]))E.call(C,ne)&&(q[ne]=C[ne]);if(p){U=p(C);for(var m=0;m<U.length;m++)t.call(C,U[m])&&(q[U[m]]=C[U[m]])}}return q}},function(i,o,f){(function(p){function E(Oe){return(E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(le){return typeof le}:function(le){return le&&typeof Symbol=="function"&&le.constructor===Symbol&&le!==Symbol.prototype?"symbol":typeof le})(Oe)}var t=/^\s+|\s+$/g,k=/^[-+]0x[0-9a-f]+$/i,L=/^0b[01]+$/i,N=/^0o[0-7]+$/i,C=parseInt,U=(p===void 0?"undefined":E(p))=="object"&&p&&p.Object===Object&&p,q=(typeof self=="undefined"?"undefined":E(self))=="object"&&self&&self.Object===Object&&self,W=U||q||Function("return this")(),ne=Object.prototype.toString,m=Math.max,we=Math.min,Se=function(){return W.Date.now()};function he(Oe,le,Ue){var Ge,rt,wt,xt,$e,ft,Ke=0,jt=!1,$t=!1,at=!0;if(typeof Oe!="function")throw new TypeError("Expected a function");function Q(At){var en=Ge,ln=rt;return Ge=rt=void 0,Ke=At,xt=Oe.apply(ln,en)}function ae(At){return Ke=At,$e=setTimeout(ue,le),jt?Q(At):xt}function Ce(At){var en=At-ft;return ft===void 0||en>=le||en<0||$t&&At-Ke>=wt}function ue(){var At=Se();if(Ce(At))return je(At);$e=setTimeout(ue,function(en){var ln=le-(en-ft);return $t?we(ln,wt-(en-Ke)):ln}(At))}function je(At){return $e=void 0,at&&Ge?Q(At):(Ge=rt=void 0,xt)}function ct(){var At=Se(),en=Ce(At);if(Ge=arguments,rt=this,ft=At,en){if($e===void 0)return ae(ft);if($t)return $e=setTimeout(ue,le),Q(ft)}return $e===void 0&&($e=setTimeout(ue,le)),xt}return le=pe(le)||0,ge(Ue)&&(jt=!!Ue.leading,wt=($t="maxWait"in Ue)?m(pe(Ue.maxWait)||0,le):wt,at="trailing"in Ue?!!Ue.trailing:at),ct.cancel=function(){$e!==void 0&&clearTimeout($e),Ke=0,Ge=ft=rt=$e=void 0},ct.flush=function(){return $e===void 0?xt:je(Se())},ct}function ge(Oe){var le=E(Oe);return!!Oe&&(le=="object"||le=="function")}function ze(Oe){return E(Oe)=="symbol"||function(le){return!!le&&E(le)=="object"}(Oe)&&ne.call(Oe)=="[object Symbol]"}function pe(Oe){if(typeof Oe=="number")return Oe;if(ze(Oe))return NaN;if(ge(Oe)){var le=typeof Oe.valueOf=="function"?Oe.va
Line truncated
|
||||
/**
|
||||
* IMPORTANT: When new theme variables are added below\u2013 also add them to SettingsContext updateThemeVariables()
|
||||
*/
|
||||
|
||||
/* Light theme */
|
||||
--light-color-attribute-name: #ef6632;
|
||||
--light-color-attribute-name-not-editable: #23272f;
|
||||
--light-color-attribute-name-inverted: rgba(255, 255, 255, 0.7);
|
||||
--light-color-attribute-value: #1a1aa6;
|
||||
--light-color-attribute-value-inverted: #ffffff;
|
||||
--light-color-attribute-editable-value: #1a1aa6;
|
||||
--light-color-background: #ffffff;
|
||||
--light-color-background-hover: rgba(0, 136, 250, 0.1);
|
||||
--light-color-background-inactive: #e5e5e5;
|
||||
--light-color-background-invalid: #fff0f0;
|
||||
--light-color-background-selected: #0088fa;
|
||||
--light-color-button-background: #ffffff;
|
||||
--light-color-button-background-focus: #ededed;
|
||||
--light-color-button: #5f6673;
|
||||
--light-color-button-disabled: #cfd1d5;
|
||||
--light-color-button-active: #0088fa;
|
||||
--light-color-button-focus: #23272f;
|
||||
--light-color-button-hover: #23272f;
|
||||
--light-color-border: #eeeeee;
|
||||
--light-color-commit-did-not-render-fill: #cfd1d5;
|
||||
--light-color-commit-did-not-render-fill-text: #000000;
|
||||
--light-color-commit-did-not-render-pattern: #cfd1d5;
|
||||
--light-color-commit-did-not-render-pattern-text: #333333;
|
||||
--light-color-commit-gradient-0: #37afa9;
|
||||
--light-color-commit-gradient-1: #63b19e;
|
||||
--light-color-commit-gradient-2: #80b393;
|
||||
--light-color-commit-gradient-3: #97b488;
|
||||
--light-color-commit-gradient-4: #abb67d;
|
||||
--light-color-commit-gradient-5: #beb771;
|
||||
--light-color-commit-gradient-6: #cfb965;
|
||||
--light-color-commit-gradient-7: #dfba57;
|
||||
--light-color-commit-gradient-8: #efbb49;
|
||||
--light-color-commit-gradient-9: #febc38;
|
||||
--light-color-commit-gradient-text: #000000;
|
||||
--light-color-component-name: #6a51b2;
|
||||
--light-color-component-name-inverted: #ffffff;
|
||||
--light-color-component-badge-background: rgba(0, 0, 0, 0.1);
|
||||
--light-color-component-badge-background-inverted: rgba(255, 255, 255, 0.25);
|
||||
--light-color-component-badge-count: #777d88;
|
||||
--light-color-component-badge-count-inverted: rgba(255, 255, 255, 0.7);
|
||||
--light-color-context-background: rgba(0,0,0,.9);
|
||||
--light-color-context-background-hover: rgba(255, 255, 255, 0.1);
|
||||
--light-color-context-background-selected: #178fb9;
|
||||
--light-color-context-border: #3d424a;
|
||||
--light-color-context-text: #ffffff;
|
||||
--light-color-context-text-selected: #ffffff;
|
||||
--light-color-dim: #777d88;
|
||||
--light-color-dimmer: #cfd1d5;
|
||||
--light-color-dimmest: #eff0f1;
|
||||
--light-color-error-background: hsl(0, 100%, 97%);
|
||||
--light-color-error-border: hsl(0, 100%, 92%);
|
||||
--light-color-error-text: #ff0000;
|
||||
--light-color-expand-collapse-toggle: #777d88;
|
||||
--light-color-link: #0000ff;
|
||||
--light-color-modal-background: rgba(255, 255, 255, 0.75);
|
||||
--light-color-record-active: #fc3a4b;
|
||||
--light-color-record-hover: #3578e5;
|
||||
--light-color-record-inactive: #0088fa;
|
||||
--light-color-scroll-thumb: #c2c2c2;
|
||||
--light-color-scroll-track: #fafafa;
|
||||
--light-color-search-match: yellow;
|
||||
--light-color-search-match-current: #f7923b;
|
||||
--light-color-selected-tree-highlight-active: rgba(0, 136, 250, 0.1);
|
||||
--light-color-selected-tree-highlight-inactive: rgba(0, 0, 0, 0.05);
|
||||
--light-color-shadow: rgba(0, 0, 0, 0.25);
|
||||
--light-color-tab-selected-border: #0088fa;
|
||||
--light-color-text: #000000;
|
||||
--light-color-text-invalid: #ff0000;
|
||||
--light-color-text-selected: #ffffff;
|
||||
--light-color-toggle-background-invalid: #fc3a4b;
|
||||
--light-color-toggle-background-on: #0088fa;
|
||||
--light-color-toggle-background-off: #cfd1d5;
|
||||
--light-color-toggle-text: #ffffff;
|
||||
--light-color-tooltip-background: rgba(0, 0, 0, 0.9);
|
||||
--light-color-tooltip-text: #ffffff;
|
||||
|
||||
/* Dark theme */
|
||||
--dark-color-attribute-name: #9d87d2;
|
||||
--dark-color-attribute-name-not-editable: #ededed;
|
||||
--dark-color-attribute-name-inverted: #282828;
|
||||
--dark-color-attribute-value: #cedae0;
|
||||
--dark-color-attribute-value-inverted: #ffffff;
|
||||
--dark-color-attribute-editable-value: yellow;
|
||||
--dark-color-background: #282c34;
|
||||
--dark-color-background-hover: rgba(255, 255, 255, 0.1);
|
||||
--dark-color-background-inactive: #3d424a;
|
||||
--dark-color-background-invalid: #5c0000;
|
||||
--dark-color-background-selected: #178fb9;
|
||||
--dark-color-button-background: #282c34;
|
||||
--dark-color-button-background-focus: #3d424a;
|
||||
--dark-color-button: #afb3b9;
|
||||
--dark-color-button-active: #61dafb;
|
||||
--dark-color-button-disabled: #4f5766;
|
||||
--dark-color-button-focus: #a2e9fc;
|
||||
--dark-color-button-hover: #ededed;
|
||||
--dark-color-border: #3d424a;
|
||||
--dark-color-commit-did-not-render-fill: #777d88;
|
||||
--dark-color-commit-did-not-render-fill-text: #000000;
|
||||
--dark-color-commit-did-not-render-pattern: #666c77;
|
||||
--dark-color-commit-did-not-render-pattern-text: #ffffff;
|
||||
--dark-color-commit-gradient-0: #37afa9;
|
||||
--dark-color-commit-gradient-1: #63b19e;
|
||||
--dark-color-commit-gradient-2: #80b393;
|
||||
--dark-color-commit-gradient-3: #97b488;
|
||||
--dark-color-commit-gradient-4: #abb67d;
|
||||
--dark-color-commit-gradient-5: #beb771;
|
||||
--dark-color-commit-gradient-6: #cfb965;
|
||||
--dark-color-commit-gradient-7: #dfba57;
|
||||
--dark-color-commit-gradient-8: #efbb49;
|
||||
--dark-color-commit-gradient-9: #febc38;
|
||||
--dark-color-commit-gradient-text: #000000;
|
||||
--dark-color-component-name: #61dafb;
|
||||
--dark-color-component-name-inverted: #282828;
|
||||
--dark-color-component-badge-background: rgba(255, 255, 255, 0.25);
|
||||
--dark-color-component-badge-background-inverted: rgba(0, 0, 0, 0.25);
|
||||
--dark-color-component-badge-count: #8f949d;
|
||||
--dark-color-component-badge-count-inverted: rgba(255, 255, 255, 0.7);
|
||||
--dark-color-context-background: rgba(255,255,255,.9);
|
||||
--dark-color-context-background-hover: rgba(0, 136, 250, 0.1);
|
||||
--dark-color-context-background-selected: #0088fa;
|
||||
--dark-color-context-border: #eeeeee;
|
||||
--dark-color-context-text: #000000;
|
||||
--dark-color-context-text-selected: #ffffff;
|
||||
--dark-color-dim: #8f949d;
|
||||
--dark-color-dimmer: #777d88;
|
||||
--dark-color-dimmest: #4f5766;
|
||||
--dark-color-error-background: #200;
|
||||
--dark-color-error-border: #900;
|
||||
--dark-color-error-text: #f55;
|
||||
--dark-color-expand-collapse-toggle: #8f949d;
|
||||
--dark-color-link: #61dafb;
|
||||
--dark-color-modal-background: rgba(0, 0, 0, 0.75);
|
||||
--dark-color-record-active: #fc3a4b;
|
||||
--dark-color-record-hover: #a2e9fc;
|
||||
--dark-color-record-inactive: #61dafb;
|
||||
--dark-color-scroll-thumb: #afb3b9;
|
||||
--dark-color-scroll-track: #313640;
|
||||
--dark-color-search-match: yellow;
|
||||
--dark-color-search-match-current: #f7923b;
|
||||
--dark-color-selected-tree-highlight-active: rgba(23, 143, 185, 0.15);
|
||||
--dark-color-selected-tree-highlight-inactive: rgba(255, 255, 255, 0.05);
|
||||
--dark-color-shadow: rgba(0, 0, 0, 0.5);
|
||||
--dark-color-tab-selected-border: #178fb9;
|
||||
--dark-color-text: #ffffff;
|
||||
--dark-color-text-invalid: #ff8080;
|
||||
--dark-color-text-selected: #ffffff;
|
||||
--dark-color-toggle-background-invalid: #fc3a4b;
|
||||
--dark-color-toggle-background-on: #178fb9;
|
||||
--dark-color-toggle-background-off: #777d88;
|
||||
--dark-color-toggle-text: #ffffff;
|
||||
--dark-color-tooltip-background: rgba(255, 255, 255, 0.9);
|
||||
--dark-color-tooltip-text: #000000;
|
||||
|
||||
/* Font smoothing */
|
||||
--light-font-smoothing: auto;
|
||||
--dark-font-smoothing: antialiased;
|
||||
--font-smoothing: auto;
|
||||
|
||||
/* Compact density */
|
||||
--compact-font-size-monospace-small: 9px;
|
||||
--compact-font-size-monospace-normal: 11px;
|
||||
--compact-font-size-monospace-large: 15px;
|
||||
--compact-font-size-sans-small: 10px;
|
||||
--compact-font-size-sans-normal: 12px;
|
||||
--compact-font-size-sans-large: 14px;
|
||||
--compact-line-height-data: 18px;
|
||||
--compact-root-font-size: 16px;
|
||||
|
||||
/* Comfortable density */
|
||||
--comfortable-font-size-monospace-small: 10px;
|
||||
--comfortable-font-size-monospace-normal: 13px;
|
||||
--comfortable-font-size-monospace-large: 17px;
|
||||
--comfortable-font-size-sans-small: 12px;
|
||||
--comfortable-font-size-sans-normal: 14px;
|
||||
--comfortable-font-size-sans-large: 16px;
|
||||
--comfortable-line-height-data: 22px;
|
||||
--comfortable-root-font-size: 20px;
|
||||
|
||||
/* GitHub.com system fonts */
|
||||
--font-family-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo,
|
||||
Courier, monospace;
|
||||
--font-family-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica,
|
||||
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
||||
|
||||
/* Constant values shared between JS and CSS */
|
||||
--interaction-commit-size: 10px;
|
||||
--interaction-label-width: 200px;
|
||||
}
|
||||
`},function(i,o,f){"use strict";function p(N){var C=this;if(C instanceof p||(C=new p),C.tail=null,C.head=null,C.length=0,N&&typeof N.forEach=="function")N.forEach(function(W){C.push(W)});else if(arguments.length>0)for(var U=0,q=arguments.length;U<q;U++)C.push(arguments[U]);return C}function E(N,C,U){var q=C===N.head?new L(U,null,C,N):new L(U,C,C.next,N);return q.next===null&&(N.tail=q),q.prev===null&&(N.head=q),N.length++,q}function t(N,C){N.tail=new L(C,N.tail,null,N),N.head||(N.head=N.tail),N.length++}function k(N,C){N.head=new L(C,null,N.head,N),N.tail||(N.tail=N.head),N.length++}function L(N,C,U,q){if(!(this instanceof L))return new L(N,C,U,q);this.list=q,this.value=N,C?(C.next=this,this.prev=C):this.prev=null,U?(U.prev=this,this.next=U):this.next=null}i.exports=p,p.Node=L,p.create=p,p.prototype.removeNode=function(N){if(N.list!==this)throw new Error("removing node which does not belong to this list");var C=N.next,U=N.prev;return C&&(C.prev=U),U&&(U.next=C),N===this.head&&(this.head=C),N===this.tail&&(this.tail=U),N.list.length--,N.next=null,N.prev=null,N.list=null,C},p.prototype.unshiftNode=function(N){if(N!==this.head){N.list&&N.list.removeNode(N);var C=this.head;N.list=this,N.next=C,C&&(C.prev=N),this.head=N,this.tail||(this.tail=N),this.length++}},p.prototype.pushNode=function(N){if(N!==this.tail){N.list&&N.list.removeNode(N);var C=this.tail;N.list=this,N.prev=C,C&&(C.next=N),this.tail=N,this.head||(this.head=N),this.length++}},p.prototype.push=function(){for(var N=0,C=arguments.length;N<C;N++)t(this,arguments[N]);return this.length},p.prototype.unshift=function(){for(var N=0,C=arguments.length;N<C;N++)k(this,arguments[N]);return this.length},p.prototype.pop=function(){if(this.tail){var N=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,N}},p.prototype.shift=function(){if(this.head){var N=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,N}},p.prototype.forEach=function(N,C){C=C||this;for(var U=this.head,q=0;U!==null;q++)N.call(C,U.value,q,this),U=U.next},p.prototype.forEachReverse=function(N,C){C=C||this;for(var U=this.tail,q=this.length-1;U!==null;q--)N.call(C,U.value,q,this),U=U.prev},p.prototype.get=function(N){for(var C=0,U=this.head;U!==null&&C<N;C++)U=U.next;if(C===N&&U!==null)return U.value},p.prototype.getReverse=function(N){for(var C=0,U=this.tail;U!==null&&C<N;C++)U=U.prev;if(C===N&&U!==null)return U.value},p.prototype.map=function(N,C){C=C||this;for(var U=new p,q=this.head;q!==null;)U.push(N.call(C,q.value,this)),q=q.next;return U},p.prototype.mapReverse=function(N,C){C=C||this;for(var U=new p,q=this.tail;q!==null;)U.push(N.call(C,q.value,this)),q=q.prev;return U},p.prototype.reduce=function(N,C){var U,q=this.head;if(arguments.length>1)U=C;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");q=this.head.next,U=this.head.value}for(var W=0;q!==null;W++)U=N(U,q.value,W),q=q.next;return U},p.prototype.reduceReverse=function(N,C){var U,q=this.tail;if(arguments.length>1)U=C;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");q=this.tail.prev,U=this.tail.value}for(var W=this.length-1;q!==null;W--)U=N(U,q.value,W),q=q.prev;return U},p.prototype.toArray=function(){for(var N=new Array(this.length),C=0,U=this.head;U!==null;C++)N[C]=U.value,U=U.next;return N},p.prototype.toArrayReverse=function(){for(var N=new Array(this.length),C=0,U=this.tail;U!==null;C++)N[C]=U.value,U=U.prev;return N},p.prototype.slice=function(N,C){(C=C||this.length)<0&&(C+=this.length),(N=N||0)<0&&(N+=this.length);var U=new p;if(C<N||C<0)return U;N<0&&(N=0),C>this.length&&(C=this.length);for(var q=0,W=this.head;W!==null&&q<N;q++)W=W.next;for(;W!==null&&q<C;q++,W=W.next)U.push(W.value);return U},p.prototype.sliceReverse=function(N,C){(C=C||this.length)<0&&(C+=this.length),(N=N||0)<0&&(N+=this.length);var U=new p;if(C<N||C<0)return U;N<0&&(N=0),C>this.length&&(C=this.length);for(var q=this.length,W=this.tail;W!==null&&q>C;q--)W=W.prev;for(;W!==null&&q>N;q--,W=W.prev)U.push(W.value);return U},p.prototype.splice=function(N,C){N>this.length&&(N=this.length-1),N<0&&(N=this.length+N);for(var U=0,q=this.head;q!==null&&U<N;U++)q=q.next;var W=[];for(U=0;q&&U<C;U++)W.push(q.value),q=this.removeNode(q);for(q===null&&(q=this.tail),q!==this.head&&q!==this.tail&&(q=q.prev),U=2;U<arguments.length;U++)q=E(this,q,arguments[U]);return W},p.prototype.reverse=function(){for(var N=this.head,C=this.tail,U=N;U!==null;U=U.prev){var q=U.prev;U.prev=U.next,U.next=q}return this.head=C,this.tail=N,this};try{f(11)(p)}catch(N){}},function(i,o,f){"use strict";i.exports=function(p){p.prototype[Symbol.iterator]=regeneratorRuntime.mark(function E(){var t;return regeneratorRuntime.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:t=this.head;case 1:if(!t){k.next=7;break}return k.next=4,t.value;case 4:t=t.next,k.next=1;break;case 7:case"end":return k.stop()}},E,this)})}},function(i,
Line truncated
|
||||
`).filter(function(ne){return!!ne.match(U)},this).map(function(ne){ne.indexOf("(eval ")>-1&&(ne=ne.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var m=ne.replace(/^\s+/,"").replace(/\(eval code/g,"("),we=m.match(/ (\((.+):(\d+):(\d+)\)$)/),Se=(m=we?m.replace(we[0],""):m).split(/\s+/).slice(1),he=this.extractLocation(we?we[1]:Se.pop()),ge=Se.join(" ")||void 0,ze=["eval","<anonymous>"].indexOf(he[0])>-1?void 0:he[0];return new N({functionName:ge,fileName:ze,lineNumber:he[1],columnNumber:he[2],source:ne})},this)},parseFFOrSafari:function(W){return W.stack.split(`
|
||||
`).filter(function(ne){return!ne.match(q)},this).map(function(ne){if(ne.indexOf(" > eval")>-1&&(ne=ne.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),ne.indexOf("@")===-1&&ne.indexOf(":")===-1)return new N({functionName:ne});var m=/((.*".+"[^@]*)?[^@]*)(?:@)/,we=ne.match(m),Se=we&&we[1]?we[1]:void 0,he=this.extractLocation(ne.replace(m,""));return new N({functionName:Se,fileName:he[0],lineNumber:he[1],columnNumber:he[2],source:ne})},this)},parseOpera:function(W){return!W.stacktrace||W.message.indexOf(`
|
||||
`)>-1&&W.message.split(`
|
||||
`).length>W.stacktrace.split(`
|
||||
`).length?this.parseOpera9(W):W.stack?this.parseOpera11(W):this.parseOpera10(W)},parseOpera9:function(W){for(var ne=/Line (\d+).*script (?:in )?(\S+)/i,m=W.message.split(`
|
||||
`),we=[],Se=2,he=m.length;Se<he;Se+=2){var ge=ne.exec(m[Se]);ge&&we.push(new N({fileName:ge[2],lineNumber:ge[1],source:m[Se]}))}return we},parseOpera10:function(W){for(var ne=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,m=W.stacktrace.split(`
|
||||
`),we=[],Se=0,he=m.length;Se<he;Se+=2){var ge=ne.exec(m[Se]);ge&&we.push(new N({functionName:ge[3]||void 0,fileName:ge[2],lineNumber:ge[1],source:m[Se]}))}return we},parseOpera11:function(W){return W.stack.split(`
|
||||
`).filter(function(ne){return!!ne.match(C)&&!ne.match(/^Error created at/)},this).map(function(ne){var m,we=ne.split("@"),Se=this.extractLocation(we.pop()),he=we.shift()||"",ge=he.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;he.match(/\(([^)]*)\)/)&&(m=he.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var ze=m===void 0||m==="[arguments not available]"?void 0:m.split(",");return new N({functionName:ge,args:ze,fileName:Se[0],lineNumber:Se[1],columnNumber:Se[2],source:ne})},this)}}})=="function"?p.apply(o,E):p)===void 0||(i.exports=t)})()},function(i,o,f){var p,E,t;(function(k,L){"use strict";E=[],(t=typeof(p=function(){function N(ge){return ge.charAt(0).toUpperCase()+ge.substring(1)}function C(ge){return function(){return this[ge]}}var U=["isConstructor","isEval","isNative","isToplevel"],q=["columnNumber","lineNumber"],W=["fileName","functionName","source"],ne=U.concat(q,W,["args"]);function m(ge){if(ge)for(var ze=0;ze<ne.length;ze++)ge[ne[ze]]!==void 0&&this["set"+N(ne[ze])](ge[ne[ze]])}m.prototype={getArgs:function(){return this.args},setArgs:function(ge){if(Object.prototype.toString.call(ge)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=ge},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(ge){if(ge instanceof m)this.evalOrigin=ge;else{if(!(ge instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new m(ge)}},toString:function(){var ge=this.getFileName()||"",ze=this.getLineNumber()||"",pe=this.getColumnNumber()||"",Oe=this.getFunctionName()||"";return this.getIsEval()?ge?"[eval] ("+ge+":"+ze+":"+pe+")":"[eval]:"+ze+":"+pe:Oe?Oe+" ("+ge+":"+ze+":"+pe+")":ge+":"+ze+":"+pe}},m.fromString=function(ge){var ze=ge.indexOf("("),pe=ge.lastIndexOf(")"),Oe=ge.substring(0,ze),le=ge.substring(ze+1,pe).split(","),Ue=ge.substring(pe+1);if(Ue.indexOf("@")===0)var Ge=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(Ue,""),rt=Ge[1],wt=Ge[2],xt=Ge[3];return new m({functionName:Oe,args:le||void 0,fileName:rt,lineNumber:wt||void 0,columnNumber:xt||void 0})};for(var we=0;we<U.length;we++)m.prototype["get"+N(U[we])]=C(U[we]),m.prototype["set"+N(U[we])]=function(ge){return function(ze){this[ge]=Boolean(ze)}}(U[we]);for(var Se=0;Se<q.length;Se++)m.prototype["get"+N(q[Se])]=C(q[Se]),m.prototype["set"+N(q[Se])]=function(ge){return function(ze){if(pe=ze,isNaN(parseFloat(pe))||!isFinite(pe))throw new TypeError(ge+" must be a Number");var pe;this[ge]=Number(ze)}}(q[Se]);for(var he=0;he<W.length;he++)m.prototype["get"+N(W[he])]=C(W[he]),m.prototype["set"+N(W[he])]=function(ge){return function(ze){this[ge]=String(ze)}}(W[he]);return m})=="function"?p.apply(o,E):p)===void 0||(i.exports=t)})()},function(i,o,f){"use strict";i.exports=f(19)},function(i,o,f){"use strict";function p(ue){return(p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(je){return typeof je}:function(je){return je&&typeof Symbol=="function"&&je.constructor===Symbol&&je!==Symbol.prototype?"symbol":typeof je})(ue)}var E=f(1),t=60103,k=60106;o.Fragment=60107,o.StrictMode=60108,o.Profiler=60114;var L=60109,N=60110,C=60112;o.Suspense=60113,o.unstable_SuspenseList=60120;var U=60115,q=60116,W=60121;if(o.unstable_DebugTracingMode=60129,o.unstable_LegacyHidden=60131,typeof Symbol=="function"&&Symbol.for){var ne=Symbol.for;t=ne("react.element"),k=ne("react.portal"),o.Fragment=ne("react.fragment"),o.StrictMode=ne("react.strict_mode"),o.Profiler=ne("react.profiler"),L=ne("react.provider"),N=ne("react.context"),C=ne("react.forward_ref"),o.Suspense=ne("react.suspense"),o.unstable_SuspenseList=ne("react.suspense_list"),U=ne("react.memo"),q=ne("react.lazy"),W=ne("react.block"),o.unstable_DebugTracingMode=ne("react.debug_trace_mode"),o.unstable_LegacyHidden=ne("react.legacy_hidden")}var m=typeof Symbol=="function"&&Symbol.iterator;function we(ue){for(var je="https://reactjs.org/docs/error-decoder.html?invariant="+ue,ct=1;ct<arguments.length;ct++)je+="&args[]="+encodeURIComponent(arguments[ct]);return"Minified React error #"+ue+"; visit "+je+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Se={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},he={};function ge(ue,je,ct){this.props=ue,this.context=je,this.refs=he,this.updater=ct||Se}function ze(){}function pe(ue,je,ct){this.props=ue,this.context=je,this.refs=he,this.updater=ct||Se}ge.prototype.isReactComponent={},ge.prototype.setState=function(ue,je){if(p(ue)!=="object"&&typeof ue!="function"&&ue!=null)throw Error(we(85));this.updater.enqueueSetState(this,ue,je,"setState")},ge.prototype.forceUpdate=function(ue){this.updater.enqueueForceUpdate(this,ue,"forceUpdate")},ze.prototype=ge.prototype;var Oe=pe.prototype=new ze;Oe.constructor=pe,E(Oe,ge.prototype),Oe.isPureReactComponent=!0;var le={current:null},Ue=Object.prototype.hasOwnProperty,Ge={key:!0,ref:!0,__self:!0,__sou
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function le(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G<z;G++)$[G]=B[G];return $}function Ue(B,z){if(!(B instanceof z))throw new TypeError("Cannot call a class as a function")}function Ge(B,z){for(var G=0;G<z.length;G++){var $=z[G];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(B,$.key,$)}}function rt(B,z,G){return z&&Ge(B.prototype,z),G&&Ge(B,G),B}var wt=function(){function B(z,G){Ue(this,B),this.node=z.createElement("div"),this.border=z.createElement("div"),this.padding=z.createElement("div"),this.content=z.createElement("div"),this.border.style.borderColor=Ke.border,this.padding.style.borderColor=Ke.padding,this.content.style.backgroundColor=Ke.background,m()(this.node.style,{borderColor:Ke.margin,pointerEvents:"none",position:"fixed"}),this.node.style.zIndex="10000000",this.node.appendChild(this.border),this.border.appendChild(this.padding),this.padding.appendChild(this.content),G.appendChild(this.node)}return rt(B,[{key:"remove",value:function(){this.node.parentNode&&this.node.parentNode.removeChild(this.node)}},{key:"update",value:function(z,G){ft(G,"margin",this.node),ft(G,"border",this.border),ft(G,"padding",this.padding),m()(this.content.style,{height:z.height-G.borderTop-G.borderBottom-G.paddingTop-G.paddingBottom+"px",width:z.width-G.borderLeft-G.borderRight-G.paddingLeft-G.paddingRight+"px"}),m()(this.node.style,{top:z.top-G.marginTop+"px",left:z.left-G.marginLeft+"px"})}}]),B}(),xt=function(){function B(z,G){Ue(this,B),this.tip=z.createElement("div"),m()(this.tip.style,{display:"flex",flexFlow:"row nowrap",backgroundColor:"#333740",borderRadius:"2px",fontFamily:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',fontWeight:"bold",padding:"3px 5px",pointerEvents:"none",position:"fixed",fontSize:"12px",whiteSpace:"nowrap"}),this.nameSpan=z.createElement("span"),this.tip.appendChild(this.nameSpan),m()(this.nameSpan.style,{color:"#ee78e6",borderRight:"1px solid #aaaaaa",paddingRight:"0.5rem",marginRight:"0.5rem"}),this.dimSpan=z.createElement("span"),this.tip.appendChild(this.dimSpan),m()(this.dimSpan.style,{color:"#d7d7d7"}),this.tip.style.zIndex="10000000",G.appendChild(this.tip)}return rt(B,[{key:"remove",value:function(){this.tip.parentNode&&this.tip.parentNode.removeChild(this.tip)}},{key:"updateText",value:function(z,G,$){this.nameSpan.textContent=z,this.dimSpan.textContent=Math.round(G)+"px \xD7 "+Math.round($)+"px"}},{key:"updatePosition",value:function(z,G){var $=this.tip.getBoundingClientRect(),De=function(me,xe,Z){var ke,Xe=Math.max(Z.height,20),ht=Math.max(Z.width,60);ke=me.top+me.height+Xe<=xe.top+xe.height?me.top+me.height<xe.top+0?xe.top+5:me.top+me.height+5:me.top-Xe<=xe.top+xe.height?me.top-Xe-5<xe.top+5?xe.top+5:me.top-Xe-5:xe.top+xe.height-Xe-5;var ie=me.left+5;return me.left<xe.left&&(ie=xe.left+5),me.left+ht>xe.left+xe.width&&(ie=xe.left+xe.width-ht-5),{style:{top:ke+="px",left:ie+="px"}}}(z,G,{width:$.width,height:$.height});m()(this.tip.style,De.style)}}]),B}(),$e=function(){function B(){Ue(this,B);var z=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.window=z;var G=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;this.tipBoundsWindow=G;var $=z.document;this.container=$.createElement("div"),this.container.style.zIndex="10000000",this.tip=new xt($,this.container),this.rects=[],$.body.appendChild(this.container)}return rt(B,[{key:"remove",value:function(){this.tip.remove(),this.rects.forEach(function(z){z.remove()}),this.rects.length=0,this.container.parentNode&&this.container.parentNode.removeChild(this.container)}},{key:"inspect",value:function(z,G){for(var $=this,De=z.filter(function(Tt){return Tt.nodeType===Node.ELEMENT_NODE});this.rects.length>De.length;)this.rects.pop().remove();if(De.length!==0){for(;this.rects.length<De.length;)this.rects.push(new wt(this.window.document,this.container));var me={top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,left:Number.POSITIVE_INFINITY};if(De.forEach(function(Tt,kt){var bt=ze(Tt,$.window),on=pe(Tt);me.top=Math.min(me.top,bt.top-on.marginTop),me.right=Math.max(me.right,bt.left+bt.width+on.marginRight),me.bottom=Math.max(me.bottom,bt.top+bt.height+on.marginBottom),me.left=Math.min(me.left,bt.left-on.marginLeft),$.rects[kt].update(bt,on)}),!G){G=De[0].nodeName.toLowerCase();var xe=De[0],Z=xe.ownerDocument.defaultView.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(Z!=null&&Z.rendererInterfaces!=null){var ke,Xe=null,ht=Oe(Z.rendererInterfaces.values());try{for(ht.s();!(ke=ht.n()).done;){var ie=ke.value,qe=ie.getFiberIDForNative(xe,!0);if(qe!==null){Xe=ie.getDisplayNameForFiberID(qe,!0);break}}}catch(Tt){ht.e(Tt)
Line truncated
|
||||
xx-background-color: red;
|
||||
xx-opacity: 0.5;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1000000000;
|
||||
`;var $=window.document.documentElement;$.insertBefore(je,$.firstChild)}();var z=je;z.width=window.innerWidth,z.height=window.innerHeight;var G=z.getContext("2d");G.clearRect(0,0,z.width,z.height),B.forEach(function($){var De=$.count,me=$.rect;if(me!==null){var xe=Math.min(ue.length-1,De-1);(function(Z,ke,Xe){var ht=ke.height,ie=ke.left,qe=ke.top,tt=ke.width;Z.lineWidth=1,Z.strokeStyle="#f0f0f0",Z.strokeRect(ie-1,qe-1,tt+2,ht+2),Z.lineWidth=1,Z.strokeStyle="#f0f0f0",Z.strokeRect(ie+1,qe+1,tt-1,ht-1),Z.strokeStyle=Xe,Z.setLineDash([0]),Z.lineWidth=1,Z.strokeRect(ie,qe,tt-1,ht-1),Z.setLineDash([0])})(G,me,ue[xe])}})}function At(B){return(At=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}var en=(typeof performance=="undefined"?"undefined":At(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()},ln=new Map,An=null,nr=!1,un=null;function Wt(B){(nr=B)||(ln.clear(),An!==null&&(cancelAnimationFrame(An),An=null),un!==null&&(clearTimeout(un),un=null),je!==null&&(je.parentNode!=null&&je.parentNode.removeChild(je),je=null))}function vr(B){nr&&(B.forEach(function(z){var G=ln.get(z),$=en(),De=G!=null?G.lastMeasuredAt:0,me=G!=null?G.rect:null;(me===null||De+250<$)&&(De=$,me=function(xe){if(!xe||typeof xe.getBoundingClientRect!="function")return null;var Z=window.__REACT_DEVTOOLS_TARGET_WINDOW__||window;return ze(xe,Z)}(z)),ln.set(z,{count:G!=null?G.count+1:1,expirationTime:G!=null?Math.min($+3e3,G.expirationTime+250):$+250,lastMeasuredAt:De,rect:me})}),un!==null&&(clearTimeout(un),un=null),An===null&&(An=requestAnimationFrame(w)))}function w(){An=null,un=null;var B=en(),z=Number.MAX_VALUE;ln.forEach(function(G,$){G.expirationTime<B?ln.delete($):z=Math.min(z,G.expirationTime)}),ct(ln),z!==Number.MAX_VALUE&&(un=setTimeout(w,z-B))}var Ut=f(3),Vn=f(6),fr=f.n(Vn),Fr=f(0),ur=60120;if(typeof Symbol=="function"&&Symbol.for){var br=Symbol.for;br("react.element"),br("react.portal"),br("react.fragment"),br("react.strict_mode"),br("react.profiler"),br("react.provider"),br("react.context"),br("react.forward_ref"),br("react.suspense"),ur=br("react.suspense_list"),br("react.memo"),br("react.lazy"),br("react.block"),br("react.server.block"),br("react.fundamental"),br("react.scope"),br("react.opaque.id"),br("react.debug_trace_mode"),br("react.offscreen"),br("react.legacy_hidden")}typeof Symbol=="function"&&Symbol.iterator;function Kt(B){return(Kt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}var vu={inspectable:Symbol("inspectable"),inspected:Symbol("inspected"),name:Symbol("name"),preview_long:Symbol("preview_long"),preview_short:Symbol("preview_short"),readonly:Symbol("readonly"),size:Symbol("size"),type:Symbol("type"),unserializable:Symbol("unserializable")};function a0(B,z,G,$,De){$.push(De);var me={inspectable:z,type:B,preview_long:Si(G,!0),preview_short:Si(G,!1),name:G.constructor&&G.constructor.name!=="Object"?G.constructor.name:""};return B==="array"||B==="typed_array"?me.size=G.length:B==="object"&&(me.size=Object.keys(G).length),B!=="iterator"&&B!=="typed_array"||(me.readonly=!0),me}function So(B,z,G,$,De){var me,xe=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,Z=Co(B);switch(Z){case"html_element":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.tagName,type:Z};case"function":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:typeof B.name!="function"&&B.name?B.name:"function",type:Z};case"string":return B.length<=500?B:B.slice(0,500)+"...";case"bigint":case"symbol":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.toString(),type:Z};case"react_element":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:L0(B)||"Unknown",type:Z};case"array_buffer":case"data_view":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:Z==="data_view"?"DataView":"ArrayBuffer",size:B.byteLength,type:Z};case"array":return me=De($),xe>=2&&!me?a0(Z,!0,B,z,$):B.map(function(ht,ie){return So(ht,z,G,$.concat([ie]),De,me?1:xe+1)});case"html_all_collection":case"typed_array":case"iterator":if(me=De($),xe>=2&&!me)return a0(Z,!0,B,z,$);var ke={unserializable:!0,type:Z,readonly:!0,size:Z==="typed_array"?B.length:void 0,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B.constructor&&B.constructor.name!=="Object"?B.constructor.name:""};return Kt(B[Symbol.iterator])&&Array.from(B).forEach(function(ht,ie){return ke[ie]=So(ht,z,G,$.concat([ie]),De,me?1:xe+1)}),G.push($),ke;case"opaque_iterator":return z.push($),{inspectable:!1,preview_short:Si(B,!1),preview_long:Si(B,!0),name:B[Symbol.toStringTag],type:Z}
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Yo(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G<z;G++)$[G]=B[G];return $}var Ko=new WeakMap,qt=new fr.a({max:1e3});function _i(B,z){return B.toString()>z.toString()?1:z.toString()>B.toString()?-1:0}function eu(B){for(var z=[],G=B,$=function(){var De=[].concat(Os(Object.keys(G)),Os(Object.getOwnPropertySymbols(G))),me=Object.getOwnPropertyDescriptors(G);De.forEach(function(xe){me[xe].enumerable&&z.push(xe)}),G=Object.getPrototypeOf(G)};G!=null;)$();return z}function ai(B){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Anonymous",G=Ko.get(B);if(G!=null)return G;var $=z;return typeof B.displayName=="string"?$=B.displayName:typeof B.name=="string"&&B.name!==""&&($=B.name),Ko.set(B,$),$}var mr=0;function Xo(){return++mr}function W0(B){var z=qt.get(B);if(z!==void 0)return z;for(var G=new Array(B.length),$=0;$<B.length;$++)G[$]=B.codePointAt($);return qt.set(B,G),G}function Lu(B,z){return z.reduce(function(G,$){if(G){if(hasOwnProperty.call(G,$))return G[$];if(typeof G[Symbol.iterator]=="function")return Array.from(G)[$]}return null},B)}function V0(B,z){var G=z.length,$=z[G-1];if(B!=null){var De=Lu(B,z.slice(0,G-1));De&&(Array.isArray(De)?De.splice($,1):delete De[$])}}function Hr(B,z,G){var $=z.length;if(B!=null){var De=Lu(B,z.slice(0,$-1));if(De){var me=z[$-1];De[G[$-1]]=De[me],Array.isArray(De)?De.splice(me,1):delete De[me]}}}function To(B,z,G){var $=z.length,De=z[$-1];if(B!=null){var me=Lu(B,z.slice(0,$-1));me&&(me[De]=G)}}function Co(B){if(B===null)return"null";if(B===void 0)return"undefined";if(Object(Fr.isElement)(B))return"react_element";if(typeof HTMLElement!="undefined"&&B instanceof HTMLElement)return"html_element";switch(Go(B)){case"bigint":return"bigint";case"boolean":return"boolean";case"function":return"function";case"number":return Number.isNaN(B)?"nan":Number.isFinite(B)?"number":"infinity";case"object":if(Array.isArray(B))return"array";if(ArrayBuffer.isView(B))return hasOwnProperty.call(B.constructor,"BYTES_PER_ELEMENT")?"typed_array":"data_view";if(B.constructor&&B.constructor.name==="ArrayBuffer")return"array_buffer";if(typeof B[Symbol.iterator]=="function")return B[Symbol.iterator]()===B?"opaque_iterator":"iterator";if(B.constructor&&B.constructor.name==="RegExp")return"regexp";var z=Object.prototype.toString.call(B);return z==="[object Date]"?"date":z==="[object HTMLAllCollection]"?"html_all_collection":"object";case"string":return"string";case"symbol":return"symbol";case"undefined":return Object.prototype.toString.call(B)==="[object HTMLAllCollection]"?"html_all_collection":"undefined";default:return"unknown"}}function L0(B){switch(Object(Fr.typeOf)(B)){case Fr.ContextConsumer:return"ContextConsumer";case Fr.ContextProvider:return"ContextProvider";case Fr.ForwardRef:return"ForwardRef";case Fr.Fragment:return"Fragment";case Fr.Lazy:return"Lazy";case Fr.Memo:return"Memo";case Fr.Portal:return"Portal";case Fr.Profiler:return"Profiler";case Fr.StrictMode:return"StrictMode";case Fr.Suspense:return"Suspense";case ur:return"SuspenseList";default:var z=B.type;return typeof z=="string"?z:typeof z=="function"?ai(z,"Anonymous"):z!=null?"NotImplementedInDevtools":"Element"}}function tu(B){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:50;return B.length>z?B.substr(0,z)+"\u2026":B}function Si(B,z){if(B!=null&&hasOwnProperty.call(B,vu.type))return z?B[vu.preview_long]:B[vu.preview_short];switch(Co(B)){case"html_element":return"<".concat(tu(B.tagName.toLowerCase())," />");case"function":return tu("\u0192 ".concat(typeof B.name=="function"?"":B.name,"() {}"));case"string":return'"'.concat(B,'"');case"bigint":return tu(B.toString()+"n");case"regexp":case"symbol":return tu(B.toString());case"react_element":return"<".concat(tu(L0(B)||"Unknown")," />");case"array_buffer":return"ArrayBuffer(".concat(B.byteLength,")");case"data_view":return"DataView(".concat(B.buffer.byteLength,")");case"array":if(z){for(var G="",$=0;$<B.length&&($>0&&(G+=", "),!((G+=Si(B[$],!1)).length>50));$++);return"[".concat(tu(G),"]")}var De=hasOwnProperty.call(B,vu.size)?B[vu.size]:B.length;return"Array(".concat(De,")");case"typed_array":var me="".concat(B.constructor.name,"(").concat(B.length,")");if(z){for(var xe="",Z=0;Z<B.length&&(Z>0&&(xe+=", "),!((xe+=B[Z]).length>50));Z++);return"".concat(me," [").concat(tu(xe),"]")}return me;case"iterator":var ke=B.constructor.name;if(z){for(var Xe=Array.from(B),ht="",ie=0;ie<Xe.length;ie++){var qe=Xe[ie];if(ie>0&&(ht+=", "),Array.isArray(qe)){var tt=Si(qe[0],!0),Tt=Si(qe[1],!1);ht+="".concat(tt," => ").concat(Tt)}else ht+=Si(qe,!1);if(ht.length>50)break}return"".concat(ke,"(").concat(B.size,") {").concat(tu(ht),"}")}return"".concat(ke,"(").concat(B.size,")");case"opaque_iterator":return B[Symbol.toStringTag];case"date":return B.toString();case"object":if(z){for(var kt=eu(B).sort(_i),bt="",on=0;on<kt.length;on++){var tn=kt[on];if(on>0&&(bt+=", "),(bt+
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Y0(B,z){return function(G){if(Array.isArray(G))return G}(B)||function(G,$){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(G)))){var De=[],me=!0,xe=!1,Z=void 0;try{for(var ke,Xe=G[Symbol.iterator]();!(me=(ke=Xe.next()).done)&&(De.push(ke.value),!$||De.length!==$);me=!0);}catch(ht){xe=!0,Z=ht}finally{try{me||Xe.return==null||Xe.return()}finally{if(xe)throw Z}}return De}}(B,z)||Wl(B,z)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ui(B,z){var G;if(typeof Symbol=="undefined"||B[Symbol.iterator]==null){if(Array.isArray(B)||(G=Wl(B))||z&&B&&typeof B.length=="number"){G&&(B=G);var $=0,De=function(){};return{s:De,n:function(){return $>=B.length?{done:!0}:{done:!1,value:B[$++]}},e:function(ke){throw ke},f:De}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function Wl(B,z){if(B){if(typeof B=="string")return xo(B,z);var G=Object.prototype.toString.call(B).slice(8,-1);return G==="Object"&&B.constructor&&(G=B.constructor.name),G==="Map"||G==="Set"?Array.from(B):G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G)?xo(B,z):void 0}}function xo(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G<z;G++)$[G]=B[G];return $}function ni(B){return(ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function oo(B){return B.flags!==void 0?B.flags:B.effectTag}var Vl=(typeof performance=="undefined"?"undefined":ni(performance))==="object"&&typeof performance.now=="function"?function(){return performance.now()}:function(){return Date.now()};function Ao(B){var z=null;function G(tn){var Lt=ni(tn)==="object"&&tn!==null?tn.$$typeof:tn;return ni(Lt)==="symbol"?Lt.toString():Lt}var $=z=Object(Ut.gte)(B,"17.0.0-alpha")?{Block:22,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,MemoComponent:14,Mode:8,OffscreenComponent:23,Profiler:12,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,YieldComponent:-1}:Object(Ut.gte)(B,"16.6.0-beta.0")?{Block:22,ClassComponent:1,ContextConsumer:9,ContextProvider:10,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:18,ForwardRef:11,Fragment:7,FunctionComponent:0,HostComponent:5,HostPortal:4,HostRoot:3,HostText:6,IncompleteClassComponent:17,IndeterminateComponent:2,LazyComponent:16,MemoComponent:14,Mode:8,OffscreenComponent:-1,Profiler:12,SimpleMemoComponent:15,SuspenseComponent:13,SuspenseListComponent:19,YieldComponent:-1}:Object(Ut.gte)(B,"16.4.3-alpha")?{Block:-1,ClassComponent:2,ContextConsumer:11,ContextProvider:12,CoroutineComponent:-1,CoroutineHandlerPhase:-1,DehydratedSuspenseComponent:-1,ForwardRef:13,Fragment:9,FunctionComponent:0,HostComponent:7,HostPortal:6,HostRoot:5,HostText:8,IncompleteClassComponent:-1,IndeterminateComponent:4,LazyComponent:-1,MemoComponent:-1,Mode:10,OffscreenComponent:-1,Profiler:15,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,YieldComponent:-1}:{Block:-1,ClassComponent:2,ContextConsumer:12,ContextProvider:13,CoroutineComponent:7,CoroutineHandlerPhase:8,DehydratedSuspenseComponent:-1,ForwardRef:14,Fragment:10,FunctionComponent:1,HostComponent:5,HostPortal:4,HostRoot:3,HostText:6,IncompleteClassComponent:-1,IndeterminateComponent:0,LazyComponent:-1,MemoComponent:-1,Mode:11,OffscreenComponent:-1,Profiler:15,SimpleMemoComponent:-1,SuspenseComponent:16,SuspenseListComponent:-1,YieldComponent:9},De=$.ClassComponent,me=$.IncompleteClassComponent,xe=$.FunctionComponent,Z=$.IndeterminateComponent,ke=$.ForwardRef,Xe=$.HostRoot,ht=$.HostComponent,ie=$.HostPortal,qe=$.HostText,tt=$.Fragment,Tt=$.MemoComponent,kt=$.SimpleMemoComponent,bt=$.SuspenseComponent,on=$.SuspenseListComponent;return{getDisplayNameForFiber:function(tn){var Lt=tn.type,gn=tn.tag,lr=Lt;ni(Lt)==="object"&&Lt!==null&&(lr=function _r(Cn){switch(G(Cn)){case 60115:case"Symbol(react.memo)":return _r(Cn.type);case 60112:case"Symbol(react.forward_ref)":return Cn.render;default:return Cn}}(Lt));var Qn=null;switch(gn){case De:case me:return ai(lr);case xe:case Z:return ai(lr);case ke:return Lt&&Lt.displayName||ai(lr,"Anonymous");case Xe:return null;case ht:return Lt;case ie:case qe:case tt:return null;case Tt:case kt:return ai(lr,"Anonymous");case bt:return"Suspense";case on:return"SuspenseList";default:switch(G(Lt)){case 60111:case"Symbol(react.concurrent_mode)":case"Symbol(react.async_mode)":return null;case 60109:case"Symbol(react.provider)":return Qn=tn.type._context||tn.type.context,"".concat(Qn.displayName||"Context",".Provider");case 60110:case"Symbol(react.context)":return Qn=tn.type._context||tn.type,"".concat(Qn.displayName||"Context",".Consumer");case 60108:case"Symbol(react.strict_mode)":return null;case 60114:case"Symbol(react.profiler)":return"Profiler(".concat(tn.memoizedProps.id,")");case 60119:case"Symbol(react.scope)":return"Scope";default:return null}}},getTypeSymbol:G,ReactPriorityLevels:{ImmediatePriority:99,UserBlockingPriority:98,NormalPriority:97,LowPriority:96,IdlePriority:95,NoPriority:90},ReactTypeOfWork:z,ReactTypeOfSideEffect:{NoFlags:0,PerformedWork:1,Placement:2}}}function Ms(B,z,G,$){var De=Ao(G.version),me=De.getDisplayNameForFiber,xe=De.getTypeS
Line truncated
|
||||
`+Xn+B}var b0=!1;function yl(B,z,G){if(!B||b0)return"";var $,De=Error.prepareStackTrace;Error.prepareStackTrace=void 0,b0=!0;var me=G.current;G.current=null;try{if(z){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),(typeof Reflect=="undefined"?"undefined":Qo(Reflect))==="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(qe){$=qe}Reflect.construct(B,[],xe)}else{try{xe.call()}catch(qe){$=qe}B.call(xe.prototype)}}else{try{throw Error()}catch(qe){$=qe}B()}}catch(qe){if(qe&&$&&typeof qe.stack=="string"){for(var Z=qe.stack.split(`
|
||||
`),ke=$.stack.split(`
|
||||
`),Xe=Z.length-1,ht=ke.length-1;Xe>=1&&ht>=0&&Z[Xe]!==ke[ht];)ht--;for(;Xe>=1&&ht>=0;Xe--,ht--)if(Z[Xe]!==ke[ht]){if(Xe!==1||ht!==1)do if(Xe--,--ht<0||Z[Xe]!==ke[ht])return`
|
||||
`+Z[Xe].replace(" at new "," at ");while(Xe>=1&&ht>=0);break}}}finally{b0=!1,Error.prepareStackTrace=De,G.current=me}var ie=B?B.displayName||B.name:"";return ie?lo(ie):""}function Ro(B,z,G,$){return yl(B,!1,$)}function Et(B,z,G){var $=B.HostComponent,De=B.LazyComponent,me=B.SuspenseComponent,xe=B.SuspenseListComponent,Z=B.FunctionComponent,ke=B.IndeterminateComponent,Xe=B.SimpleMemoComponent,ht=B.ForwardRef,ie=B.Block,qe=B.ClassComponent;switch(z.tag){case $:return lo(z.type);case De:return lo("Lazy");case me:return lo("Suspense");case xe:return lo("SuspenseList");case Z:case ke:case Xe:return Ro(z.type,0,0,G);case ht:return Ro(z.type.render,0,0,G);case ie:return Ro(z.type._render,0,0,G);case qe:return function(tt,Tt,kt,bt){return yl(tt,!0,bt)}(z.type,0,0,G);default:return""}}function Pt(B,z,G){try{var $="",De=z;do $+=Et(B,De,G),De=De.return;while(De);return $}catch(me){return`
|
||||
Error generating stack: `+me.message+`
|
||||
`+me.stack}}function Bn(B,z){var G;if(typeof Symbol=="undefined"||B[Symbol.iterator]==null){if(Array.isArray(B)||(G=function(ke,Xe){if(!!ke){if(typeof ke=="string")return Ir(ke,Xe);var ht=Object.prototype.toString.call(ke).slice(8,-1);if(ht==="Object"&&ke.constructor&&(ht=ke.constructor.name),ht==="Map"||ht==="Set")return Array.from(ke);if(ht==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ht))return Ir(ke,Xe)}}(B))||z&&B&&typeof B.length=="number"){G&&(B=G);var $=0,De=function(){};return{s:De,n:function(){return $>=B.length?{done:!0}:{done:!1,value:B[$++]}},e:function(ke){throw ke},f:De}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var me,xe=!0,Z=!1;return{s:function(){G=B[Symbol.iterator]()},n:function(){var ke=G.next();return xe=ke.done,ke},e:function(ke){Z=!0,me=ke},f:function(){try{xe||G.return==null||G.return()}finally{if(Z)throw me}}}}function Ir(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G<z;G++)$[G]=B[G];return $}var ji=["error","trace","warn"],Wr=/\s{4}(in|at)\s{1}/,wu=/:\d+:\d+(\n|$)/,c0=new Map,Ti=console,d0={};for(var as in console)d0[as]=console[as];var St=null;function so(B){var z=B.currentDispatcherRef,G=B.getCurrentFiber,$=B.findFiberByHostInstance,De=B.version;if(typeof $=="function"&&z!=null&&typeof G=="function"){var me=Ao(De).ReactTypeOfWork;c0.set(B,{currentDispatcherRef:z,getCurrentFiber:G,workTagMap:me})}}var Jo={appendComponentStack:!1,breakOnConsoleErrors:!1};function Gl(B){var z=B.appendComponentStack,G=B.breakOnConsoleErrors;if(Jo.appendComponentStack=z,Jo.breakOnConsoleErrors=G,St===null){var $={};St=function(){for(var De in $)try{Ti[De]=$[De]}catch(me){}},ji.forEach(function(De){try{var me=$[De]=Ti[De],xe=function(){for(var Z=Jo.appendComponentStack,ke=(Jo.breakOnConsoleErrors,arguments.length),Xe=new Array(ke),ht=0;ht<ke;ht++)Xe[ht]=arguments[ht];if(Z)try{var ie=Xe.length>0?Xe[Xe.length-1]:null,qe=ie!==null&&(Wr.test(ie)||wu.test(ie));if(!qe){var tt,Tt=Bn(c0.values());try{for(Tt.s();!(tt=Tt.n()).done;){var kt=tt.value,bt=kt.currentDispatcherRef,on=kt.getCurrentFiber,tn=kt.workTagMap,Lt=on();if(Lt!=null){var gn=Pt(tn,Lt,bt);gn!==""&&Xe.push(gn);break}}}catch(lr){Tt.e(lr)}finally{Tt.f()}}}catch(lr){}me.apply(void 0,Xe)};xe.__REACT_DEVTOOLS_ORIGINAL_METHOD__=me,Ti[De]=xe}catch(Z){}})}}function Fu(B){return(Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function fs(B,z){for(var G=0;G<z.length;G++){var $=z[G];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(B,$.key,$)}}function P0(B,z){return(P0=Object.setPrototypeOf||function(G,$){return G.__proto__=$,G})(B,z)}function X(B){var z=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(G){return!1}}();return function(){var G,$=Me(B);if(z){var De=Me(this).constructor;G=Reflect.construct($,arguments,De)}else G=$.apply(this,arguments);return _e(this,G)}}function _e(B,z){return!z||Fu(z)!=="object"&&typeof z!="function"?Ne(B):z}function Ne(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}function Me(B){return(Me=Object.setPrototypeOf?Object.getPrototypeOf:function(z){return z.__proto__||Object.getPrototypeOf(z)})(B)}function dt(B,z,G){return z in B?Object.defineProperty(B,z,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[z]=G,B}var Hn=function(B){(function(xe,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");xe.prototype=Object.create(Z&&Z.prototype,{constructor:{value:xe,writable:!0,configurable:!0}}),Z&&P0(xe,Z)})(me,B);var z,G,$,De=X(me);function me(xe){var Z;(function(ie,qe){if(!(ie instanceof qe))throw new TypeError("Cannot call a class as a function")})(this,me),dt(Ne(Z=De.call(this)),"_isProfiling",!1),dt(Ne(Z),"_recordChangeDescriptions",!1),dt(Ne(Z),"_rendererInterfaces",{}),dt(Ne(Z),"_persistedSelection",null),dt(Ne(Z),"_persistedSelectionMatch",null),dt(Ne(Z),"_traceUpdatesEnabled",!1),dt(Ne(Z),"copyElementPath",function(ie){var qe=ie.id,tt=ie.path,Tt=ie.rendererID,kt=Z._rendererInterfaces[Tt];kt==null?console.warn('Invalid renderer id "'.concat(Tt,'" for element "').concat(qe,'"')):kt.copyElementPath(qe,tt)}),dt(Ne(Z),"deletePath",function(ie){var qe=ie.hookID,tt=ie.id,Tt=ie.path,kt=ie.rendererID,bt=ie.type,on=Z._rendererInterfaces[kt];on==null?console.warn('Invalid renderer id "'.concat(kt,'" for element "').concat(tt,'"')):on.deletePath(bt,tt,qe,Tt)}),dt(Ne(Z),"getProfilingData",function(ie){var qe=ie.rendererID,tt=Z._rendererInterfaces[qe];tt==null&&console.warn('Invalid renderer id "'.concat(qe,'"')),Z._bridge.send("profilingData",tt.getProfilingData())}),dt(Ne(Z),"getProfilingStatus",function(){Z._bridge.send("profilingStatus",Z._isProfiling)}),dt(Ne(Z),"getOwnersList",function(ie){var qe=ie.id,tt=ie.rendererID,Tt=Z._rendererInterfaces[tt];if(Tt==null)console.warn('Invalid renderer id "'.concat(tt,'" for element "').concat(qe,'"'));else{var kt=Tt.getOwnersList(qe);Z._bridge.send("ownersList",{id:qe,owners:kt})}}),dt(Ne(Z),"inspectElement",function(ie){var qe=ie.id,tt=ie.path,Tt=ie.rendererID,kt=Z._rendererInterfaces[Tt];kt==null?console.warn('Invalid renderer id "'.concat(Tt,'" for element "').concat(qe,'"')):(Z._bridge.send("inspectedEleme
Line truncated
|
||||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function mi(B,z){(z==null||z>B.length)&&(z=B.length);for(var G=0,$=new Array(z);G<z;G++)$[G]=B[G];return $}function Su(B,z){for(var G=0;G<z.length;G++){var $=z[G];$.enumerable=$.enumerable||!1,$.configurable=!0,"value"in $&&($.writable=!0),Object.defineProperty(B,$.key,$)}}function bu(B,z){return(bu=Object.setPrototypeOf||function(G,$){return G.__proto__=$,G})(B,z)}function Pu(B){var z=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(G){return!1}}();return function(){var G,$=Oo(B);if(z){var De=Oo(this).constructor;G=Reflect.construct($,arguments,De)}else G=$.apply(this,arguments);return mu(this,G)}}function mu(B,z){return!z||Dn(z)!=="object"&&typeof z!="function"?yi(B):z}function yi(B){if(B===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return B}function Oo(B){return(Oo=Object.setPrototypeOf?Object.getPrototypeOf:function(z){return z.__proto__||Object.getPrototypeOf(z)})(B)}function Tu(B,z,G){return z in B?Object.defineProperty(B,z,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[z]=G,B}var ao=function(B){(function(xe,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Super expression must either be null or a function");xe.prototype=Object.create(Z&&Z.prototype,{constructor:{value:xe,writable:!0,configurable:!0}}),Z&&bu(xe,Z)})(me,B);var z,G,$,De=Pu(me);function me(xe){var Z;return function(ke,Xe){if(!(ke instanceof Xe))throw new TypeError("Cannot call a class as a function")}(this,me),Tu(yi(Z=De.call(this)),"_isShutdown",!1),Tu(yi(Z),"_messageQueue",[]),Tu(yi(Z),"_timeoutID",null),Tu(yi(Z),"_wallUnlisten",null),Tu(yi(Z),"_flush",function(){if(Z._timeoutID!==null&&(clearTimeout(Z._timeoutID),Z._timeoutID=null),Z._messageQueue.length){for(var ke=0;ke<Z._messageQueue.length;ke+=2){var Xe;(Xe=Z._wall).send.apply(Xe,[Z._messageQueue[ke]].concat(or(Z._messageQueue[ke+1])))}Z._messageQueue.length=0,Z._timeoutID=setTimeout(Z._flush,100)}}),Tu(yi(Z),"overrideValueAtPath",function(ke){var Xe=ke.id,ht=ke.path,ie=ke.rendererID,qe=ke.type,tt=ke.value;switch(qe){case"context":Z.send("overrideContext",{id:Xe,path:ht,rendererID:ie,wasForwarded:!0,value:tt});break;case"hooks":Z.send("overrideHookState",{id:Xe,path:ht,rendererID:ie,wasForwarded:!0,value:tt});break;case"props":Z.send("overrideProps",{id:Xe,path:ht,rendererID:ie,wasForwarded:!0,value:tt});break;case"state":Z.send("overrideState",{id:Xe,path:ht,rendererID:ie,wasForwarded:!0,value:tt})}}),Z._wall=xe,Z._wallUnlisten=xe.listen(function(ke){yi(Z).emit(ke.event,ke.payload)})||null,Z.addListener("overrideValueAtPath",Z.overrideValueAtPath),Z}return z=me,(G=[{key:"send",value:function(xe){if(this._isShutdown)console.warn('Cannot send message "'.concat(xe,'" through a Bridge that has been shutdown.'));else{for(var Z=arguments.length,ke=new Array(Z>1?Z-1:0),Xe=1;Xe<Z;Xe++)ke[Xe-1]=arguments[Xe];this._messageQueue.push(xe,ke),this._timeoutID||(this._timeoutID=setTimeout(this._flush,0))}}},{key:"shutdown",value:function(){if(this._isShutdown)console.warn("Bridge was already shutdown.");else{this.send("shutdown"),this._isShutdown=!0,this.addListener=function(){},this.emit=function(){},this.removeAllListeners();var xe=this._wallUnlisten;xe&&xe();do this._flush();while(this._messageQueue.length);this._timeoutID!==null&&(clearTimeout(this._timeoutID),this._timeoutID=null)}}},{key:"wall",get:function(){return this._wall}}])&&Su(z.prototype,G),$&&Su(z,$),me}(E);function Iu(B,z,G){var $=B[z];return B[z]=function(De){return G.call(this,$,arguments)},$}function Oa(B,z){for(var G in z)B[G]=z[G]}function p0(B){typeof B.forceUpdate=="function"?B.forceUpdate():B.updater!=null&&typeof B.updater.enqueueForceUpdate=="function"&&B.updater.enqueueForceUpdate(this,function(){},"forceUpdate")}function Zs(B,z){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(B);z&&($=$.filter(function(De){return Object.getOwnPropertyDescriptor(B,De).enumerable})),G.push.apply(G,$)}return G}function K0(B){for(var z=1;z<arguments.length;z++){var G=arguments[z]!=null?arguments[z]:{};z%2?Zs(Object(G),!0).forEach(function($){$s(B,$,G[$])}):Object.getOwnPropertyDescriptors?Object.defineProperties(B,Object.getOwnPropertyDescriptors(G)):Zs(Object(G)).forEach(function($){Object.defineProperty(B,$,Object.getOwnPropertyDescriptor(G,$))})}return B}function $s(B,z,G){return z in B?Object.defineProperty(B,z,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[z]=G,B}function ka(B){return(ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z})(B)}function cs(B){var z=null,G=null;if(B._currentElement!=null){B._currentE
Line truncated
|
||||
`:`
|
||||
`)+f,E=p+1,p=i.indexOf(`
|
||||
`,E)}while(p!==-1);return t+=i.substr(E),t};FR.exports={stringReplaceAll:iJ,stringEncaseCRLFWithFirstIndex:uJ}});var jR=ce((Fre,PR)=>{"use strict";var oJ=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,IR=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,lJ=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,sJ=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,aJ=new Map([["n",`
|
||||
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function BR(i){let o=i[0]==="u",f=i[1]==="{";return o&&!f&&i.length===5||i[0]==="x"&&i.length===3?String.fromCharCode(parseInt(i.slice(1),16)):o&&f?String.fromCodePoint(parseInt(i.slice(2,-1),16)):aJ.get(i)||i}function fJ(i,o){let f=[],p=o.trim().split(/\s*,\s*/g),E;for(let t of p){let k=Number(t);if(!Number.isNaN(k))f.push(k);else if(E=t.match(lJ))f.push(E[2].replace(sJ,(L,N,C)=>N?BR(N):C));else throw new Error(`Invalid Chalk template style argument: ${t} (in style '${i}')`)}return f}function cJ(i){IR.lastIndex=0;let o=[],f;for(;(f=IR.exec(i))!==null;){let p=f[1];if(f[2]){let E=fJ(p,f[2]);o.push([p].concat(E))}else o.push([p])}return o}function UR(i,o){let f={};for(let E of o)for(let t of E.styles)f[t[0]]=E.inverse?null:t.slice(1);let p=i;for(let[E,t]of Object.entries(f))if(!!Array.isArray(t)){if(!(E in p))throw new Error(`Unknown Chalk style: ${E}`);p=t.length>0?p[E](...t):p[E]}return p}PR.exports=(i,o)=>{let f=[],p=[],E=[];if(o.replace(oJ,(t,k,L,N,C,U)=>{if(k)E.push(BR(k));else if(N){let q=E.join("");E=[],p.push(f.length===0?q:UR(i,f)(q)),f.push({inverse:L,styles:cJ(N)})}else if(C){if(f.length===0)throw new Error("Found extraneous } in Chalk template literal");p.push(UR(i,f)(E.join(""))),E=[],f.pop()}else E.push(U)}),p.push(E.join("")),f.length>0){let t=`Chalk template literal is missing ${f.length} closing bracket${f.length===1?"":"s"} (\`}\`)`;throw new Error(t)}return p.join("")}});var u3=ce((bre,zR)=>{"use strict";var Ng=_4(),{stdout:t3,stderr:n3}=LR(),{stringReplaceAll:dJ,stringEncaseCRLFWithFirstIndex:pJ}=bR(),{isArray:M4}=Array,qR=["ansi","ansi","ansi256","ansi16m"],cm=Object.create(null),hJ=(i,o={})=>{if(o.level&&!(Number.isInteger(o.level)&&o.level>=0&&o.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let f=t3?t3.level:0;i.level=o.level===void 0?f:o.level},HR=class{constructor(o){return WR(o)}},WR=i=>{let o={};return hJ(o,i),o.template=(...f)=>VR(o.template,...f),Object.setPrototypeOf(o,N4.prototype),Object.setPrototypeOf(o.template,o),o.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},o.template.Instance=HR,o.template};function N4(i){return WR(i)}for(let[i,o]of Object.entries(Ng))cm[i]={get(){let f=L4(this,r3(o.open,o.close,this._styler),this._isEmpty);return Object.defineProperty(this,i,{value:f}),f}};cm.visible={get(){let i=L4(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:i}),i}};var GR=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let i of GR)cm[i]={get(){let{level:o}=this;return function(...f){let p=r3(Ng.color[qR[o]][i](...f),Ng.color.close,this._styler);return L4(this,p,this._isEmpty)}}};for(let i of GR){let o="bg"+i[0].toUpperCase()+i.slice(1);cm[o]={get(){let{level:f}=this;return function(...p){let E=r3(Ng.bgColor[qR[f]][i](...p),Ng.bgColor.close,this._styler);return L4(this,E,this._isEmpty)}}}}var vJ=Object.defineProperties(()=>{},Gf(E0({},cm),{level:{enumerable:!0,get(){return this._generator.level},set(i){this._generator.level=i}}})),r3=(i,o,f)=>{let p,E;return f===void 0?(p=i,E=o):(p=f.openAll+i,E=o+f.closeAll),{open:i,close:o,openAll:p,closeAll:E,parent:f}},L4=(i,o,f)=>{let p=(...E)=>M4(E[0])&&M4(E[0].raw)?YR(p,VR(p,...E)):YR(p,E.length===1?""+E[0]:E.join(" "));return Object.setPrototypeOf(p,vJ),p._generator=i,p._styler=o,p._isEmpty=f,p},YR=(i,o)=>{if(i.level<=0||!o)return i._isEmpty?"":o;let f=i._styler;if(f===void 0)return o;let{openAll:p,closeAll:E}=f;if(o.indexOf("")!==-1)for(;f!==void 0;)o=dJ(o,f.close,f.open),f=f.parent;let t=o.indexOf(`
|
||||
`);return t!==-1&&(o=pJ(o,E,p,t)),p+o+E},i3,VR=(i,...o)=>{let[f]=o;if(!M4(f)||!M4(f.raw))return o.join(" ");let p=o.slice(1),E=[f.raw[0]];for(let t=1;t<f.length;t++)E.push(String(p[t-1]).replace(/[{}\\]/g,"\\$&"),String(f.raw[t]));return i3===void 0&&(i3=jR()),i3(i,E.join(""))};Object.defineProperties(N4.prototype,cm);var F4=N4();F4.supportsColor=t3;F4.stderr=N4({level:n3?n3.level:0});F4.stderr.supportsColor=n3;zR.exports=F4});var o3=ce(Lg=>{"use strict";var mJ=Lg&&Lg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Lg,"__esModule",{value:!0});var Fg=mJ(u3()),yJ=/^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,gJ=/^(ansi|ansi256)\(\s?(\d+)\s?\)$/,b4=(i,o)=>o==="foreground"?i:"bg"+i[0].toUpperCase()+i.slice(1);Lg.default=(i,o,f)=>{if(!o)return i;if(o in Fg.default){let E=b4(o,f);return Fg.default[E](i)}if(o.startsWith("#")){let E=b4("hex",f);return Fg.default[E](o)(i)}if(o.startsWith("ansi")){let E=gJ.exec(o);if(!E)return i;let t=b4(E[1],f),k=Number(E[2]);return Fg.default[t](k)(i)}if(o.startsWith("rgb")||o.startsWith("hsl")||o.startsWith("hsv")||o.startsWith("hwb")){let E=yJ.exec(o);if(!E)return i;let t=b4(E[1],f),k=Number(E[2]),L=Number(E[3]),N=Number(E[4]);return Fg.default[t](k,L,N)(i)}return i}});var XR=ce(bg=>{"use strict";var KR=bg&&bg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(bg,"__esModule",{value:!0});var _J=KR(RR()),l3=KR(o3());bg.default=(i,o,f,p)=>{if(typeof f.style.borderStyle=="string"){let E=f.yogaNode.getComputedWidth(),t=f.yogaNode.getComputedHeight(),k=f.style.borderColor,L=_J.default[f.style.borderStyle],N=l3.default(L.topLeft+L.horizontal.repeat(E-2)+L.topRight,k,"foreground"),C=(l3.default(L.vertical,k,"foreground")+`
|
||||
`).repeat(t-2),U=l3.default(L.bottomLeft+L.horizontal.repeat(E-2)+L.bottomRight,k,"foreground");p.write(i,o,N,{transformers:[]}),p.write(i,o+1,C,{transformers:[]}),p.write(i+E-1,o+1,C,{transformers:[]}),p.write(i,o+t-1,U,{transformers:[]})}}});var JR=ce(Pg=>{"use strict";var ih=Pg&&Pg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pg,"__esModule",{value:!0});var EJ=ih(eh()),DJ=ih(Dw()),wJ=ih(SR()),SJ=ih(kw()),TJ=ih(TR()),CJ=ih(Nw()),xJ=ih(XR()),AJ=(i,o)=>{var f;let p=(f=i.childNodes[0])===null||f===void 0?void 0:f.yogaNode;if(p){let E=p.getComputedLeft(),t=p.getComputedTop();o=`
|
||||
`.repeat(t)+wJ.default(o,E)}return o},QR=(i,o,f)=>{var p;let{offsetX:E=0,offsetY:t=0,transformers:k=[],skipStaticElements:L}=f;if(L&&i.internal_static)return;let{yogaNode:N}=i;if(N){if(N.getDisplay()===EJ.default.DISPLAY_NONE)return;let C=E+N.getComputedLeft(),U=t+N.getComputedTop(),q=k;if(typeof i.internal_transform=="function"&&(q=[i.internal_transform,...k]),i.nodeName==="ink-text"){let W=CJ.default(i);if(W.length>0){let ne=DJ.default(W),m=TJ.default(N);if(ne>m){let we=(p=i.style.textWrap)!==null&&p!==void 0?p:"wrap";W=SJ.default(W,m,we)}W=AJ(i,W),o.write(C,U,W,{transformers:q})}return}if(i.nodeName==="ink-box"&&xJ.default(C,U,i,o),i.nodeName==="ink-root"||i.nodeName==="ink-box")for(let W of i.childNodes)QR(W,o,{offsetX:C,offsetY:U,transformers:q,skipStaticElements:L})}};Pg.default=QR});var $R=ce((Ure,ZR)=>{"use strict";ZR.exports=i=>{i=Object.assign({onlyFirst:!1},i);let o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(o,i.onlyFirst?void 0:"g")}});var t7=ce((jre,s3)=>{"use strict";var RJ=$R(),e7=i=>typeof i=="string"?i.replace(RJ(),""):i;s3.exports=e7;s3.exports.default=e7});var i7=ce((zre,n7)=>{"use strict";var r7="[\uD800-\uDBFF][\uDC00-\uDFFF]";n7.exports=i=>i&&i.exact?new RegExp(`^${r7}$`):new RegExp(r7,"g")});var o7=ce((qre,a3)=>{"use strict";var OJ=t7(),kJ=i7(),u7=i=>OJ(i).replace(kJ()," ").length;a3.exports=u7;a3.exports.default=u7});var f7=ce(Ig=>{"use strict";var l7=Ig&&Ig.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ig,"__esModule",{value:!0});var s7=l7(Rw()),MJ=l7(o7()),a7=class{constructor(o){this.writes=[];let{width:f,height:p}=o;this.width=f,this.height=p}write(o,f,p,E){let{transformers:t}=E;!p||this.writes.push({x:o,y:f,text:p,transformers:t})}get(){let o=[];for(let p=0;p<this.height;p++)o.push(" ".repeat(this.width));for(let p of this.writes){let{x:E,y:t,text:k,transformers:L}=p,N=k.split(`
|
||||
`),C=0;for(let U of N){let q=o[t+C];if(!q)continue;let W=MJ.default(U);for(let ne of L)U=ne(U);o[t+C]=s7.default(q,0,E)+U+s7.default(q,E+W),C++}}return{output:o.map(p=>p.trimRight()).join(`
|
||||
`),height:o.length}}};Ig.default=a7});var p7=ce(Bg=>{"use strict";var f3=Bg&&Bg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Bg,"__esModule",{value:!0});var NJ=f3(eh()),c7=f3(JR()),d7=f3(f7());Bg.default=(i,o)=>{var f;if(i.yogaNode.setWidth(o),i.yogaNode){i.yogaNode.calculateLayout(void 0,void 0,NJ.default.DIRECTION_LTR);let p=new d7.default({width:i.yogaNode.getComputedWidth(),height:i.yogaNode.getComputedHeight()});c7.default(i,p,{skipStaticElements:!0});let E;((f=i.staticNode)===null||f===void 0?void 0:f.yogaNode)&&(E=new d7.default({width:i.staticNode.yogaNode.getComputedWidth(),height:i.staticNode.yogaNode.getComputedHeight()}),c7.default(i.staticNode,E,{skipStaticElements:!1}));let{output:t,height:k}=p.get();return{output:t,outputHeight:k,staticOutput:E?`${E.get().output}
|
||||
`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var y7=ce((Vre,h7)=>{"use strict";var v7=require("stream"),m7=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],c3={},LJ=i=>{let o=new v7.PassThrough,f=new v7.PassThrough;o.write=E=>i("stdout",E),f.write=E=>i("stderr",E);let p=new console.Console(o,f);for(let E of m7)c3[E]=console[E],console[E]=p[E];return()=>{for(let E of m7)console[E]=c3[E];c3={}}};h7.exports=LJ});var p3=ce(d3=>{"use strict";Object.defineProperty(d3,"__esModule",{value:!0});d3.default=new WeakMap});var v3=ce(h3=>{"use strict";Object.defineProperty(h3,"__esModule",{value:!0});var FJ=su(),g7=FJ.createContext({exit:()=>{}});g7.displayName="InternalAppContext";h3.default=g7});var y3=ce(m3=>{"use strict";Object.defineProperty(m3,"__esModule",{value:!0});var bJ=su(),_7=bJ.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});_7.displayName="InternalStdinContext";m3.default=_7});var _3=ce(g3=>{"use strict";Object.defineProperty(g3,"__esModule",{value:!0});var PJ=su(),E7=PJ.createContext({stdout:void 0,write:()=>{}});E7.displayName="InternalStdoutContext";g3.default=E7});var D3=ce(E3=>{"use strict";Object.defineProperty(E3,"__esModule",{value:!0});var IJ=su(),D7=IJ.createContext({stderr:void 0,write:()=>{}});D7.displayName="InternalStderrContext";E3.default=D7});var P4=ce(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});var BJ=su(),w7=BJ.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{}});w7.displayName="InternalFocusContext";w3.default=w7});var T7=ce((Zre,S7)=>{"use strict";var UJ=/[|\\{}()[\]^$+*?.-]/g;S7.exports=i=>{if(typeof i!="string")throw new TypeError("Expected a string");return i.replace(UJ,"\\$&")}});var R7=ce(($re,C7)=>{"use strict";var jJ=T7(),x7=[].concat(require("module").builtinModules,"bootstrap_node","node").map(i=>new RegExp(`(?:\\(${i}\\.js:\\d+:\\d+\\)$|^\\s*at ${i}\\.js:\\d+:\\d+$)`));x7.push(/\(internal\/[^:]+:\d+:\d+\)$/,/\s*at internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var I4=class{constructor(o){o=E0({ignoredPackages:[]},o),"internals"in o||(o.internals=I4.nodeInternals()),"cwd"in o||(o.cwd=process.cwd()),this._cwd=o.cwd.replace(/\\/g,"/"),this._internals=[].concat(o.internals,zJ(o.ignoredPackages)),this._wrapCallSite=o.wrapCallSite||!1}static nodeInternals(){return[...x7]}clean(o,f=0){f=" ".repeat(f),Array.isArray(o)||(o=o.split(`
|
||||
`)),!/^\s*at /.test(o[0])&&/^\s*at /.test(o[1])&&(o=o.slice(1));let p=!1,E=null,t=[];return o.forEach(k=>{if(k=k.replace(/\\/g,"/"),this._internals.some(N=>N.test(k)))return;let L=/^\s*at /.test(k);p?k=k.trimEnd().replace(/^(\s+)at /,"$1"):(k=k.trim(),L&&(k=k.slice(3))),k=k.replace(`${this._cwd}/`,""),k&&(L?(E&&(t.push(E),E=null),t.push(k)):(p=!0,E=k))}),t.map(k=>`${f}${k}
|
||||
`).join("")}captureString(o,f=this.captureString){typeof o=="function"&&(f=o,o=Infinity);let{stackTraceLimit:p}=Error;o&&(Error.stackTraceLimit=o);let E={};Error.captureStackTrace(E,f);let{stack:t}=E;return Error.stackTraceLimit=p,this.clean(t)}capture(o,f=this.capture){typeof o=="function"&&(f=o,o=Infinity);let{prepareStackTrace:p,stackTraceLimit:E}=Error;Error.prepareStackTrace=(L,N)=>this._wrapCallSite?N.map(this._wrapCallSite):N,o&&(Error.stackTraceLimit=o);let t={};Error.captureStackTrace(t,f);let{stack:k}=t;return Object.assign(Error,{prepareStackTrace:p,stackTraceLimit:E}),k}at(o=this.at){let[f]=this.capture(1,o);if(!f)return{};let p={line:f.getLineNumber(),column:f.getColumnNumber()};A7(p,f.getFileName(),this._cwd),f.isConstructor()&&(p.constructor=!0),f.isEval()&&(p.evalOrigin=f.getEvalOrigin()),f.isNative()&&(p.native=!0);let E;try{E=f.getTypeName()}catch(L){}E&&E!=="Object"&&E!=="[object Object]"&&(p.type=E);let t=f.getFunctionName();t&&(p.function=t);let k=f.getMethodName();return k&&t!==k&&(p.method=k),p}parseLine(o){let f=o&&o.match(qJ);if(!f)return null;let p=f[1]==="new",E=f[2],t=f[3],k=f[4],L=Number(f[5]),N=Number(f[6]),C=f[7],U=f[8],q=f[9],W=f[10]==="native",ne=f[11]===")",m,we={};if(U&&(we.line=Number(U)),q&&(we.column=Number(q)),ne&&C){let Se=0;for(let he=C.length-1;he>0;he--)if(C.charAt(he)===")")Se++;else if(C.charAt(he)==="("&&C.charAt(he-1)===" "&&(Se--,Se===-1&&C.charAt(he-1)===" ")){let ge=C.slice(0,he-1);C=C.slice(he+1),E+=` (${ge}`;break}}if(E){let Se=E.match(HJ);Se&&(E=Se[1],m=Se[2])}return A7(we,C,this._cwd),p&&(we.constructor=!0),t&&(we.evalOrigin=t,we.evalLine=L,we.evalColumn=N,we.evalFile=k&&k.replace(/\\/g,"/")),W&&(we.native=!0),E&&(we.function=E),m&&E!==m&&(we.method=m),we}};function A7(i,o,f){o&&(o=o.replace(/\\/g,"/"),o.startsWith(`${f}/`)&&(o=o.slice(f.length+1)),i.file=o)}function zJ(i){if(i.length===0)return[];let o=i.map(f=>jJ(f));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${o.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var qJ=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),HJ=/^(.*?) \[as (.*?)\]$/;C7.exports=I4});var k7=ce((eie,O7)=>{"use strict";O7.exports=(i,o)=>i.replace(/^\t+/gm,f=>" ".repeat(f.length*(o||2)))});var N7=ce((tie,M7)=>{"use strict";var WJ=k7(),VJ=(i,o)=>{let f=[],p=i-o,E=i+o;for(let t=p;t<=E;t++)f.push(t);return f};M7.exports=(i,o,f)=>{if(typeof i!="string")throw new TypeError("Source code is missing.");if(!o||o<1)throw new TypeError("Line number must start from `1`.");if(i=WJ(i).split(/\r?\n/),!(o>i.length))return f=E0({around:3},f),VJ(o,f.around).filter(p=>i[p-1]!==void 0).map(p=>({line:p,value:i[p-1]}))}});var B4=ce(Zf=>{"use strict";var GJ=Zf&&Zf.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),YJ=Zf&&Zf.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),KJ=Zf&&Zf.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&GJ(o,i,f);return YJ(o,i),o},XJ=Zf&&Zf.__rest||function(i,o){var f={};for(var p in i)Object.prototype.hasOwnProperty.call(i,p)&&o.indexOf(p)<0&&(f[p]=i[p]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var E=0,p=Object.getOwnPropertySymbols(i);E<p.length;E++)o.indexOf(p[E])<0&&Object.prototype.propertyIsEnumerable.call(i,p[E])&&(f[p[E]]=i[p[E]]);return f};Object.defineProperty(Zf,"__esModule",{value:!0});var L7=KJ(su()),S3=L7.forwardRef((i,o)=>{var{children:f}=i,p=XJ(i,["children"]);let E=Object.assign(Object.assign({},p),{marginLeft:p.marginLeft||p.marginX||p.margin||0,marginRight:p.marginRight||p.marginX||p.margin||0,marginTop:p.marginTop||p.marginY||p.margin||0,marginBottom:p.marginBottom||p.marginY||p.margin||0,paddingLeft:p.paddingLeft||p.paddingX||p.padding||0,paddingRight:p.paddingRight||p.paddingX||p.padding||0,paddingTop:p.paddingTop||p.paddingY||p.padding||0,paddingBottom:p.paddingBottom||p.paddingY||p.padding||0});return L7.default.createElement("ink-box",{ref:o,style:E},f)});S3.displayName="Box";S3.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};Zf.default=S3});var x3=ce(Ug=>{"use strict";var T3=Ug&&Ug.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ug,"__esModule",{value:!0});var QJ=T3(su()),dm=T3(u3()),F7=T3(o3()),C3=({color:i,backgroundColor:o,dimColor:f,bold:p,italic:E,underline:t,strikethrough:k,inverse:L,wrap:N,children:C})=>{if(C==null)return null;let U=q=>(f&&(q=dm.default.dim(q)),i&&(q=F7.default(q,i,"foreground")),o&&(q=F7.default(q,o,"background")),p&&(q=dm.default.bold(q)),E&&(q=dm.default.italic(q)),t&&(q=dm.default.underline(q)),k&&(q=dm.default.strikethrough(q)),L&&(q=dm.default.inverse(q)),q);return QJ.default.createElement("ink-text",{style:{fLine truncated
|
||||
`).slice(1):void 0,f=o?I7.parseLine(o[0]):void 0,p,E=0;if((f==null?void 0:f.file)&&(f==null?void 0:f.line)&&b7.existsSync(f.file)){let t=b7.readFileSync(f.file,"utf8");if(p=eZ.default(t,f.line),p)for(let{line:k}of p)E=Math.max(E,String(k).length)}return Vo.default.createElement(Q1.default,{flexDirection:"column",padding:1},Vo.default.createElement(Q1.default,null,Vo.default.createElement(Ic.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),Vo.default.createElement(Ic.default,null," ",i.message)),f&&Vo.default.createElement(Q1.default,{marginTop:1},Vo.default.createElement(Ic.default,{dimColor:!0},f.file,":",f.line,":",f.column)),f&&p&&Vo.default.createElement(Q1.default,{marginTop:1,flexDirection:"column"},p.map(({line:t,value:k})=>Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Q1.default,{width:E+1},Vo.default.createElement(Ic.default,{dimColor:t!==f.line,backgroundColor:t===f.line?"red":void 0,color:t===f.line?"white":void 0},String(t).padStart(E," "),":")),Vo.default.createElement(Ic.default,{key:t,backgroundColor:t===f.line?"red":void 0,color:t===f.line?"white":void 0}," "+k)))),i.stack&&Vo.default.createElement(Q1.default,{marginTop:1,flexDirection:"column"},i.stack.split(`
|
||||
`).slice(1).map(t=>{let k=I7.parseLine(t);return k?Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Ic.default,{dimColor:!0},"- "),Vo.default.createElement(Ic.default,{dimColor:!0,bold:!0},k.function),Vo.default.createElement(Ic.default,{dimColor:!0,color:"gray"}," ","(",k.file,":",k.line,":",k.column,")")):Vo.default.createElement(Q1.default,{key:t},Vo.default.createElement(Ic.default,{dimColor:!0},"- "),Vo.default.createElement(Ic.default,{dimColor:!0,bold:!0},t))})))};$f.default=tZ});var j7=ce(ec=>{"use strict";var nZ=ec&&ec.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),rZ=ec&&ec.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),iZ=ec&&ec.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&nZ(o,i,f);return rZ(o,i),o},uh=ec&&ec.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ec,"__esModule",{value:!0});var oh=iZ(su()),U7=uh(ZD()),uZ=uh(v3()),oZ=uh(y3()),lZ=uh(_3()),sZ=uh(D3()),aZ=uh(P4()),fZ=uh(B7()),cZ=" ",dZ="[Z",pZ="",A3=class extends oh.PureComponent{constructor(){super(...arguments);this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=o=>{let{stdin:f}=this.props;if(!this.isRawModeSupported())throw f===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
|
||||
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
|
||||
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(f.setEncoding("utf8"),o){this.rawModeEnabledCount===0&&(f.addListener("data",this.handleInput),f.resume(),f.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount==0&&(f.setRawMode(!1),f.removeListener("data",this.handleInput),f.pause())},this.handleInput=o=>{o===""&&this.props.exitOnCtrlC&&this.handleExit(),o===pZ&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(o===cZ&&this.focusNext(),o===dZ&&this.focusPrevious())},this.handleExit=o=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(o)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focusNext=()=>{this.setState(o=>{let f=o.focusables[0].id;return{activeFocusId:this.findNextFocusable(o)||f}})},this.focusPrevious=()=>{this.setState(o=>{let f=o.focusables[o.focusables.length-1].id;return{activeFocusId:this.findPreviousFocusable(o)||f}})},this.addFocusable=(o,{autoFocus:f})=>{this.setState(p=>{let E=p.activeFocusId;return!E&&f&&(E=o),{activeFocusId:E,focusables:[...p.focusables,{id:o,isActive:!0}]}})},this.removeFocusable=o=>{this.setState(f=>({activeFocusId:f.activeFocusId===o?void 0:f.activeFocusId,focusables:f.focusables.filter(p=>p.id!==o)}))},this.activateFocusable=o=>{this.setState(f=>({focusables:f.focusables.map(p=>p.id!==o?p:{id:o,isActive:!0})}))},this.deactivateFocusable=o=>{this.setState(f=>({activeFocusId:f.activeFocusId===o?void 0:f.activeFocusId,focusables:f.focusables.map(p=>p.id!==o?p:{id:o,isActive:!1})}))},this.findNextFocusable=o=>{let f=o.focusables.findIndex(p=>p.id===o.activeFocusId);for(let p=f+1;p<o.focusables.length;p++)if(o.focusables[p].isActive)return o.focusables[p].id},this.findPreviousFocusable=o=>{let f=o.focusables.findIndex(p=>p.id===o.activeFocusId);for(let p=f-1;p>=0;p--)if(o.focusables[p].isActive)return o.focusables[p].id}}static getDerivedStateFromError(o){return{error:o}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return oh.default.createElement(uZ.default.Provider,{value:{exit:this.handleExit}},oh.default.createElement(oZ.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},oh.default.createElement(lZ.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},oh.default.createElement(sZ.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},oh.default.createElement(aZ.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious}},this.state.error?oh.default.createElement(fZ.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){U7.default.hide(this.props.stdout)}componentWillUnmount(){U7.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(o){this.handleExit(o)}};ec.default=A3;A3.displayName="InternalApp"});var W7=ce(tc=>{"use strict";var hZ=tc&&tc.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),vZ=tc&&tc.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),mZ=tc&&tc.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&hZ(o,i,f);return vZ(o,i),o},nc=tc&&tc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(tc,"__esModule",{value:!0});var yZ=nc(su()),z7=B5(),gZ=nc(Z5()),_Z=nc(GD()),EZ=nc(u9()),DZ=nc(l9()),U4=nc(DR()),wZ=nc(p7()),SZ=nc(JD()),TZ=nc(y7()),CZ=mZ(Lw()),xZ=nc(p3()),AZ=nc(j7()),pm=process.env.CI==="false"?!1:EZ.default,q7=()=>{},H7=class{constructor(o){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:f,outputHeight:p,staticOutput:E}=wZ.default(this.rootNode,this.options.stdout.columns||80),t=E&&E!==`
|
||||
`;if(this.options.debug){t&&(this.fullStaticOutput+=E),this.options.stdout.write(this.fullStaticOutput+f);return}if(pm){t&&this.options.stdout.write(E),this.lastOutput=f;return}if(t&&(this.fullStaticOutput+=E),p>=this.options.stdout.rows){this.options.stdout.write(_Z.default.clearTerminal+this.fullStaticOutput+f),this.lastOutput=f;return}t&&(this.log.clear(),this.options.stdout.write(E),this.log(f)),!t&&f!==this.lastOutput&&this.throttledLog(f),this.lastOutput=f},DZ.default(this),this.options=o,this.rootNode=CZ.createNode("ink-root"),this.rootNode.onRender=o.debug?this.onRender:z7.throttle(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=gZ.default.create(o.stdout),this.throttledLog=o.debug?this.log:z7.throttle(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=U4.default.createContainer(this.rootNode,!1,!1),this.unsubscribeExit=SZ.default(this.unmount,{alwaysLast:!1}),process.env.DEV==="true"&&U4.default.injectIntoDevTools({bundleType:0,version:"16.13.1",rendererPackageName:"ink"}),o.patchConsole&&this.patchConsole(),pm||(o.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{o.stdout.off("resize",this.onRender)})}render(o){let f=yZ.default.createElement(AZ.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},o);U4.default.updateContainer(f,this.container,null,q7)}writeToStdout(o){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(o+this.fullStaticOutput+this.lastOutput);return}if(pm){this.options.stdout.write(o);return}this.log.clear(),this.options.stdout.write(o),this.log(this.lastOutput)}}writeToStderr(o){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(o),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(pm){this.options.stderr.write(o);return}this.log.clear(),this.options.stderr.write(o),this.log(this.lastOutput)}}unmount(o){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),pm?this.options.stdout.write(this.lastOutput+`
|
||||
`):this.options.debug||this.log.done(),this.isUnmounted=!0,U4.default.updateContainer(null,this.container,null,q7),xZ.default.delete(this.options.stdout),o instanceof Error?this.rejectExitPromise(o):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((o,f)=>{this.resolveExitPromise=o,this.rejectExitPromise=f})),this.exitPromise}clear(){!pm&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=TZ.default((o,f)=>{o==="stdout"&&this.writeToStdout(f),o==="stderr"&&(f.startsWith("The above error occurred")||this.writeToStderr(f))}))}};tc.default=H7});var G7=ce(zg=>{"use strict";var V7=zg&&zg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(zg,"__esModule",{value:!0});var RZ=V7(W7()),j4=V7(p3()),OZ=require("stream"),NZ=(i,o)=>{let f=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},kZ(o)),p=MZ(f.stdout,()=>new RZ.default(f));return p.render(i),{rerender:p.render,unmount:()=>p.unmount(),waitUntilExit:p.waitUntilExit,cleanup:()=>j4.default.delete(f.stdout),clear:p.clear}};zg.default=NZ;var kZ=(i={})=>i instanceof OZ.Stream?{stdout:i,stdin:process.stdin}:i,MZ=(i,o)=>{let f;return j4.default.has(i)?f=j4.default.get(i):(f=o(),j4.default.set(i,f)),f}});var K7=ce(J1=>{"use strict";var LZ=J1&&J1.__createBinding||(Object.create?function(i,o,f,p){p===void 0&&(p=f),Object.defineProperty(i,p,{enumerable:!0,get:function(){return o[f]}})}:function(i,o,f,p){p===void 0&&(p=f),i[p]=o[f]}),FZ=J1&&J1.__setModuleDefault||(Object.create?function(i,o){Object.defineProperty(i,"default",{enumerable:!0,value:o})}:function(i,o){i.default=o}),bZ=J1&&J1.__importStar||function(i){if(i&&i.__esModule)return i;var o={};if(i!=null)for(var f in i)f!=="default"&&Object.hasOwnProperty.call(i,f)&&LZ(o,i,f);return FZ(o,i),o};Object.defineProperty(J1,"__esModule",{value:!0});var qg=bZ(su()),Y7=i=>{let{items:o,children:f,style:p}=i,[E,t]=qg.useState(0),k=qg.useMemo(()=>o.slice(E),[o,E]);qg.useLayoutEffect(()=>{t(o.length)},[o.length]);let L=k.map((C,U)=>f(C,E+U)),N=qg.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},p),[p]);return qg.default.createElement("ink-box",{internal_static:!0,style:N},L)};Y7.displayName="Static";J1.default=Y7});var Q7=ce(Hg=>{"use strict";var PZ=Hg&&Hg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Hg,"__esModule",{value:!0});var IZ=PZ(su()),X7=({children:i,transform:o})=>i==null?null:IZ.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:o},i);X7.displayName="Transform";Hg.default=X7});var Z7=ce(Wg=>{"use strict";var BZ=Wg&&Wg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Wg,"__esModule",{value:!0});var UZ=BZ(su()),J7=({count:i=1})=>UZ.default.createElement("ink-text",null,`
|
||||
`.repeat(i));J7.displayName="Newline";Wg.default=J7});var tO=ce(Vg=>{"use strict";var $7=Vg&&Vg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Vg,"__esModule",{value:!0});var jZ=$7(su()),zZ=$7(B4()),eO=()=>jZ.default.createElement(zZ.default,{flexGrow:1});eO.displayName="Spacer";Vg.default=eO});var z4=ce(Gg=>{"use strict";var qZ=Gg&&Gg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gg,"__esModule",{value:!0});var HZ=su(),WZ=qZ(y3()),VZ=()=>HZ.useContext(WZ.default);Gg.default=VZ});var rO=ce(Yg=>{"use strict";var GZ=Yg&&Yg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Yg,"__esModule",{value:!0});var nO=su(),YZ=GZ(z4()),KZ=(i,o={})=>{let{stdin:f,setRawMode:p,internal_exitOnCtrlC:E}=YZ.default();nO.useEffect(()=>{if(o.isActive!==!1)return p(!0),()=>{p(!1)}},[o.isActive,p]),nO.useEffect(()=>{if(o.isActive===!1)return;let t=k=>{let L=String(k),N={upArrow:L==="[A",downArrow:L==="[B",leftArrow:L==="[D",rightArrow:L==="[C",pageDown:L==="[6~",pageUp:L==="[5~",return:L==="\r",escape:L==="",ctrl:!1,shift:!1,tab:L===" "||L==="[Z",backspace:L==="\b",delete:L==="\x7F"||L==="[3~",meta:!1};L<=""&&!N.return&&(L=String.fromCharCode(L.charCodeAt(0)+"a".charCodeAt(0)-1),N.ctrl=!0),L.startsWith("")&&(L=L.slice(1),N.meta=!0);let C=L>="A"&&L<="Z",U=L>="\u0410"&&L<="\u042F";L.length===1&&(C||U)&&(N.shift=!0),N.tab&&L==="[Z"&&(N.shift=!0),(N.tab||N.backspace||N.delete)&&(L=""),(!(L==="c"&&N.ctrl)||!E)&&i(L,N)};return f==null||f.on("data",t),()=>{f==null||f.off("data",t)}},[o.isActive,f,E,i])};Yg.default=KZ});var iO=ce(Kg=>{"use strict";var XZ=Kg&&Kg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Kg,"__esModule",{value:!0});var QZ=su(),JZ=XZ(v3()),ZZ=()=>QZ.useContext(JZ.default);Kg.default=ZZ});var uO=ce(Xg=>{"use strict";var $Z=Xg&&Xg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Xg,"__esModule",{value:!0});var e$=su(),t$=$Z(_3()),n$=()=>e$.useContext(t$.default);Xg.default=n$});var oO=ce(Qg=>{"use strict";var r$=Qg&&Qg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Qg,"__esModule",{value:!0});var i$=su(),u$=r$(D3()),o$=()=>i$.useContext(u$.default);Qg.default=o$});var sO=ce(Jg=>{"use strict";var lO=Jg&&Jg.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Jg,"__esModule",{value:!0});var Zg=su(),l$=lO(P4()),s$=lO(z4()),a$=({isActive:i=!0,autoFocus:o=!1}={})=>{let{isRawModeSupported:f,setRawMode:p}=s$.default(),{activeId:E,add:t,remove:k,activate:L,deactivate:N}=Zg.useContext(l$.default),C=Zg.useMemo(()=>Math.random().toString().slice(2,7),[]);return Zg.useEffect(()=>(t(C,{autoFocus:o}),()=>{k(C)}),[C,o]),Zg.useEffect(()=>{i?L(C):N(C)},[i,C]),Zg.useEffect(()=>{if(!(!f||!i))return p(!0),()=>{p(!1)}},[i]),{isFocused:Boolean(C)&&E===C}};Jg.default=a$});var aO=ce($g=>{"use strict";var f$=$g&&$g.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($g,"__esModule",{value:!0});var c$=su(),d$=f$(P4()),p$=()=>{let i=c$.useContext(d$.default);return{enableFocus:i.enableFocus,disableFocus:i.disableFocus,focusNext:i.focusNext,focusPrevious:i.focusPrevious}};$g.default=p$});var fO=ce(R3=>{"use strict";Object.defineProperty(R3,"__esModule",{value:!0});R3.default=i=>{var o,f,p,E;return{width:(f=(o=i.yogaNode)===null||o===void 0?void 0:o.getComputedWidth())!==null&&f!==void 0?f:0,height:(E=(p=i.yogaNode)===null||p===void 0?void 0:p.getComputedHeight())!==null&&E!==void 0?E:0}}});var lh=ce(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var h$=G7();Object.defineProperty(ql,"render",{enumerable:!0,get:function(){return h$.default}});var v$=B4();Object.defineProperty(ql,"Box",{enumerable:!0,get:function(){return v$.default}});var m$=x3();Object.defineProperty(ql,"Text",{enumerable:!0,get:function(){return m$.default}});var y$=K7();Object.defineProperty(ql,"Static",{enumerable:!0,get:function(){return y$.default}});var g$=Q7();Object.defineProperty(ql,"Transform",{enumerable:!0,get:function(){return g$.default}});var _$=Z7();Object.defineProperty(ql,"Newline",{enumerable:!0,get:function(){return _$.default}});var E$=tO();Object.defineProperty(ql,"Spacer",{enumerable:!0,get:function(){return E$.default}});var D$=rO();Object.defineProperty(ql,"useInput",{enumerable:!0,get:function(){return D$.default}});var w$=iO();Object.defineProperty(ql,"useApp",{enumerable:!0,get:function(){return w$.default}});var S$=z4();Object.defineProperty(ql,"useStdin",{enumerable:!0,get:function(){return S$.default}});var T$=uO();Object.defineProperty(ql,"useStdout",{enumerable:!0,get:function(){return T$.default}});var C$=oO();Object.defineProperty(ql,"useStderr",{enumerable:!0,get:function(){return C$.default}});var x$=sO();Object.defineProperty(ql,"useFocus",{enumerable:!0,get:function(){return x$.default}});var A$=aO()
Line truncated
|
||||
- ${L.map(ne=>D0.npath.fromPortablePath(ne)).join(`
|
||||
- `)}`);let N=new Set(Gi.miscUtils.mapAndFilter(t,ne=>{let m=i.tryWorkspaceByFilePath(ne);return m===null?Gi.miscUtils.mapAndFilter.skip:m}));if(L.length===0&&N.size===0&&!o)return null;let C=L.length===1?L[0]:D0.ppath.join(k,`${Gi.hashUtils.makeHash(Math.random().toString()).slice(0,8)}.yml`),U=D0.xfs.existsSync(C)?await D0.xfs.readFilePromise(C,"utf8"):"{}",q=(0,W1.parseSyml)(U),W=new Map;for(let ne of q.declined||[]){let m=Gi.structUtils.parseIdent(ne),we=i.getWorkspaceByIdent(m);W.set(we,Nu.DECLINE)}for(let[ne,m]of Object.entries(q.releases||{})){let we=Gi.structUtils.parseIdent(ne),Se=i.getWorkspaceByIdent(we);W.set(Se,Zv(m))}return{project:i,root:p,baseHash:E!==null?E.hash:null,baseTitle:E!==null?E.title:null,changedFiles:new Set(t),changedWorkspaces:N,releaseRoots:new Set([...N].filter(ne=>ne.manifest.version!==null)),releases:W,async saveAll(){let ne={},m=[],we=[];for(let Se of i.workspaces){if(Se.manifest.version===null)continue;let he=Gi.structUtils.stringifyIdent(Se.locator),ge=W.get(Se);ge===Nu.DECLINE?m.push(he):typeof ge!="undefined"?ne[he]=Zv(ge):N.has(Se)&&we.push(he)}await D0.xfs.mkdirPromise(D0.ppath.dirname(C),{recursive:!0}),await D0.xfs.changeFilePromise(C,(0,W1.stringifySyml)(new W1.stringifySyml.PreserveOrdering({releases:Object.keys(ne).length>0?ne:void 0,declined:m.length>0?m:void 0,undecided:we.length>0?we:void 0})))}}}function yK(i){return K_(i).size>0||Zy(i).length>0}function K_(i){let o=new Set;for(let f of i.changedWorkspaces)f.manifest.version!==null&&(i.releases.has(f)||o.add(f));return o}function Zy(i,{include:o=new Set}={}){let f=[],p=new Map(Gi.miscUtils.mapAndFilter([...i.releases],([t,k])=>k===Nu.DECLINE?Gi.miscUtils.mapAndFilter.skip:[t.anchoredLocator.locatorHash,t])),E=new Map(Gi.miscUtils.mapAndFilter([...i.releases],([t,k])=>k!==Nu.DECLINE?Gi.miscUtils.mapAndFilter.skip:[t.anchoredLocator.locatorHash,t]));for(let t of i.project.workspaces)if(!(!o.has(t)&&(E.has(t.anchoredLocator.locatorHash)||p.has(t.anchoredLocator.locatorHash)))&&t.manifest.version!==null)for(let k of Gi.Manifest.hardDependencies)for(let L of t.manifest.getForScope(k).values()){let N=i.project.tryWorkspaceByDescriptor(L);N!==null&&p.has(N.anchoredLocator.locatorHash)&&f.push([t,N])}return f}function MD(i,o){let f=Fc.default.clean(o);for(let p of Object.values(Nu))if(p!==Nu.UNDECIDED&&p!==Nu.DECLINE&&Fc.default.inc(i,p)===f)return p;return null}function Y_(i,o){if(Fc.default.valid(o))return o;if(i===null)throw new Jv.UsageError(`Cannot apply the release strategy "${o}" unless the workspace already has a valid version`);if(!Fc.default.valid(i))throw new Jv.UsageError(`Cannot apply the release strategy "${o}" on a non-semver version (${i})`);let f=Fc.default.inc(i,o);if(f===null)throw new Jv.UsageError(`Cannot apply the release strategy "${o}" on the specified version (${i})`);return f}function ND(i,o,{report:f}){let p=new Map;for(let E of i.workspaces)for(let t of Gi.Manifest.allDependencies)for(let k of E.manifest[t].values()){let L=i.tryWorkspaceByDescriptor(k);if(L===null||!o.has(L))continue;Gi.miscUtils.getArrayWithDefault(p,L).push([E,t,k.identHash])}for(let[E,t]of o){let k=E.manifest.version;E.manifest.version=t,Fc.default.prerelease(t)===null?delete E.manifest.raw.stableVersion:E.manifest.raw.stableVersion||(E.manifest.raw.stableVersion=k);let L=E.manifest.name!==null?Gi.structUtils.stringifyIdent(E.manifest.name):null;f.reportInfo(Gi.MessageName.UNNAMED,`${Gi.structUtils.prettyLocator(i.configuration,E.anchoredLocator)}: Bumped to ${t}`),f.reportJson({cwd:D0.npath.fromPortablePath(E.cwd),ident:L,oldVersion:k,newVersion:t});let N=p.get(E);if(typeof N!="undefined")for(let[C,U,q]of N){let W=C.manifest[U].get(q);if(typeof W=="undefined")throw new Error("Assertion failed: The dependency should have existed");let ne=W.range,m=!1;if(ne.startsWith(Gi.WorkspaceResolver.protocol)&&(ne=ne.slice(Gi.WorkspaceResolver.protocol.length),m=!0,ne===E.relativeCwd))continue;let we=ne.match(mK);if(!we){f.reportWarning(Gi.MessageName.UNNAMED,`Couldn't auto-upgrade range ${ne} (in ${Gi.structUtils.prettyLocator(i.configuration,C.anchoredLocator)})`);continue}let Se=`${we[1]}${t}`;m&&(Se=`${Gi.WorkspaceResolver.protocol}${Se}`);let he=Gi.structUtils.makeDescriptor(W,Se);C.manifest[U].set(q,he)}}}var gK=new Map([["%n",{extract:i=>i.length>=1?[i[0],i.slice(1)]:null,generate:(i=0)=>`${i+1}`}]]);function v5(i,{current:o,prerelease:f}){let p=new Fc.default.SemVer(o),E=p.prerelease.slice(),t=[];p.prerelease=[],p.format()!==i&&(E.length=0);let k=!0,L=f.split(/\./g);for(let N of L){let C=gK.get(N);if(typeof C=="undefined")t.push(N),E[0]===N?E.shift():k=!1;else{let U=k?C.extract(E):null;U!==null&&typeof U[0]=="number"?(t.push(C.generate(U[0])),E=U[1]):(t.push(C.generate()),k=!1)}}return p.prerelease&&(p.prerelease=[]),`${i}-${t.join(".")}`}var $y=class extends X_.BaseCommand{constructor(){super(...arguments);this.all=cd.Option.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryLine truncated
|
||||
This command will apply the deferred version changes and remove their definitions from the repository.
|
||||
|
||||
Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%d\`) will be used on all new versions and the version definitions will be kept as-is.
|
||||
|
||||
By default only the current workspace will be bumped, but you can configure this behavior by using one of:
|
||||
|
||||
- \`--recursive\` to also apply the version bump on its dependencies
|
||||
- \`--all\` to apply the version bump on all packages in the repository
|
||||
|
||||
Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump.
|
||||
`,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]});var m5=$y;var e_=Mi(require("@yarnpkg/cli")),s0=Mi(require("@yarnpkg/core")),rc=Mi(require("@yarnpkg/fslib"));var cO=Mi(lh()),sh=Mi(su()),dO=(0,sh.memo)(({active:i})=>{let o=(0,sh.useMemo)(()=>i?"\u25C9":"\u25EF",[i]),f=(0,sh.useMemo)(()=>i?"green":"yellow",[i]);return sh.default.createElement(cO.Text,{color:f},o)});var yd=Mi(lh()),Js=Mi(su());var pO=Mi(lh()),q4=Mi(su());function hm({active:i},o,f){let{stdin:p}=(0,pO.useStdin)(),E=(0,q4.useCallback)((t,k)=>o(t,k),f);(0,q4.useEffect)(()=>{if(!(!i||!p))return p.on("keypress",E),()=>{p.off("keypress",E)}},[i,E,p])}var ah;(function(f){f.BEFORE="before",f.AFTER="after"})(ah||(ah={}));var hO=function({active:i},o,f){hm({active:i},(p,E)=>{E.name==="tab"&&(E.shift?o(ah.BEFORE):o(ah.AFTER))},f)};var H4=function(i,o,{active:f,minus:p,plus:E,set:t,loop:k=!0}){hm({active:f},(L,N)=>{let C=o.indexOf(i);switch(N.name){case p:{let U=C-1;if(k){t(o[(o.length+U)%o.length]);return}if(U<0)return;t(o[U])}break;case E:{let U=C+1;if(k){t(o[U%o.length]);return}if(U>=o.length)return;t(o[U])}break}},[o,i,E,t,k])};var O3=({active:i=!0,children:o=[],radius:f=10,size:p=1,loop:E=!0,onFocusRequest:t,willReachEnd:k})=>{let L=Se=>{if(Se.key===null)throw new Error("Expected all children to have a key");return Se.key},N=Js.default.Children.map(o,Se=>L(Se)),C=N[0],[U,q]=(0,Js.useState)(C),W=N.indexOf(U);(0,Js.useEffect)(()=>{N.includes(U)||q(C)},[o]),(0,Js.useEffect)(()=>{k&&W>=N.length-2&&k()},[W]),hO({active:i&&!!t},Se=>{t==null||t(Se)},[t]),H4(U,N,{active:i,minus:"up",plus:"down",set:q,loop:E});let ne=W-f,m=W+f;m>N.length&&(ne-=m-N.length,m=N.length),ne<0&&(m+=-ne,ne=0),m>=N.length&&(m=N.length-1);let we=[];for(let Se=ne;Se<=m;++Se){let he=N[Se],ge=i&&he===U;we.push(Js.default.createElement(yd.Box,{key:he,height:p},Js.default.createElement(yd.Box,{marginLeft:1,marginRight:1},Js.default.createElement(yd.Text,null,ge?Js.default.createElement(yd.Text,{color:"cyan",bold:!0},">"):" ")),Js.default.createElement(yd.Box,null,Js.default.cloneElement(o[Se],{active:ge}))))}return Js.default.createElement(yd.Box,{flexDirection:"column",width:"100%"},we)};var W4=Mi(lh()),k3=Mi(su());var vO=Mi(lh()),Z1=Mi(su()),mO=Mi(require("readline")),O$=Z1.default.createContext(null),yO=({children:i})=>{let{stdin:o,setRawMode:f}=(0,vO.useStdin)();(0,Z1.useEffect)(()=>{f&&f(!0),o&&(0,mO.emitKeypressEvents)(o)},[o,f]);let[p,E]=(0,Z1.useState)(new Map),t=(0,Z1.useMemo)(()=>({getAll:()=>p,get:k=>p.get(k),set:(k,L)=>E(new Map([...p,[k,L]]))}),[p,E]);return Z1.default.createElement(O$.Provider,{value:t,children:i})};async function gO(i,o,{stdin:f,stdout:p,stderr:E}={}){let t,k=N=>{let{exit:C}=(0,W4.useApp)();hm({active:!0},(U,q)=>{q.name==="return"&&(t=N,C())},[C,N])},{waitUntilExit:L}=(0,W4.render)(k3.default.createElement(yO,null,k3.default.createElement(i,Gf(E0({},o),{useSubmit:k}))),{stdin:f,stdout:p,stderr:E});return await L(),t}var fh=Mi(require("clipanion")),Dr=Mi(lh()),Tn=Mi(su()),V4=Mi(require("semver"));var t_=class extends e_.BaseCommand{constructor(){super(...arguments);this.interactive=fh.Option.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){let o=await s0.Configuration.find(this.context.cwd,this.context.plugins),{project:f,workspace:p}=await s0.Project.find(o,this.context.cwd);if(!p)throw new e_.WorkspaceRequiredError(f.cwd,this.context.cwd);await f.restoreInstallState();let E=await $v(f);if(E===null||E.releaseRoots.size===0)return 0;if(E.root===null)throw new fh.UsageError("This command can only be run on Git repositories");let t=()=>Tn.default.createElement(Dr.Box,{flexDirection:"row",paddingBottom:1},Tn.default.createElement(Dr.Box,{flexDirection:"column",width:60},Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<up>"),"/",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<down>")," to select workspaces.")),Tn.default.createElement(Dr.Box,null,Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<left>"),"/",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<right>")," to select release strategies."))),Tn.default.createElement(Dr.Box,{flexDirection:"column"},Tn.default.createElement(Dr.Box,{marginLeft:1},Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<enter>")," to save.")),Tn.default.createElement(Dr.Box,{marginLeft:1},Tn.default.createElement(Dr.Text,null,"Press ",Tn.default.createElement(Dr.Text,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),k=({workspace:W,active:ne,decision:m,setDec
Line truncated
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react-debug-tools.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.18.0
|
||||
* scheduler-tracing.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.18.0
|
||||
* scheduler-tracing.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.18.0
|
||||
* scheduler.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.18.0
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.24.0
|
||||
* react-reconciler.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v0.24.0
|
||||
* react-reconciler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v16.13.1
|
||||
* react.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
return plugin;
|
||||
}
|
||||
};
|
||||
Whitespace-only changes.
+294
@@ -0,0 +1,294 @@
|
||||
# domino x.x.x (not yet released)
|
||||
|
||||
# domino 2.1.6 (16 Jul 2020)
|
||||
* Bumped version of lodash (#169)
|
||||
* Performance improvement to DOMTokenList (#166)
|
||||
* `mocha` dependency has been updated to 6.x. As a result, we are
|
||||
no longer testing on node 4.
|
||||
|
||||
# domino 2.1.5 (30 Apr 2020)
|
||||
* Bumped version of jquery dev dependency (#163)
|
||||
* Omit tests/ directory from NPM package (#161)
|
||||
|
||||
# domino 2.1.4 (16 Dec 2019)
|
||||
* Bug fix for `Element#closest` when selector doesn't match (#154)
|
||||
|
||||
# domino 2.1.3 (6 Mar 2019)
|
||||
* Bug fix for CSS `$=` selector and for matches on root `<html>` element.
|
||||
* Renamed CSS `:matches` to `:is`
|
||||
( https://github.com/w3c/csswg-drafts/issues/3258 )
|
||||
* Bug fix for CSS matches with escape characters in tag name.
|
||||
|
||||
# domino 2.1.2 (14 Feb 2019)
|
||||
* Allow writable Element constructors unless __domino_frozen__ is set to true (#138)
|
||||
* Bug fix for CSS `$=` selector. (#135)
|
||||
* Move `Node#_serializeOne()` to `NodeUtils.serializeOne()` to reduce pressure
|
||||
on the megamorphic stub cache in V8, and thereby improve throughput (#142).
|
||||
* Implemented `HTMLOptionElement#text` and `HTMLOptionElement#value` (#136)
|
||||
|
||||
# domino 2.1.1 (30 Nov 2018)
|
||||
* Add `domino.createIncrementalHTMLParser` interface.
|
||||
|
||||
# domino 2.1.0 (13 Aug 2018)
|
||||
* Fix `ContainerNode#removeChildren()` when there is more than one child (#129)
|
||||
* Implement `Document#scrollingElement` (#107)
|
||||
* Implement setter for `Element#outerHTML` (#102)
|
||||
* Handle null/undefined in setter for `Node#textContent`
|
||||
* Handle null/undefined/negative values in `CharacterData` interface methods
|
||||
* Spec-correctness fixes for `DOMTokenList`, including handling of duplicate
|
||||
keys.
|
||||
* Fix `[src=...]` selectors in `Document#querySelector()` and similar
|
||||
* Spec-correctness fixes for `Document#createElement()` and
|
||||
`Document#createElementNS()`, including proper exception type and type
|
||||
coercion.
|
||||
* Implement `Attr#cloneNode()`, `Element#getAttributeNode()`,
|
||||
`Element#getAttributeNodeNS()`, `Element#setAttributeNode()`,
|
||||
`Element#setAttributeNodeNS()`, and `Element#removeAttributeNode()`
|
||||
(DOM3 compatibility)
|
||||
* Implement `Document#createAttribute()` and `Document#createAttributeNS()`
|
||||
* Implement `Element#hasAttributes()`, `Element#toggleAttribute()`, and
|
||||
`Element#getAttributeNames()`
|
||||
* Implement `Text#wholeText`
|
||||
* Implement `Document#cloneNode()` and `DocumentType#cloneNode()`
|
||||
* Spec-correctness fixes for `Node#lookupPrefix()`,
|
||||
`Node#lookupNamespaceURI()`, and `Node#isDefaultNamespace`, including
|
||||
proper type coercion and reconciling DOM 3 and DOM 4 specifications.
|
||||
* Ensure `Document#title` continues to use correct whitespace stripping
|
||||
for node > 4, and properly set `<title>` when `undefined` is passed to
|
||||
`DOMImplementation#createHTMLDocument()`
|
||||
* Ensure `Element#attributes` implements `NamedNodeMap` and that indexed
|
||||
properties of `Element#attributes` work (previously you needed to use
|
||||
the `item()` accessor method)
|
||||
* Improve stubs for `HTMLElement#style`, `Document#documentURI`, and
|
||||
`Document#contentType`
|
||||
* Implement proper accessors for `HTMLSelectElement#autocomplete`,
|
||||
`HTMLTextAreaElement#type/value/defaultValue/textLength`, and
|
||||
`HTMLInputElement#width/height/minLength`
|
||||
* Implement `Element#insertAdjacentElement()`, `Element#insertAdjacentText()`,
|
||||
and `Element#insertAdjacentHTML()` (#102)
|
||||
* Spec-correctness fixes for `TreeWalker` and `NodeIterator`: read-only
|
||||
properties, proper exception types, type coercion of `NodeFilter` results.
|
||||
* Implement `NodeIterator` pre-removal steps. Note that in the absence
|
||||
of weak references, be cautious about the number of `NodeIterator`s you
|
||||
create on any single document, since domino does not artificially limit
|
||||
these.
|
||||
See https://github.com/tc39/proposal-weakrefs/issues/17 for details.
|
||||
* Preserve prefix of SVG elements during parsing. (#102)
|
||||
|
||||
# domino 2.0.3 (12 Jul 2018)
|
||||
* Define `blur()`, `focus()` and `forceSpellCheck()` on `HTMLElement` (#125)
|
||||
* Stringify argument tokens for DOMTokenList methods (#126)
|
||||
* Fix `HTMLAnchorElement#hash` when `href` attribute contains bare
|
||||
fragment (#127)
|
||||
* Implement case-insensitive CSS attribute matching (#128)
|
||||
* Implement `DOMTokenList#replace()`, `DOMTokenList#toggle(token, force)`,
|
||||
and `DOMTokenList#value`. Fix handling of non-space whitespace. (#111)
|
||||
|
||||
# domino 2.0.2 (28 Mar 2018)
|
||||
* Add TypeScript definitions (#103)
|
||||
* Add `flex` CSS styles (#119, #120)
|
||||
* Fix Element#matches with ~= selectors (#121)
|
||||
|
||||
# domino 2.0.1 (14 Feb 2018)
|
||||
* Allow attributes named 'xmlns' (#112)
|
||||
* Make DOMTokenList add/remove variadic (#109)
|
||||
* Make `Array.from` and for-of loops work on `Node#attributes`.
|
||||
|
||||
# domino 2.0.0 ( 8 Nov 2017)
|
||||
* Fix potential O(N^2) slowdown in FilteredElementList#item.
|
||||
* `mocha` dependency has been updated to 4.0.x. As a result, we are
|
||||
no longer testing on node pre-v4.0.0; see:
|
||||
https://boneskull.com/mocha-v4-nears-release/
|
||||
* Domino now uses a linked list representation for children of Node,
|
||||
unless/until the Node#childNodes accessor is used (which requires
|
||||
an indexed array to be built). Inserting a removing nodes can be
|
||||
much quicker using the linked list representation if care is
|
||||
taken not to deoptimize the tree by using the #childNodes accessor.
|
||||
This implementation strategy matches the one used by webkit and
|
||||
other browser-based implementations, and thus ought to match
|
||||
performance expectations of folks used to writing browser-based
|
||||
DOM manipulation code.
|
||||
|
||||
# domino 1.0.30 (24 Oct 2017)
|
||||
* Fix regexp capitalization in URLUtils (#101)
|
||||
* Fix O(N^2) slowdown in initial tree traversal using nextSibling/prevSibling
|
||||
* Update `mocha` dependency to 3.5.x and `should` to 13.1.x.
|
||||
|
||||
# domino 1.0.29 ( 7 Aug 2017)
|
||||
* Fix "#id" optimization in querySelectorAll() when 0 or 2 matches for
|
||||
`id`. (#99)
|
||||
* Correct return value of CSSStyleDeclaration#getPropertyValue() when
|
||||
style is not set. (#98)
|
||||
|
||||
# domino 1.0.28 (27 Jan 2017)
|
||||
* Fix unescape mechanism in attribute values. (#95)
|
||||
* Disable nonstandard "ignore case" version of attribute matching.
|
||||
* Add `dom/nodes` tests from w3c/web-platform-tests. (#92, @pimterry)
|
||||
* Make selected API methods writable to support polyfills. (#89, @pimterry)
|
||||
* Fix `Element#hasAttribute`/`Element#hasAttributeNS` after
|
||||
`Element#removeAttribute`/`Element#removeAttributeNS`. (#90, @clint-tseng)
|
||||
* Fix deep `Document#importNode`. (#93)
|
||||
* Ensure that `Node#parentNode` is `null` (not `undefined`) when removed.
|
||||
* Tweak JavaScript properties which are DOM reflections of element
|
||||
attributes in order to more closely match the DOM 4 spec.
|
||||
* Implement `ChildNode#before()`, `ChildNode#after()`, and
|
||||
`ChildNode#replaceWith()`.
|
||||
|
||||
# domino 1.0.27 (17 Oct 2016)
|
||||
* Fix bug in AFE list replacement over existing bookmark.
|
||||
* Update htmlwg test suite to latest w3c/web-platform-tests.
|
||||
* Update html5lib test suite to latest.
|
||||
* HTML5 spec update: <menuitem> is no longer an empty element.
|
||||
* HTML5 spec update: tweaked HTML entity parsing in attributes.
|
||||
* HTML5 spec update: dashes are allowed in HTML comments.
|
||||
* HTML5 spec update: remove special handling of <isindex>.
|
||||
* Improve handling of legacy elements: `<xmp>`, `<listing>`, `acronym`,
|
||||
`basefont`, `big`, `center`, `nobr`, `noembed`, `noframes`, `plaintext`,
|
||||
`rb`, `rtc`, `strike`, and `tt`.
|
||||
* HTML5 spec update: Remove extra newline in serialization of `<pre>`,
|
||||
`<listing>`, `<textarea>`. (#88)
|
||||
* HTML5 spec update: Remove case normalization for defunct SVG attributes.
|
||||
* Implement HTMLMenuItemElement#label.
|
||||
* Basic SVG support. (#81, #82)
|
||||
|
||||
# domino 1.0.26 (15 Oct 2016)
|
||||
* Implement Document#dir.
|
||||
* Minor spec-compliance fixes to Document#title and classList#contains.
|
||||
* Implement Element#closest(). (#84)
|
||||
* Actually run the HTMLWG tests (#83)
|
||||
* Expose the HTML5 tree builder implementation. (#87)
|
||||
* Add workaround to W3C test harness for node >= 0.11.7.
|
||||
* Update the form-associated element list to match HTML5.
|
||||
|
||||
# domino 1.0.25 (19 May 2016)
|
||||
* Fix broken stopping of immediate propagation of Events. (#78)
|
||||
* Properly set "scripting enabled" flag when parsing fragments.
|
||||
* Fix handling of escaped or invalid CSS identifiers in
|
||||
`querySelector` and friends. (#79)
|
||||
|
||||
# domino 1.0.24 (05 Apr 2016)
|
||||
* Implement WindowTimers interface on Window. (#72)
|
||||
* Factor out the NavigatorID interface and make more spec-compliant.
|
||||
* Implement `HTMLTemplateElement` and parse `<template>` tags.
|
||||
* Properly parse the `<main>` tag.
|
||||
* Remove support for the non-standard `<command>` tag.
|
||||
* Create `HTMLCanvasElement` when parsing `<canvas>` tags.
|
||||
* Create `HTMLDialogElement` when parsing `<dialog>` tags.
|
||||
* Fix parsing of `<ruby>` tags, especially `<rb>` and `<rtc>`.
|
||||
* Create `HTMLMenuItemElement` when parsing `<menuitem>` tags.
|
||||
* Create `HTMLSourceElement` when parsing `<source>` tags.
|
||||
* Create `HTMLTrackElement` when parsing `<track>` tags.
|
||||
* Improve parsing of `<svg>` elements.
|
||||
* Fix parsing of `<isindex>` element in unusual contexts.
|
||||
* Serialize `<!DOCTYPE>` according to latest HTML5 spec.
|
||||
* Update adoption agency algorithm to match latest HTML5 spec.
|
||||
* Add additional parameter to `domino.createDocument` to
|
||||
allow creating a document from an empty string if desired.
|
||||
* Add tree builder test cases from `html5lib-tests`.
|
||||
* Implement `Document#location`. (#75)
|
||||
* Stub out additional properties of `HTMLIFrameElement`. (#76)
|
||||
|
||||
# domino 1.0.23 (30 Jan 2016)
|
||||
* Fix `CSSStyleDeclaration#setProperty`. (#71)
|
||||
* Update bundled CSS parser to 0.2.5+domino1.
|
||||
|
||||
# domino 1.0.22 (27 Jan 2016)
|
||||
* Prevent TypeError due to undefined property when parsing styles. (#68)
|
||||
* Support legacy `Attr#nodeValue` and `Attr#textContent` aliases. (#70)
|
||||
|
||||
# domino 1.0.21 (23 Dec 2015)
|
||||
* Improve performance when adding nodes with duplicate IDs. (#60)
|
||||
* Be more careful about setting prototype to `null` when using
|
||||
Objects as a Map. (#61)
|
||||
* Fix a global leak in NodeIterator.
|
||||
* Improve efficiency of `Node#replaceChild` and `Node#insert`. (#62)
|
||||
* Bug fix for `Node#normalize` which could cause deletion of empty
|
||||
`Comment` or `ProcessingInstruction` nodes. (#63)
|
||||
* Don't lowercase non-ASCII tag and attribute names. (#65)
|
||||
* Fix a number of minor bugs in rarely used code, discovered
|
||||
during delinting. (#66)
|
||||
* Implement `Node.contains`. (#67)
|
||||
|
||||
# domino 1.0.20 (20 Nov 2015)
|
||||
* CharacterData implements the NonDocumentTypeChildNode
|
||||
interface. (#57, #58)
|
||||
* Fix CSS `[style]` selector. (#59)
|
||||
|
||||
# domino 1.0.19 (29 Jul 2015)
|
||||
* Bug fixes for `TreeWalker` / `document.createTreeWalker` (filter
|
||||
argument was ignored; various traversal issues)
|
||||
* Implement `NodeIterator` / `document.createNodeIterator` (#54)
|
||||
* Update `mocha` dependency to 2.2.x and `should` to 7.0.x.
|
||||
|
||||
# domino 1.0.18 (25 Sep 2014)
|
||||
* HTMLAnchorElement now implements URLUtils. (#47)
|
||||
* Be consistent with our handling of null/empty namespaces. (#48)
|
||||
* Update `mocha` dependency to 1.21.x and `should` to 4.0.x.
|
||||
|
||||
# domino 1.0.17 (14 May 2014)
|
||||
* Brown paper bag bug fix for an HTML parsing regression introduced in
|
||||
domino 1.0.16. (#45)
|
||||
* Update `mocha` dependency to 1.18.x and `should` to 3.3.x.
|
||||
|
||||
# domino 1.0.16 (13 May 2014)
|
||||
**DO NOT USE:** contains parser regression, fixed in 1.0.17.
|
||||
* Various performance improvements to the HTML5 parser. (#43, #44)
|
||||
* Fix `Element#isHTML` for non-HTML elements. (#41)
|
||||
|
||||
# domino 1.0.15 (21 Jan 2014)
|
||||
* Implement `Element#matches()`.
|
||||
* Fix CSS `[lang]`, `[dir]`, etc selectors.
|
||||
* Update `mocha` dependency to 1.17.x.
|
||||
|
||||
# domino 1.0.14 (21 Dec 2013)
|
||||
* `Element#classList.length` should be 0 if there's no `class`
|
||||
attribute.
|
||||
* Add `height`/`width` attributes to `HTMLImageElement`.
|
||||
* Fix node 0.11 incompatibility in the w3c test harness.
|
||||
* Update `mocha` dependency to 1.16.x; update `should` dependency to 2.1.x.
|
||||
|
||||
# domino 1.0.13 (8 Oct 2013)
|
||||
* Include `<th>` elements in `HTMLTableRowElement#cells`. (#38, #39)
|
||||
* Fix old call to `toLowerCase()` function. (#37)
|
||||
* Update `mocha` and `should` dependencies.
|
||||
|
||||
# domino 1.0.12 (9 Jul 2013)
|
||||
* Fix bug in formatting element adoption agency algorithm. (#36)
|
||||
* Coerce `document.createTextNode` argument to a string. (#34, #35)
|
||||
* Work around performance regression in node <= 0.6.
|
||||
|
||||
# domino 1.0.11 (1 May 2013)
|
||||
* Fix rooted element traversal (`Element#nextElement`,
|
||||
`Element#getElementsByTagName`). (#31, #32)
|
||||
* Update zest to fix bugs in `+` and `>` combinators.
|
||||
* Don't overflow the stack if attribute values are very large (>64k).
|
||||
|
||||
# domino 1.0.10 (12 Apr 2013)
|
||||
* Document issues with `Element#attributes`. (#27)
|
||||
* Fix `Document#title` to match DOM spec. (#29)
|
||||
* Add missing `require('utils')` for `handleErrors`. (#28)
|
||||
* Implement `DocumentFragment#querySelector` and
|
||||
`DocumentFragment#querySelectorAll`. (#20, #26)
|
||||
* Fix `querySelectorAll` on unparented `Element`s. (#23)
|
||||
* Move `outerHTML`/`innerHTML` properties from `HTMLElement` to
|
||||
`Element` to match dom parsing spec. (#21)
|
||||
* Update zest selector library to 0.0.4. (#25)
|
||||
* Fix regression in node 0.10. (#22, #24)
|
||||
* Update `mocha` and `should` dependencies.
|
||||
|
||||
# domino 1.0.9 (11 Mar 2013)
|
||||
* Support jQuery 1.9.x by allowing `Element#attributes[qname]`.
|
||||
* Implement `HTMLElement#outerHTML`. (#18)
|
||||
* Only add newlines after `<pre>`/`<textarea>`/`<listing>` if
|
||||
necessary, to match HTML5 serialization spec. (#16, #17)
|
||||
* Mirror node type properties (`ELEMENT_NODE`, etc) into
|
||||
`Node.prototype`. (#14, #15)
|
||||
|
||||
# domino 1.0.8
|
||||
|
||||
**DO NOT USE:** was inadvertently published identical to domino 1.0.7.
|
||||
|
||||
# domino 1.0.7 (16 Jan 2013)
|
||||
* Throw `SyntaxError` upon invocation rather than build-time. (#10)
|
||||
* Return nodes in document order. (#11)
|
||||
* Added a TreeWalker implementation.
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
# Contributing to Mixmark's Domino
|
||||
|
||||
Mixmark's Domino is intended to serve as a reference HTML parser implementation for Turndown package.
|
||||
No contributions other than bugfixes to supported Turndown use case will be accepted.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
Copyright (c) 2011 The Mozilla Foundation.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
This repository is only intended to be used as a reference implementation of Turndown's reference HTML parser.
|
||||
It is not intended to be used as a general-purpose DOM implementation. No contributions other than bugfixes to
|
||||
supported Turndown use case will be accepted.
|
||||
|
||||
|
||||
# Server-side DOM implementation based on Mozilla's dom.js
|
||||
|
||||
This is a fork of [Angular Domino](https://github.com/angular/domino), which is fork of the original [Domino](https://github.com/fgnass/domino).
|
||||
|
||||
As the name might suggest, domino's goal is to provide a <b>DOM in No</b>de.
|
||||
|
||||
In contrast to the original [dom.js](https://github.com/andreasgal/dom.js) project, domino was not designed to run untrusted code. Hence it doesn't have to hide its internals behind a proxy facade which makes the code not only simpler, but also [more performant](https://github.com/fgnass/dombench).
|
||||
|
||||
Domino currently doesn't use any harmony/ES6 features like proxies or WeakMaps and therefore also runs in older Node versions.
|
||||
|
||||
## Speed over Compliance
|
||||
|
||||
Domino is intended for _building_ pages rather than scraping them. Hence Domino doesn't execute scripts nor does it download external resources.
|
||||
|
||||
Also Domino doesn't generally implement properties which have been deprecated in HTML5.
|
||||
|
||||
Domino sticks to [DOM level 4](http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-attr), which means that Attributes do not inherit the Node interface.
|
||||
|
||||
<b>Note that</b> because domino does not use proxies,
|
||||
`Element.attributes` is not a true JavaScript array; it is an object
|
||||
with a `length` property and an `item(n)` accessor method. See
|
||||
[github issue #27](https://github.com/fgnass/domino/issues/27) for
|
||||
further discussion. It does however implement direct indexed accessors
|
||||
(`element.attributes[i]`) and is live.
|
||||
|
||||
|
||||
|
||||
## CSS Selector Support
|
||||
|
||||
Domino provides support for `querySelector()`, `querySelectorAll()`, and `matches()` backed by the [Zest](https://github.com/chjj/zest) selector engine.
|
||||
|
||||
## Optimization
|
||||
|
||||
Domino represents the DOM tree structure in the same way Webkit and
|
||||
other browser-based implementations do: as a linked list of children
|
||||
which is converted to an array-based representation iff the
|
||||
`Node#childNodes` accessor is used. You will get the best performance
|
||||
from tree modification code (inserting and removing children) if you
|
||||
avoid the use of `Node#childNodes` and traverse the tree using
|
||||
`Node#firstChild`/`Node#nextSibling` (or
|
||||
`Node#lastChild`/`Node#previousSibling`) or `querySelector()`/etc.
|
||||
|
||||
## Usage
|
||||
|
||||
Domino supports the DOM level 4 API, and thus API documentation can be
|
||||
found on standard reference sites. For example, you could start from
|
||||
MDN's documentation for
|
||||
[Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) and
|
||||
[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node).
|
||||
|
||||
The only exception is the initial creation of a document:
|
||||
```javascript
|
||||
var domino = require('domino');
|
||||
var Element = domino.impl.Element; // etc
|
||||
|
||||
// alternatively: document = domino.createDocument(htmlString, true)
|
||||
|
||||
var h1 = document.querySelector('h1');
|
||||
console.log(h1.innerHTML);
|
||||
console.log(h1 instanceof Element);
|
||||
```
|
||||
|
||||
There is also an incremental parser available, if you need to interleave
|
||||
parsing with other processing:
|
||||
```javascript
|
||||
var domino = require('domino');
|
||||
|
||||
var pauseAfter = function(ms) {
|
||||
var start = Date.now();
|
||||
return function() { return (Date.now() - start) >= ms; };
|
||||
};
|
||||
|
||||
var incrParser = domino.createIncrementalHTMLParser();
|
||||
incrParser.write('<p>hello<');
|
||||
incrParser.write('b>&am');
|
||||
incrParser.process(pauseAfter(1/*ms*/)); // can interleave processing
|
||||
incrParser.write('p;');
|
||||
// ...etc...
|
||||
incrParser.end(); // when done writing the document
|
||||
|
||||
while (incrParser.process(pauseAfter(10/*ms*/))) {
|
||||
// ...do other housekeeping...
|
||||
}
|
||||
|
||||
console.log(incrParser.document().outerHTML);
|
||||
```
|
||||
|
||||
If you want a more standards-compliant way to create a `Document`, you can
|
||||
also use [DOMImplementation](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation):
|
||||
```javascript
|
||||
var domino = require('domino');
|
||||
var domimpl = domino.createDOMImplementation();
|
||||
var doc = domimpl.createHTMLDocument();
|
||||
```
|
||||
|
||||
By default many domino methods will be stored in writable properties, to
|
||||
allow polyfills (as browsers do). You can lock down the implementation
|
||||
if desired as follows:
|
||||
```javascript
|
||||
global.__domino_frozen__ = true; // Must precede any `require('domino')`
|
||||
var domino = require('domino');
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Domino includes test from the [W3C DOM Conformance Suites](http://www.w3.org/DOM/Test/)
|
||||
as well as tests from [HTML Working Group](http://www.w3.org/html/wg/wiki/Testing).
|
||||
|
||||
When you checkout this repository for the first time, run the following command to also check out code for the mentioned tests:
|
||||
|
||||
```
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
The tests can be run via `npm test` or directly though the [Mocha](http://mochajs.org/) command line:
|
||||
|
||||

|
||||
|
||||
## License and Credits
|
||||
|
||||
The majority of the code was originally written by [Andreas Gal](https://github.com/andreasgal/) and [David Flanagan](https://github.com/davidflanagan) as part of the [dom.js](https://github.com/andreasgal/dom.js) project. Please refer to the included LICENSE file for the original copyright notice and disclaimer.
|
||||
|
||||
[Felix Gnass](https://github.com/fgnass/) extracted the code and turned
|
||||
it into a stand-alone npm package.
|
||||
|
||||
The code has been maintained since 2013 by [C. Scott Ananian](https://github.com/cscott/) on behalf of the Wikimedia Foundation, which uses it in its
|
||||
[Parsoid](https://www.mediawiki.org/wiki/Parsoid) project. A large number
|
||||
of improvements have been made, mostly focusing on correctness,
|
||||
performance, and (to a lesser extent) completeness of the implementation.
|
||||
|
||||
[1]: https://travis-ci.org/fgnass/domino.svg
|
||||
[2]: https://travis-ci.org/fgnass/domino
|
||||
[3]: https://david-dm.org/fgnass/domino.svg
|
||||
[4]: https://david-dm.org/fgnass/domino
|
||||
[5]: https://david-dm.org/fgnass/domino/dev-status.svg
|
||||
[6]: https://david-dm.org/fgnass/domino#info=devDependencies
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
|
||||
const { parse } = require('./style_parser');
|
||||
|
||||
module.exports = function (elt) {
|
||||
const style = new CSSStyleDeclaration(elt)
|
||||
const handler = {
|
||||
get: function(target, property) {
|
||||
return property in target ? target[property] : target.getPropertyValue(dasherizeProperty(property));
|
||||
},
|
||||
has: function(target, key) {
|
||||
return true;
|
||||
},
|
||||
set: function(target, property, value) {
|
||||
if (property in target) {
|
||||
target[property] = value;
|
||||
} else {
|
||||
target.setProperty(dasherizeProperty(property), value ?? undefined);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
return new Proxy(style, handler);
|
||||
};
|
||||
|
||||
function dasherizeProperty(property) {
|
||||
return property.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
function CSSStyleDeclaration(elt) {
|
||||
this._element = elt;
|
||||
}
|
||||
|
||||
const IMPORTANT_BANG = '!important';
|
||||
|
||||
// Utility function for parsing style declarations
|
||||
// Pass in a string like "margin-left: 5px; border-style: solid"
|
||||
// and this function returns an object like
|
||||
// {"margin-left":"5px", "border-style":"solid"}
|
||||
function parseStyles(value) {
|
||||
const result = {
|
||||
property: {},
|
||||
priority: {},
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const styleValues = parse(value);
|
||||
if (styleValues.length < 2) {
|
||||
return result;
|
||||
}
|
||||
|
||||
for (let i = 0; i < styleValues.length; i += 2) {
|
||||
const name = styleValues[i];
|
||||
let value = styleValues[i+1];
|
||||
|
||||
if (value.endsWith(IMPORTANT_BANG)) {
|
||||
result.priority[name] = 'important';
|
||||
value = value.slice(0, -IMPORTANT_BANG.length).trim();
|
||||
}
|
||||
|
||||
result.property[name] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var NO_CHANGE = {}; // Private marker object
|
||||
|
||||
CSSStyleDeclaration.prototype = Object.create(Object.prototype, {
|
||||
|
||||
// Return the parsed form of the element's style attribute.
|
||||
// If the element's style attribute has never been parsed
|
||||
// or if it has changed since the last parse, then reparse it
|
||||
// Note that the styles don't get parsed until they're actually needed
|
||||
_parsed: { get: function() {
|
||||
if (!this._parsedStyles || this.cssText !== this._lastParsedText) {
|
||||
var text = this.cssText;
|
||||
this._parsedStyles = parseStyles(text);
|
||||
this._lastParsedText = text;
|
||||
delete this._names;
|
||||
}
|
||||
return this._parsedStyles;
|
||||
}},
|
||||
|
||||
// Call this method any time the parsed representation of the
|
||||
// style changes. It converts the style properties to a string and
|
||||
// sets cssText and the element's style attribute
|
||||
_serialize: { value: function() {
|
||||
var styles = this._parsed;
|
||||
var s = "";
|
||||
|
||||
for(var name in styles.property) {
|
||||
if (s) s += " ";
|
||||
s += name + ": " + styles.property[name];
|
||||
if (styles.priority[name]) {
|
||||
s += " !" + styles.priority[name];
|
||||
}
|
||||
s += ";";
|
||||
}
|
||||
|
||||
this.cssText = s; // also sets the style attribute
|
||||
this._lastParsedText = s; // so we don't reparse
|
||||
delete this._names;
|
||||
}},
|
||||
|
||||
cssText: {
|
||||
get: function() {
|
||||
// XXX: this is a CSSStyleDeclaration for an element.
|
||||
// A different impl might be necessary for a set of styles
|
||||
// associated returned by getComputedStyle(), e.g.
|
||||
return this._element.getAttribute("style");
|
||||
},
|
||||
set: function(value) {
|
||||
// XXX: I should parse and serialize the value to
|
||||
// normalize it and remove errors. FF and chrome do that.
|
||||
this._element.setAttribute("style", value);
|
||||
}
|
||||
},
|
||||
|
||||
length: { get: function() {
|
||||
if (!this._names)
|
||||
this._names = Object.getOwnPropertyNames(this._parsed.property);
|
||||
return this._names.length;
|
||||
}},
|
||||
|
||||
item: { value: function(n) {
|
||||
if (!this._names)
|
||||
this._names = Object.getOwnPropertyNames(this._parsed.property);
|
||||
return this._names[n];
|
||||
}},
|
||||
|
||||
getPropertyValue: { value: function(property) {
|
||||
property = property.toLowerCase();
|
||||
return this._parsed.property[property] || "";
|
||||
}},
|
||||
|
||||
getPropertyPriority: { value: function(property) {
|
||||
property = property.toLowerCase();
|
||||
return this._parsed.priority[property] || "";
|
||||
}},
|
||||
|
||||
setProperty: { value: function(property, value, priority) {
|
||||
property = property.toLowerCase();
|
||||
if (value === null || value === undefined) {
|
||||
value = "";
|
||||
}
|
||||
if (priority === null || priority === undefined) {
|
||||
priority = "";
|
||||
}
|
||||
|
||||
// String coercion
|
||||
if (value !== NO_CHANGE) {
|
||||
value = "" + value;
|
||||
}
|
||||
|
||||
value = value.trim();
|
||||
if (value === "") {
|
||||
this.removeProperty(property);
|
||||
return;
|
||||
}
|
||||
|
||||
if (priority !== "" && priority !== NO_CHANGE &&
|
||||
!/^important$/i.test(priority)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var styles = this._parsed;
|
||||
if (value === NO_CHANGE) {
|
||||
if (!styles.property[property]) {
|
||||
return; // Not a valid property name.
|
||||
}
|
||||
if (priority !== "") {
|
||||
styles.priority[property] = "important";
|
||||
} else {
|
||||
delete styles.priority[property];
|
||||
}
|
||||
} else {
|
||||
// We don't just accept the property value. Instead
|
||||
// we parse it to ensure that it is something valid.
|
||||
// If it contains a semicolon it is invalid
|
||||
if (value.indexOf(";") !== -1) return;
|
||||
|
||||
var newprops = parseStyles(property + ":" + value);
|
||||
if (Object.getOwnPropertyNames(newprops.property).length === 0) {
|
||||
return; // no valid property found
|
||||
}
|
||||
if (Object.getOwnPropertyNames(newprops.priority).length !== 0) {
|
||||
return; // if the value included '!important' it wasn't valid.
|
||||
}
|
||||
|
||||
// XXX handle shorthand properties
|
||||
|
||||
for (var p in newprops.property) {
|
||||
styles.property[p] = newprops.property[p];
|
||||
if (priority === NO_CHANGE) {
|
||||
continue;
|
||||
} else if (priority !== "") {
|
||||
styles.priority[p] = "important";
|
||||
} else if (styles.priority[p]) {
|
||||
delete styles.priority[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize and update cssText and element.style!
|
||||
this._serialize();
|
||||
}},
|
||||
|
||||
setPropertyValue: { value: function(property, value) {
|
||||
return this.setProperty(property, value, NO_CHANGE);
|
||||
}},
|
||||
|
||||
setPropertyPriority: { value: function(property, priority) {
|
||||
return this.setProperty(property, NO_CHANGE, priority);
|
||||
}},
|
||||
|
||||
removeProperty: { value: function(property) {
|
||||
property = property.toLowerCase();
|
||||
var styles = this._parsed;
|
||||
if (property in styles.property) {
|
||||
delete styles.property[property];
|
||||
delete styles.priority[property];
|
||||
|
||||
// Serialize and update cssText and element.style!
|
||||
this._serialize();
|
||||
}
|
||||
}},
|
||||
});
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
/* jshint bitwise: false */
|
||||
"use strict";
|
||||
module.exports = CharacterData;
|
||||
|
||||
var Leaf = require('./Leaf');
|
||||
var utils = require('./utils');
|
||||
var ChildNode = require('./ChildNode');
|
||||
var NonDocumentTypeChildNode = require('./NonDocumentTypeChildNode');
|
||||
|
||||
function CharacterData() {
|
||||
Leaf.call(this);
|
||||
}
|
||||
|
||||
CharacterData.prototype = Object.create(Leaf.prototype, {
|
||||
// DOMString substringData(unsigned long offset,
|
||||
// unsigned long count);
|
||||
// The substringData(offset, count) method must run these steps:
|
||||
//
|
||||
// If offset is greater than the context object's
|
||||
// length, throw an INDEX_SIZE_ERR exception and
|
||||
// terminate these steps.
|
||||
//
|
||||
// If offset+count is greater than the context
|
||||
// object's length, return a DOMString whose value is
|
||||
// the UTF-16 code units from the offsetth UTF-16 code
|
||||
// unit to the end of data.
|
||||
//
|
||||
// Return a DOMString whose value is the UTF-16 code
|
||||
// units from the offsetth UTF-16 code unit to the
|
||||
// offset+countth UTF-16 code unit in data.
|
||||
substringData: { value: function substringData(offset, count) {
|
||||
if (arguments.length < 2) { throw new TypeError("Not enough arguments"); }
|
||||
// Convert arguments to WebIDL "unsigned long"
|
||||
offset = offset >>> 0;
|
||||
count = count >>> 0;
|
||||
if (offset > this.data.length || offset < 0 || count < 0) {
|
||||
utils.IndexSizeError();
|
||||
}
|
||||
return this.data.substring(offset, offset+count);
|
||||
}},
|
||||
|
||||
// void appendData(DOMString data);
|
||||
// The appendData(data) method must append data to the context
|
||||
// object's data.
|
||||
appendData: { value: function appendData(data) {
|
||||
if (arguments.length < 1) { throw new TypeError("Not enough arguments"); }
|
||||
this.data += String(data);
|
||||
}},
|
||||
|
||||
// void insertData(unsigned long offset, DOMString data);
|
||||
// The insertData(offset, data) method must run these steps:
|
||||
//
|
||||
// If offset is greater than the context object's
|
||||
// length, throw an INDEX_SIZE_ERR exception and
|
||||
// terminate these steps.
|
||||
//
|
||||
// Insert data into the context object's data after
|
||||
// offset UTF-16 code units.
|
||||
//
|
||||
insertData: { value: function insertData(offset, data) {
|
||||
return this.replaceData(offset, 0, data);
|
||||
}},
|
||||
|
||||
|
||||
// void deleteData(unsigned long offset, unsigned long count);
|
||||
// The deleteData(offset, count) method must run these steps:
|
||||
//
|
||||
// If offset is greater than the context object's
|
||||
// length, throw an INDEX_SIZE_ERR exception and
|
||||
// terminate these steps.
|
||||
//
|
||||
// If offset+count is greater than the context
|
||||
// object's length var count be length-offset.
|
||||
//
|
||||
// Starting from offset UTF-16 code units remove count
|
||||
// UTF-16 code units from the context object's data.
|
||||
deleteData: { value: function deleteData(offset, count) {
|
||||
return this.replaceData(offset, count, '');
|
||||
}},
|
||||
|
||||
|
||||
// void replaceData(unsigned long offset, unsigned long count,
|
||||
// DOMString data);
|
||||
//
|
||||
// The replaceData(offset, count, data) method must act as
|
||||
// if the deleteData() method is invoked with offset and
|
||||
// count as arguments followed by the insertData() method
|
||||
// with offset and data as arguments and re-throw any
|
||||
// exceptions these methods might have thrown.
|
||||
replaceData: { value: function replaceData(offset, count, data) {
|
||||
var curtext = this.data, len = curtext.length;
|
||||
// Convert arguments to correct WebIDL type
|
||||
offset = offset >>> 0;
|
||||
count = count >>> 0;
|
||||
data = String(data);
|
||||
|
||||
if (offset > len || offset < 0) utils.IndexSizeError();
|
||||
|
||||
if (offset+count > len)
|
||||
count = len - offset;
|
||||
|
||||
var prefix = curtext.substring(0, offset),
|
||||
suffix = curtext.substring(offset+count);
|
||||
|
||||
this.data = prefix + data + suffix;
|
||||
}},
|
||||
|
||||
// Utility method that Node.isEqualNode() calls to test Text and
|
||||
// Comment nodes for equality. It is okay to put it here, since
|
||||
// Node will have already verified that nodeType is equal
|
||||
isEqual: { value: function isEqual(n) {
|
||||
return this._data === n._data;
|
||||
}},
|
||||
|
||||
length: { get: function() { return this.data.length; }}
|
||||
|
||||
});
|
||||
|
||||
Object.defineProperties(CharacterData.prototype, ChildNode);
|
||||
Object.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode);
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
|
||||
var Node = require('./Node');
|
||||
var LinkedList = require('./LinkedList');
|
||||
|
||||
var createDocumentFragmentFromArguments = function(document, args) {
|
||||
var docFrag = document.createDocumentFragment();
|
||||
|
||||
for (var i=0; i<args.length; i++) {
|
||||
var argItem = args[i];
|
||||
var isNode = argItem instanceof Node;
|
||||
docFrag.appendChild(isNode ? argItem :
|
||||
document.createTextNode(String(argItem)));
|
||||
}
|
||||
|
||||
return docFrag;
|
||||
};
|
||||
|
||||
// The ChildNode interface contains methods that are particular to `Node`
|
||||
// objects that can have a parent. It is implemented by `Element`,
|
||||
// `DocumentType`, and `CharacterData` objects.
|
||||
var ChildNode = {
|
||||
|
||||
// Inserts a set of Node or String objects in the children list of this
|
||||
// ChildNode's parent, just after this ChildNode. String objects are
|
||||
// inserted as the equivalent Text nodes.
|
||||
after: { value: function after() {
|
||||
var argArr = Array.prototype.slice.call(arguments);
|
||||
var parentNode = this.parentNode, nextSibling = this.nextSibling;
|
||||
if (parentNode === null) { return; }
|
||||
// Find "viable next sibling"; that is, next one not in argArr
|
||||
while (nextSibling && argArr.some(function(v) { return v===nextSibling; }))
|
||||
nextSibling = nextSibling.nextSibling;
|
||||
// ok, parent and sibling are saved away since this node could itself
|
||||
// appear in argArr and we're about to move argArr to a document fragment.
|
||||
var docFrag = createDocumentFragmentFromArguments(this.doc, argArr);
|
||||
|
||||
parentNode.insertBefore(docFrag, nextSibling);
|
||||
}},
|
||||
|
||||
// Inserts a set of Node or String objects in the children list of this
|
||||
// ChildNode's parent, just before this ChildNode. String objects are
|
||||
// inserted as the equivalent Text nodes.
|
||||
before: { value: function before() {
|
||||
var argArr = Array.prototype.slice.call(arguments);
|
||||
var parentNode = this.parentNode, prevSibling = this.previousSibling;
|
||||
if (parentNode === null) { return; }
|
||||
// Find "viable prev sibling"; that is, prev one not in argArr
|
||||
while (prevSibling && argArr.some(function(v) { return v===prevSibling; }))
|
||||
prevSibling = prevSibling.previousSibling;
|
||||
// ok, parent and sibling are saved away since this node could itself
|
||||
// appear in argArr and we're about to move argArr to a document fragment.
|
||||
var docFrag = createDocumentFragmentFromArguments(this.doc, argArr);
|
||||
|
||||
var nextSibling =
|
||||
prevSibling ? prevSibling.nextSibling : parentNode.firstChild;
|
||||
parentNode.insertBefore(docFrag, nextSibling);
|
||||
}},
|
||||
|
||||
// Remove this node from its parent
|
||||
remove: { value: function remove() {
|
||||
if (this.parentNode === null) return;
|
||||
|
||||
// Send mutation events if necessary
|
||||
if (this.doc) {
|
||||
this.doc._preremoveNodeIterators(this);
|
||||
if (this.rooted) {
|
||||
this.doc.mutateRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove this node from its parents array of children
|
||||
// and update the structure id for all ancestors
|
||||
this._remove();
|
||||
|
||||
// Forget this node's parent
|
||||
this.parentNode = null;
|
||||
}},
|
||||
|
||||
// Remove this node w/o uprooting or sending mutation events
|
||||
// (But do update the structure id for all ancestors)
|
||||
_remove: { value: function _remove() {
|
||||
var parent = this.parentNode;
|
||||
if (parent === null) return;
|
||||
if (parent._childNodes) {
|
||||
parent._childNodes.splice(this.index, 1);
|
||||
} else if (parent._firstChild === this) {
|
||||
if (this._nextSibling === this) {
|
||||
parent._firstChild = null;
|
||||
} else {
|
||||
parent._firstChild = this._nextSibling;
|
||||
}
|
||||
}
|
||||
LinkedList.remove(this);
|
||||
parent.modify();
|
||||
}},
|
||||
|
||||
// Replace this node with the nodes or strings provided as arguments.
|
||||
replaceWith: { value: function replaceWith() {
|
||||
var argArr = Array.prototype.slice.call(arguments);
|
||||
var parentNode = this.parentNode, nextSibling = this.nextSibling;
|
||||
if (parentNode === null) { return; }
|
||||
// Find "viable next sibling"; that is, next one not in argArr
|
||||
while (nextSibling && argArr.some(function(v) { return v===nextSibling; }))
|
||||
nextSibling = nextSibling.nextSibling;
|
||||
// ok, parent and sibling are saved away since this node could itself
|
||||
// appear in argArr and we're about to move argArr to a document fragment.
|
||||
var docFrag = createDocumentFragmentFromArguments(this.doc, argArr);
|
||||
if (this.parentNode === parentNode) {
|
||||
parentNode.replaceChild(docFrag, this);
|
||||
} else {
|
||||
// `this` was inserted into docFrag
|
||||
parentNode.insertBefore(docFrag, nextSibling);
|
||||
}
|
||||
}},
|
||||
|
||||
};
|
||||
|
||||
module.exports = ChildNode;
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
module.exports = Comment;
|
||||
|
||||
var Node = require('./Node');
|
||||
var CharacterData = require('./CharacterData');
|
||||
|
||||
function Comment(doc, data) {
|
||||
CharacterData.call(this);
|
||||
this.nodeType = Node.COMMENT_NODE;
|
||||
this.ownerDocument = doc;
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
var nodeValue = {
|
||||
get: function() { return this._data; },
|
||||
set: function(v) {
|
||||
if (v === null || v === undefined) { v = ''; } else { v = String(v); }
|
||||
this._data = v;
|
||||
if (this.rooted)
|
||||
this.ownerDocument.mutateValue(this);
|
||||
}
|
||||
};
|
||||
|
||||
Comment.prototype = Object.create(CharacterData.prototype, {
|
||||
nodeName: { value: '#comment' },
|
||||
nodeValue: nodeValue,
|
||||
textContent: nodeValue,
|
||||
innerText: nodeValue,
|
||||
data: {
|
||||
get: nodeValue.get,
|
||||
set: function(v) {
|
||||
nodeValue.set.call(this, v===null ? '' : String(v));
|
||||
},
|
||||
},
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
return new Comment(this.ownerDocument, this._data);
|
||||
}},
|
||||
});
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
module.exports = ContainerNode;
|
||||
|
||||
var Node = require('./Node');
|
||||
var NodeList = require('./NodeList');
|
||||
|
||||
// This class defines common functionality for node subtypes that
|
||||
// can have children
|
||||
|
||||
function ContainerNode() {
|
||||
Node.call(this);
|
||||
this._firstChild = this._childNodes = null;
|
||||
}
|
||||
|
||||
// Primary representation is a circular linked list of siblings
|
||||
ContainerNode.prototype = Object.create(Node.prototype, {
|
||||
|
||||
hasChildNodes: { value: function() {
|
||||
if (this._childNodes) {
|
||||
return this._childNodes.length > 0;
|
||||
}
|
||||
return this._firstChild !== null;
|
||||
}},
|
||||
|
||||
childNodes: { get: function() {
|
||||
this._ensureChildNodes();
|
||||
return this._childNodes;
|
||||
}},
|
||||
|
||||
firstChild: { get: function() {
|
||||
if (this._childNodes) {
|
||||
return this._childNodes.length === 0 ? null : this._childNodes[0];
|
||||
}
|
||||
return this._firstChild;
|
||||
}},
|
||||
|
||||
lastChild: { get: function() {
|
||||
var kids = this._childNodes, first;
|
||||
if (kids) {
|
||||
return kids.length === 0 ? null: kids[kids.length-1];
|
||||
}
|
||||
first = this._firstChild;
|
||||
if (first === null) { return null; }
|
||||
return first._previousSibling; // circular linked list
|
||||
}},
|
||||
|
||||
_ensureChildNodes: { value: function() {
|
||||
if (this._childNodes) { return; }
|
||||
var first = this._firstChild,
|
||||
kid = first,
|
||||
childNodes = this._childNodes = new NodeList();
|
||||
if (first) do {
|
||||
childNodes.push(kid);
|
||||
kid = kid._nextSibling;
|
||||
} while (kid !== first); // circular linked list
|
||||
this._firstChild = null; // free memory
|
||||
}},
|
||||
|
||||
// Remove all of this node's children. This is a minor
|
||||
// optimization that only calls modify() once.
|
||||
removeChildren: { value: function removeChildren() {
|
||||
var root = this.rooted ? this.ownerDocument : null,
|
||||
next = this.firstChild,
|
||||
kid;
|
||||
while (next !== null) {
|
||||
kid = next;
|
||||
next = kid.nextSibling;
|
||||
|
||||
if (root) root.mutateRemove(kid);
|
||||
kid.parentNode = null;
|
||||
}
|
||||
if (this._childNodes) {
|
||||
this._childNodes.length = 0;
|
||||
} else {
|
||||
this._firstChild = null;
|
||||
}
|
||||
this.modify(); // Update last modified type once only
|
||||
}},
|
||||
|
||||
});
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
module.exports = CustomEvent;
|
||||
|
||||
var Event = require('./Event');
|
||||
|
||||
function CustomEvent(type, dictionary) {
|
||||
// Just use the superclass constructor to initialize
|
||||
Event.call(this, type, dictionary);
|
||||
}
|
||||
CustomEvent.prototype = Object.create(Event.prototype, {
|
||||
constructor: { value: CustomEvent }
|
||||
});
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
module.exports = DOMException;
|
||||
|
||||
var INDEX_SIZE_ERR = 1;
|
||||
var HIERARCHY_REQUEST_ERR = 3;
|
||||
var WRONG_DOCUMENT_ERR = 4;
|
||||
var INVALID_CHARACTER_ERR = 5;
|
||||
var NO_MODIFICATION_ALLOWED_ERR = 7;
|
||||
var NOT_FOUND_ERR = 8;
|
||||
var NOT_SUPPORTED_ERR = 9;
|
||||
var INVALID_STATE_ERR = 11;
|
||||
var SYNTAX_ERR = 12;
|
||||
var INVALID_MODIFICATION_ERR = 13;
|
||||
var NAMESPACE_ERR = 14;
|
||||
var INVALID_ACCESS_ERR = 15;
|
||||
var TYPE_MISMATCH_ERR = 17;
|
||||
var SECURITY_ERR = 18;
|
||||
var NETWORK_ERR = 19;
|
||||
var ABORT_ERR = 20;
|
||||
var URL_MISMATCH_ERR = 21;
|
||||
var QUOTA_EXCEEDED_ERR = 22;
|
||||
var TIMEOUT_ERR = 23;
|
||||
var INVALID_NODE_TYPE_ERR = 24;
|
||||
var DATA_CLONE_ERR = 25;
|
||||
|
||||
// Code to name
|
||||
var names = [
|
||||
null, // No error with code 0
|
||||
'INDEX_SIZE_ERR',
|
||||
null, // historical
|
||||
'HIERARCHY_REQUEST_ERR',
|
||||
'WRONG_DOCUMENT_ERR',
|
||||
'INVALID_CHARACTER_ERR',
|
||||
null, // historical
|
||||
'NO_MODIFICATION_ALLOWED_ERR',
|
||||
'NOT_FOUND_ERR',
|
||||
'NOT_SUPPORTED_ERR',
|
||||
'INUSE_ATTRIBUTE_ERR', // historical
|
||||
'INVALID_STATE_ERR',
|
||||
'SYNTAX_ERR',
|
||||
'INVALID_MODIFICATION_ERR',
|
||||
'NAMESPACE_ERR',
|
||||
'INVALID_ACCESS_ERR',
|
||||
null, // historical
|
||||
'TYPE_MISMATCH_ERR',
|
||||
'SECURITY_ERR',
|
||||
'NETWORK_ERR',
|
||||
'ABORT_ERR',
|
||||
'URL_MISMATCH_ERR',
|
||||
'QUOTA_EXCEEDED_ERR',
|
||||
'TIMEOUT_ERR',
|
||||
'INVALID_NODE_TYPE_ERR',
|
||||
'DATA_CLONE_ERR',
|
||||
];
|
||||
|
||||
// Code to message
|
||||
// These strings are from the 13 May 2011 Editor's Draft of DOM Core.
|
||||
// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
// Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved.
|
||||
// Used under the terms of the W3C Document License:
|
||||
// http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231
|
||||
var messages = [
|
||||
null, // No error with code 0
|
||||
'INDEX_SIZE_ERR (1): the index is not in the allowed range',
|
||||
null,
|
||||
'HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model',
|
||||
'WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required',
|
||||
'INVALID_CHARACTER_ERR (5): the string contains invalid characters',
|
||||
null,
|
||||
'NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified',
|
||||
'NOT_FOUND_ERR (8): the object can not be found here',
|
||||
'NOT_SUPPORTED_ERR (9): this operation is not supported',
|
||||
'INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute',
|
||||
'INVALID_STATE_ERR (11): the object is in an invalid state',
|
||||
'SYNTAX_ERR (12): the string did not match the expected pattern',
|
||||
'INVALID_MODIFICATION_ERR (13): the object can not be modified in this way',
|
||||
'NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML',
|
||||
'INVALID_ACCESS_ERR (15): the object does not support the operation or argument',
|
||||
null,
|
||||
'TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type',
|
||||
'SECURITY_ERR (18): the operation is insecure',
|
||||
'NETWORK_ERR (19): a network error occurred',
|
||||
'ABORT_ERR (20): the user aborted an operation',
|
||||
'URL_MISMATCH_ERR (21): the given URL does not match another URL',
|
||||
'QUOTA_EXCEEDED_ERR (22): the quota has been exceeded',
|
||||
'TIMEOUT_ERR (23): a timeout occurred',
|
||||
'INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation',
|
||||
'DATA_CLONE_ERR (25): the object can not be cloned.'
|
||||
];
|
||||
|
||||
// Name to code
|
||||
var constants = {
|
||||
INDEX_SIZE_ERR: INDEX_SIZE_ERR,
|
||||
DOMSTRING_SIZE_ERR: 2, // historical
|
||||
HIERARCHY_REQUEST_ERR: HIERARCHY_REQUEST_ERR,
|
||||
WRONG_DOCUMENT_ERR: WRONG_DOCUMENT_ERR,
|
||||
INVALID_CHARACTER_ERR: INVALID_CHARACTER_ERR,
|
||||
NO_DATA_ALLOWED_ERR: 6, // historical
|
||||
NO_MODIFICATION_ALLOWED_ERR: NO_MODIFICATION_ALLOWED_ERR,
|
||||
NOT_FOUND_ERR: NOT_FOUND_ERR,
|
||||
NOT_SUPPORTED_ERR: NOT_SUPPORTED_ERR,
|
||||
INUSE_ATTRIBUTE_ERR: 10, // historical
|
||||
INVALID_STATE_ERR: INVALID_STATE_ERR,
|
||||
SYNTAX_ERR: SYNTAX_ERR,
|
||||
INVALID_MODIFICATION_ERR: INVALID_MODIFICATION_ERR,
|
||||
NAMESPACE_ERR: NAMESPACE_ERR,
|
||||
INVALID_ACCESS_ERR: INVALID_ACCESS_ERR,
|
||||
VALIDATION_ERR: 16, // historical
|
||||
TYPE_MISMATCH_ERR: TYPE_MISMATCH_ERR,
|
||||
SECURITY_ERR: SECURITY_ERR,
|
||||
NETWORK_ERR: NETWORK_ERR,
|
||||
ABORT_ERR: ABORT_ERR,
|
||||
URL_MISMATCH_ERR: URL_MISMATCH_ERR,
|
||||
QUOTA_EXCEEDED_ERR: QUOTA_EXCEEDED_ERR,
|
||||
TIMEOUT_ERR: TIMEOUT_ERR,
|
||||
INVALID_NODE_TYPE_ERR: INVALID_NODE_TYPE_ERR,
|
||||
DATA_CLONE_ERR: DATA_CLONE_ERR
|
||||
};
|
||||
|
||||
function DOMException(code) {
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
this.code = code;
|
||||
this.message = messages[code];
|
||||
this.name = names[code];
|
||||
}
|
||||
DOMException.prototype.__proto__ = Error.prototype;
|
||||
|
||||
// Initialize the constants on DOMException and DOMException.prototype
|
||||
for(var c in constants) {
|
||||
var v = { value: constants[c] };
|
||||
Object.defineProperty(DOMException, c, v);
|
||||
Object.defineProperty(DOMException.prototype, c, v);
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
module.exports = DOMImplementation;
|
||||
|
||||
var Document = require('./Document');
|
||||
var DocumentType = require('./DocumentType');
|
||||
var HTMLParser = require('./HTMLParser');
|
||||
var utils = require('./utils');
|
||||
var xml = require('./xmlnames');
|
||||
|
||||
// Each document must have its own instance of the domimplementation object
|
||||
function DOMImplementation(contextObject) {
|
||||
this.contextObject = contextObject;
|
||||
}
|
||||
|
||||
|
||||
// Feature/version pairs that DOMImplementation.hasFeature() returns
|
||||
// true for. It returns false for anything else.
|
||||
var supportedFeatures = {
|
||||
'xml': { '': true, '1.0': true, '2.0': true }, // DOM Core
|
||||
'core': { '': true, '2.0': true }, // DOM Core
|
||||
'html': { '': true, '1.0': true, '2.0': true} , // HTML
|
||||
'xhtml': { '': true, '1.0': true, '2.0': true} , // HTML
|
||||
};
|
||||
|
||||
DOMImplementation.prototype = {
|
||||
hasFeature: function hasFeature(feature, version) {
|
||||
var f = supportedFeatures[(feature || '').toLowerCase()];
|
||||
return (f && f[version || '']) || false;
|
||||
},
|
||||
|
||||
createDocumentType: function createDocumentType(qualifiedName, publicId, systemId) {
|
||||
if (!xml.isValidQName(qualifiedName)) utils.InvalidCharacterError();
|
||||
|
||||
return new DocumentType(this.contextObject, qualifiedName, publicId, systemId);
|
||||
},
|
||||
|
||||
createDocument: function createDocument(namespace, qualifiedName, doctype) {
|
||||
//
|
||||
// Note that the current DOMCore spec makes it impossible to
|
||||
// create an HTML document with this function, even if the
|
||||
// namespace and doctype are propertly set. See this thread:
|
||||
// http://lists.w3.org/Archives/Public/www-dom/2011AprJun/0132.html
|
||||
//
|
||||
var d = new Document(false, null);
|
||||
var e;
|
||||
|
||||
if (qualifiedName)
|
||||
e = d.createElementNS(namespace, qualifiedName);
|
||||
else
|
||||
e = null;
|
||||
|
||||
if (doctype) {
|
||||
d.appendChild(doctype);
|
||||
}
|
||||
|
||||
if (e) d.appendChild(e);
|
||||
if (namespace === utils.NAMESPACE.HTML) {
|
||||
d._contentType = 'application/xhtml+xml';
|
||||
} else if (namespace === utils.NAMESPACE.SVG) {
|
||||
d._contentType = 'image/svg+xml';
|
||||
} else {
|
||||
d._contentType = 'application/xml';
|
||||
}
|
||||
|
||||
return d;
|
||||
},
|
||||
|
||||
createHTMLDocument: function createHTMLDocument(titleText) {
|
||||
var d = new Document(true, null);
|
||||
d.appendChild(new DocumentType(d, 'html'));
|
||||
var html = d.createElement('html');
|
||||
d.appendChild(html);
|
||||
var head = d.createElement('head');
|
||||
html.appendChild(head);
|
||||
if (titleText !== undefined) {
|
||||
var title = d.createElement('title');
|
||||
head.appendChild(title);
|
||||
title.appendChild(d.createTextNode(titleText));
|
||||
}
|
||||
html.appendChild(d.createElement('body'));
|
||||
d.modclock = 1; // Start tracking modifications
|
||||
return d;
|
||||
},
|
||||
|
||||
mozSetOutputMutationHandler: function(doc, handler) {
|
||||
doc.mutationHandler = handler;
|
||||
},
|
||||
|
||||
mozGetInputMutationHandler: function(doc) {
|
||||
utils.nyi();
|
||||
},
|
||||
|
||||
mozHTMLParser: HTMLParser,
|
||||
};
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
// DOMTokenList implementation based on https://github.com/Raynos/DOM-shim
|
||||
var utils = require('./utils');
|
||||
|
||||
module.exports = DOMTokenList;
|
||||
|
||||
function DOMTokenList(getter, setter) {
|
||||
this._getString = getter;
|
||||
this._setString = setter;
|
||||
this._length = 0;
|
||||
this._lastStringValue = '';
|
||||
this._update();
|
||||
}
|
||||
|
||||
Object.defineProperties(DOMTokenList.prototype, {
|
||||
length: { get: function() { return this._length; } },
|
||||
item: { value: function(index) {
|
||||
var list = getList(this);
|
||||
if (index < 0 || index >= list.length) {
|
||||
return null;
|
||||
}
|
||||
return list[index];
|
||||
}},
|
||||
|
||||
contains: { value: function(token) {
|
||||
token = String(token); // no error checking for contains()
|
||||
var list = getList(this);
|
||||
return list.indexOf(token) > -1;
|
||||
}},
|
||||
|
||||
add: { value: function() {
|
||||
var list = getList(this);
|
||||
for (var i = 0, len = arguments.length; i < len; i++) {
|
||||
var token = handleErrors(arguments[i]);
|
||||
if (list.indexOf(token) < 0) {
|
||||
list.push(token);
|
||||
}
|
||||
}
|
||||
// Note: as per spec, if handleErrors() throws any errors, we never
|
||||
// make it here and none of the changes take effect.
|
||||
// Also per spec: we run the "update steps" even if no change was
|
||||
// made (ie, if the token already existed)
|
||||
this._update(list);
|
||||
}},
|
||||
|
||||
remove: { value: function() {
|
||||
var list = getList(this);
|
||||
for (var i = 0, len = arguments.length; i < len; i++) {
|
||||
var token = handleErrors(arguments[i]);
|
||||
var index = list.indexOf(token);
|
||||
if (index > -1) {
|
||||
list.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// Note: as per spec, if handleErrors() throws any errors, we never
|
||||
// make it here and none of the changes take effect.
|
||||
// Also per spec: we run the "update steps" even if no change was
|
||||
// made (ie, if the token wasn't previously present)
|
||||
this._update(list);
|
||||
}},
|
||||
|
||||
toggle: { value: function toggle(token, force) {
|
||||
token = handleErrors(token);
|
||||
if (this.contains(token)) {
|
||||
if (force === undefined || force === false) {
|
||||
this.remove(token);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
if (force === undefined || force === true) {
|
||||
this.add(token);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}},
|
||||
|
||||
replace: { value: function replace(token, newToken) {
|
||||
// weird corner case of spec: if `token` contains whitespace, but
|
||||
// `newToken` is the empty string, we must throw SyntaxError not
|
||||
// InvalidCharacterError (sigh)
|
||||
if (String(newToken)==='') { utils.SyntaxError(); }
|
||||
token = handleErrors(token);
|
||||
newToken = handleErrors(newToken);
|
||||
var list = getList(this);
|
||||
var idx = list.indexOf(token);
|
||||
if (idx < 0) {
|
||||
// Note that, per spec, we do not run the update steps on this path.
|
||||
return false;
|
||||
}
|
||||
var idx2 = list.indexOf(newToken);
|
||||
if (idx2 < 0) {
|
||||
list[idx] = newToken;
|
||||
} else {
|
||||
// "replace the first instance of either `token` or `newToken` with
|
||||
// `newToken` and remove all other instances"
|
||||
if (idx < idx2) {
|
||||
list[idx] = newToken;
|
||||
list.splice(idx2, 1);
|
||||
} else {
|
||||
// idx2 is already `newToken`
|
||||
list.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
this._update(list);
|
||||
return true;
|
||||
}},
|
||||
|
||||
toString: { value: function() {
|
||||
return this._getString();
|
||||
}},
|
||||
|
||||
value: {
|
||||
get: function() {
|
||||
return this._getString();
|
||||
},
|
||||
set: function(v) {
|
||||
this._setString(v);
|
||||
this._update();
|
||||
}
|
||||
},
|
||||
|
||||
// Called when the setter is called from outside this interface.
|
||||
_update: { value: function(list) {
|
||||
if (list) {
|
||||
fixIndex(this, list);
|
||||
this._setString(list.join(" ").trim());
|
||||
} else {
|
||||
fixIndex(this, getList(this));
|
||||
}
|
||||
this._lastStringValue = this._getString();
|
||||
} },
|
||||
});
|
||||
|
||||
function fixIndex(clist, list) {
|
||||
var oldLength = clist._length;
|
||||
var i;
|
||||
clist._length = list.length;
|
||||
for (i = 0; i < list.length; i++) {
|
||||
clist[i] = list[i];
|
||||
}
|
||||
// Clear/free old entries.
|
||||
for (; i < oldLength; i++) {
|
||||
clist[i] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function handleErrors(token) {
|
||||
token = String(token);
|
||||
if (token === "") {
|
||||
utils.SyntaxError();
|
||||
}
|
||||
if (/[ \t\r\n\f]/.test(token)) {
|
||||
utils.InvalidCharacterError();
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
function toArray(clist) {
|
||||
var length = clist._length;
|
||||
var arr = Array(length);
|
||||
for (var i = 0; i < length; i++) {
|
||||
arr[i] = clist[i];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function getList(clist) {
|
||||
var strProp = clist._getString();
|
||||
if (strProp === clist._lastStringValue) {
|
||||
return toArray(clist);
|
||||
}
|
||||
var str = strProp.replace(/(^[ \t\r\n\f]+)|([ \t\r\n\f]+$)/g, '');
|
||||
if (str === "") {
|
||||
return [];
|
||||
} else {
|
||||
var seen = Object.create(null);
|
||||
return str.split(/[ \t\r\n\f]+/g).filter(function(n) {
|
||||
var key = '$' + n;
|
||||
if (seen[key]) { return false; }
|
||||
seen[key] = true;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
+884
@@ -0,0 +1,884 @@
|
||||
"use strict";
|
||||
module.exports = Document;
|
||||
|
||||
var Node = require('./Node');
|
||||
var NodeList = require('./NodeList');
|
||||
var ContainerNode = require('./ContainerNode');
|
||||
var Element = require('./Element');
|
||||
var Text = require('./Text');
|
||||
var Comment = require('./Comment');
|
||||
var Event = require('./Event');
|
||||
var DocumentFragment = require('./DocumentFragment');
|
||||
var ProcessingInstruction = require('./ProcessingInstruction');
|
||||
var DOMImplementation = require('./DOMImplementation');
|
||||
var TreeWalker = require('./TreeWalker');
|
||||
var NodeIterator = require('./NodeIterator');
|
||||
var NodeFilter = require('./NodeFilter');
|
||||
var URL = require('./URL');
|
||||
var select = require('./select');
|
||||
var events = require('./events');
|
||||
var xml = require('./xmlnames');
|
||||
var html = require('./htmlelts');
|
||||
var svg = require('./svg');
|
||||
var utils = require('./utils');
|
||||
var MUTATE = require('./MutationConstants');
|
||||
var NAMESPACE = utils.NAMESPACE;
|
||||
var isApiWritable = require("./config").isApiWritable;
|
||||
|
||||
function Document(isHTML, address) {
|
||||
ContainerNode.call(this);
|
||||
this.nodeType = Node.DOCUMENT_NODE;
|
||||
this.isHTML = isHTML;
|
||||
this._address = address || 'about:blank';
|
||||
this.readyState = 'loading';
|
||||
this.implementation = new DOMImplementation(this);
|
||||
|
||||
// DOMCore says that documents are always associated with themselves
|
||||
this.ownerDocument = null; // ... but W3C tests expect null
|
||||
this._contentType = isHTML ? 'text/html' : 'application/xml';
|
||||
|
||||
// These will be initialized by our custom versions of
|
||||
// appendChild and insertBefore that override the inherited
|
||||
// Node methods.
|
||||
// XXX: override those methods!
|
||||
this.doctype = null;
|
||||
this.documentElement = null;
|
||||
|
||||
// "Associated inert template document"
|
||||
this._templateDocCache = null;
|
||||
// List of active NodeIterators, see NodeIterator#_preremove()
|
||||
this._nodeIterators = null;
|
||||
|
||||
// Documents are always rooted, by definition
|
||||
this._nid = 1;
|
||||
this._nextnid = 2; // For numbering children of the document
|
||||
this._nodes = [null, this]; // nid to node map
|
||||
|
||||
// This maintains the mapping from element ids to element nodes.
|
||||
// We may need to update this mapping every time a node is rooted
|
||||
// or uprooted, and any time an attribute is added, removed or changed
|
||||
// on a rooted element.
|
||||
this.byId = Object.create(null);
|
||||
|
||||
// This property holds a monotonically increasing value akin to
|
||||
// a timestamp used to record the last modification time of nodes
|
||||
// and their subtrees. See the lastModTime attribute and modify()
|
||||
// method of the Node class. And see FilteredElementList for an example
|
||||
// of the use of lastModTime
|
||||
this.modclock = 0;
|
||||
}
|
||||
|
||||
// Map from lowercase event category names (used as arguments to
|
||||
// createEvent()) to the property name in the impl object of the
|
||||
// event constructor.
|
||||
var supportedEvents = {
|
||||
event: 'Event',
|
||||
customevent: 'CustomEvent',
|
||||
uievent: 'UIEvent',
|
||||
mouseevent: 'MouseEvent'
|
||||
};
|
||||
|
||||
// Certain arguments to document.createEvent() must be treated specially
|
||||
var replacementEvent = {
|
||||
events: 'event',
|
||||
htmlevents: 'event',
|
||||
mouseevents: 'mouseevent',
|
||||
mutationevents: 'mutationevent',
|
||||
uievents: 'uievent'
|
||||
};
|
||||
|
||||
var mirrorAttr = function(f, name, defaultValue) {
|
||||
return {
|
||||
get: function() {
|
||||
var o = f.call(this);
|
||||
if (o) { return o[name]; }
|
||||
return defaultValue;
|
||||
},
|
||||
set: function(value) {
|
||||
var o = f.call(this);
|
||||
if (o) { o[name] = value; }
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/** @spec https://dom.spec.whatwg.org/#validate-and-extract */
|
||||
function validateAndExtract(namespace, qualifiedName) {
|
||||
var prefix, localName, pos;
|
||||
if (namespace==='') { namespace = null; }
|
||||
// See https://github.com/whatwg/dom/issues/671
|
||||
// and https://github.com/whatwg/dom/issues/319
|
||||
if (!xml.isValidQName(qualifiedName)) {
|
||||
utils.InvalidCharacterError();
|
||||
}
|
||||
prefix = null;
|
||||
localName = qualifiedName;
|
||||
|
||||
pos = qualifiedName.indexOf(':');
|
||||
if (pos >= 0) {
|
||||
prefix = qualifiedName.substring(0, pos);
|
||||
localName = qualifiedName.substring(pos+1);
|
||||
}
|
||||
if (prefix !== null && namespace === null) {
|
||||
utils.NamespaceError();
|
||||
}
|
||||
if (prefix === 'xml' && namespace !== NAMESPACE.XML) {
|
||||
utils.NamespaceError();
|
||||
}
|
||||
if ((prefix === 'xmlns' || qualifiedName === 'xmlns') &&
|
||||
namespace !== NAMESPACE.XMLNS) {
|
||||
utils.NamespaceError();
|
||||
}
|
||||
if (namespace === NAMESPACE.XMLNS && !(prefix==='xmlns' || qualifiedName==='xmlns')) {
|
||||
utils.NamespaceError();
|
||||
}
|
||||
return { namespace: namespace, prefix: prefix, localName: localName };
|
||||
}
|
||||
|
||||
Document.prototype = Object.create(ContainerNode.prototype, {
|
||||
// This method allows dom.js to communicate with a renderer
|
||||
// that displays the document in some way
|
||||
// XXX: I should probably move this to the window object
|
||||
_setMutationHandler: { value: function(handler) {
|
||||
this.mutationHandler = handler;
|
||||
}},
|
||||
|
||||
// This method allows dom.js to receive event notifications
|
||||
// from the renderer.
|
||||
// XXX: I should probably move this to the window object
|
||||
_dispatchRendererEvent: { value: function(targetNid, type, details) {
|
||||
var target = this._nodes[targetNid];
|
||||
if (!target) return;
|
||||
target._dispatchEvent(new Event(type, details), true);
|
||||
}},
|
||||
|
||||
nodeName: { value: '#document'},
|
||||
nodeValue: {
|
||||
get: function() {
|
||||
return null;
|
||||
},
|
||||
set: function() {}
|
||||
},
|
||||
|
||||
// XXX: DOMCore may remove documentURI, so it is NYI for now
|
||||
documentURI: { get: function() { return this._address; }, set: utils.nyi },
|
||||
compatMode: { get: function() {
|
||||
// The _quirks property is set by the HTML parser
|
||||
return this._quirks ? 'BackCompat' : 'CSS1Compat';
|
||||
}},
|
||||
|
||||
createTextNode: { value: function(data) {
|
||||
return new Text(this, String(data));
|
||||
}},
|
||||
createComment: { value: function(data) {
|
||||
return new Comment(this, data);
|
||||
}},
|
||||
createDocumentFragment: { value: function() {
|
||||
return new DocumentFragment(this);
|
||||
}},
|
||||
createProcessingInstruction: { value: function(target, data) {
|
||||
if (!xml.isValidName(target) || data.indexOf('?>') !== -1)
|
||||
utils.InvalidCharacterError();
|
||||
return new ProcessingInstruction(this, target, data);
|
||||
}},
|
||||
|
||||
createAttribute: { value: function(localName) {
|
||||
localName = String(localName);
|
||||
if (!xml.isValidName(localName)) utils.InvalidCharacterError();
|
||||
if (this.isHTML) {
|
||||
localName = utils.toASCIILowerCase(localName);
|
||||
}
|
||||
return new Element._Attr(null, localName, null, null, '');
|
||||
}},
|
||||
createAttributeNS: { value: function(namespace, qualifiedName) {
|
||||
// Convert parameter types according to WebIDL
|
||||
namespace =
|
||||
(namespace === null || namespace === undefined || namespace === '') ? null :
|
||||
String(namespace);
|
||||
qualifiedName = String(qualifiedName);
|
||||
var ve = validateAndExtract(namespace, qualifiedName);
|
||||
return new Element._Attr(null, ve.localName, ve.prefix, ve.namespace, '');
|
||||
}},
|
||||
|
||||
createElement: { value: function(localName) {
|
||||
localName = String(localName);
|
||||
if (!xml.isValidName(localName)) utils.InvalidCharacterError();
|
||||
// Per spec, namespace should be HTML namespace if "context object is
|
||||
// an HTML document or context object's content type is
|
||||
// "application/xhtml+xml", and null otherwise.
|
||||
if (this.isHTML) {
|
||||
if (/[A-Z]/.test(localName))
|
||||
localName = utils.toASCIILowerCase(localName);
|
||||
return html.createElement(this, localName, null);
|
||||
} else if (this.contentType === 'application/xhtml+xml') {
|
||||
return html.createElement(this, localName, null);
|
||||
} else {
|
||||
return new Element(this, localName, null, null);
|
||||
}
|
||||
}, writable: isApiWritable },
|
||||
|
||||
createElementNS: { value: function(namespace, qualifiedName) {
|
||||
// Convert parameter types according to WebIDL
|
||||
namespace =
|
||||
(namespace === null || namespace === undefined || namespace === '') ? null :
|
||||
String(namespace);
|
||||
qualifiedName = String(qualifiedName);
|
||||
var ve = validateAndExtract(namespace, qualifiedName);
|
||||
return this._createElementNS(ve.localName, ve.namespace, ve.prefix);
|
||||
}, writable: isApiWritable },
|
||||
|
||||
// This is used directly by HTML parser, which allows it to create
|
||||
// elements with localNames containing ':' and non-default namespaces
|
||||
_createElementNS: { value: function(localName, namespace, prefix) {
|
||||
if (namespace === NAMESPACE.HTML) {
|
||||
return html.createElement(this, localName, prefix);
|
||||
}
|
||||
else if (namespace === NAMESPACE.SVG) {
|
||||
return svg.createElement(this, localName, prefix);
|
||||
}
|
||||
|
||||
return new Element(this, localName, namespace, prefix);
|
||||
}},
|
||||
|
||||
createEvent: { value: function createEvent(interfaceName) {
|
||||
interfaceName = interfaceName.toLowerCase();
|
||||
var name = replacementEvent[interfaceName] || interfaceName;
|
||||
var constructor = events[supportedEvents[name]];
|
||||
|
||||
if (constructor) {
|
||||
var e = new constructor();
|
||||
e._initialized = false;
|
||||
return e;
|
||||
}
|
||||
else {
|
||||
utils.NotSupportedError();
|
||||
}
|
||||
}},
|
||||
|
||||
// See: http://www.w3.org/TR/dom/#dom-document-createtreewalker
|
||||
createTreeWalker: {value: function (root, whatToShow, filter) {
|
||||
if (!root) { throw new TypeError("root argument is required"); }
|
||||
if (!(root instanceof Node)) { throw new TypeError("root not a node"); }
|
||||
whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow);
|
||||
filter = filter === undefined ? null : filter;
|
||||
|
||||
return new TreeWalker(root, whatToShow, filter);
|
||||
}},
|
||||
|
||||
// See: http://www.w3.org/TR/dom/#dom-document-createnodeiterator
|
||||
createNodeIterator: {value: function (root, whatToShow, filter) {
|
||||
if (!root) { throw new TypeError("root argument is required"); }
|
||||
if (!(root instanceof Node)) { throw new TypeError("root not a node"); }
|
||||
whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow);
|
||||
filter = filter === undefined ? null : filter;
|
||||
|
||||
return new NodeIterator(root, whatToShow, filter);
|
||||
}},
|
||||
|
||||
_attachNodeIterator: { value: function(ni) {
|
||||
// XXX ideally this should be a weak reference from Document to NodeIterator
|
||||
if (!this._nodeIterators) { this._nodeIterators = []; }
|
||||
this._nodeIterators.push(ni);
|
||||
}},
|
||||
|
||||
_detachNodeIterator: { value: function(ni) {
|
||||
// ni should always be in list of node iterators
|
||||
var idx = this._nodeIterators.indexOf(ni);
|
||||
this._nodeIterators.splice(idx, 1);
|
||||
}},
|
||||
|
||||
_preremoveNodeIterators: { value: function(toBeRemoved) {
|
||||
if (this._nodeIterators) {
|
||||
this._nodeIterators.forEach(function(ni) { ni._preremove(toBeRemoved); });
|
||||
}
|
||||
}},
|
||||
|
||||
// Maintain the documentElement and
|
||||
// doctype properties of the document. Each of the following
|
||||
// methods chains to the Node implementation of the method
|
||||
// to do the actual inserting, removal or replacement.
|
||||
|
||||
_updateDocTypeElement: { value: function _updateDocTypeElement() {
|
||||
this.doctype = this.documentElement = null;
|
||||
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === Node.DOCUMENT_TYPE_NODE)
|
||||
this.doctype = kid;
|
||||
else if (kid.nodeType === Node.ELEMENT_NODE)
|
||||
this.documentElement = kid;
|
||||
}
|
||||
}},
|
||||
|
||||
insertBefore: { value: function insertBefore(child, refChild) {
|
||||
Node.prototype.insertBefore.call(this, child, refChild);
|
||||
this._updateDocTypeElement();
|
||||
return child;
|
||||
}},
|
||||
|
||||
replaceChild: { value: function replaceChild(node, child) {
|
||||
Node.prototype.replaceChild.call(this, node, child);
|
||||
this._updateDocTypeElement();
|
||||
return child;
|
||||
}},
|
||||
|
||||
removeChild: { value: function removeChild(child) {
|
||||
Node.prototype.removeChild.call(this, child);
|
||||
this._updateDocTypeElement();
|
||||
return child;
|
||||
}},
|
||||
|
||||
getElementById: { value: function(id) {
|
||||
var n = this.byId[id];
|
||||
if (!n) return null;
|
||||
if (n instanceof MultiId) { // there was more than one element with this id
|
||||
return n.getFirst();
|
||||
}
|
||||
return n;
|
||||
}},
|
||||
|
||||
_hasMultipleElementsWithId: { value: function(id) {
|
||||
// Used internally by querySelectorAll optimization
|
||||
return (this.byId[id] instanceof MultiId);
|
||||
}},
|
||||
|
||||
// Just copy this method from the Element prototype
|
||||
getElementsByName: { value: Element.prototype.getElementsByName },
|
||||
getElementsByTagName: { value: Element.prototype.getElementsByTagName },
|
||||
getElementsByTagNameNS: { value: Element.prototype.getElementsByTagNameNS },
|
||||
getElementsByClassName: { value: Element.prototype.getElementsByClassName },
|
||||
|
||||
adoptNode: { value: function adoptNode(node) {
|
||||
if (node.nodeType === Node.DOCUMENT_NODE) utils.NotSupportedError();
|
||||
if (node.nodeType === Node.ATTRIBUTE_NODE) { return node; }
|
||||
|
||||
if (node.parentNode) node.parentNode.removeChild(node);
|
||||
|
||||
if (node.ownerDocument !== this)
|
||||
recursivelySetOwner(node, this);
|
||||
|
||||
return node;
|
||||
}},
|
||||
|
||||
importNode: { value: function importNode(node, deep) {
|
||||
return this.adoptNode(node.cloneNode(deep));
|
||||
}, writable: isApiWritable },
|
||||
|
||||
// The following attributes and methods are from the HTML spec
|
||||
origin: { get: function origin() { return null; } },
|
||||
characterSet: { get: function characterSet() { return "UTF-8"; } },
|
||||
contentType: { get: function contentType() { return this._contentType; } },
|
||||
URL: { get: function URL() { return this._address; } },
|
||||
domain: { get: utils.nyi, set: utils.nyi },
|
||||
referrer: { get: utils.nyi },
|
||||
cookie: { get: utils.nyi, set: utils.nyi },
|
||||
lastModified: { get: utils.nyi },
|
||||
location: {
|
||||
get: function() {
|
||||
return this.defaultView ? this.defaultView.location : null; // gh #75
|
||||
},
|
||||
set: utils.nyi
|
||||
},
|
||||
_titleElement: {
|
||||
get: function() {
|
||||
// The title element of a document is the first title element in the
|
||||
// document in tree order, if there is one, or null otherwise.
|
||||
return this.getElementsByTagName('title').item(0) || null;
|
||||
}
|
||||
},
|
||||
title: {
|
||||
get: function() {
|
||||
var elt = this._titleElement;
|
||||
// The child text content of the title element, or '' if null.
|
||||
var value = elt ? elt.textContent : '';
|
||||
// Strip and collapse whitespace in value
|
||||
return value.replace(/[ \t\n\r\f]+/g, ' ').replace(/(^ )|( $)/g, '');
|
||||
},
|
||||
set: function(value) {
|
||||
var elt = this._titleElement;
|
||||
var head = this.head;
|
||||
if (!elt && !head) { return; /* according to spec */ }
|
||||
if (!elt) {
|
||||
elt = this.createElement('title');
|
||||
head.appendChild(elt);
|
||||
}
|
||||
elt.textContent = value;
|
||||
}
|
||||
},
|
||||
dir: mirrorAttr(function() {
|
||||
var htmlElement = this.documentElement;
|
||||
if (htmlElement && htmlElement.tagName === 'HTML') { return htmlElement; }
|
||||
}, 'dir', ''),
|
||||
fgColor: mirrorAttr(function() { return this.body; }, 'text', ''),
|
||||
linkColor: mirrorAttr(function() { return this.body; }, 'link', ''),
|
||||
vlinkColor: mirrorAttr(function() { return this.body; }, 'vLink', ''),
|
||||
alinkColor: mirrorAttr(function() { return this.body; }, 'aLink', ''),
|
||||
bgColor: mirrorAttr(function() { return this.body; }, 'bgColor', ''),
|
||||
|
||||
// Historical aliases of Document#characterSet
|
||||
charset: { get: function() { return this.characterSet; } },
|
||||
inputEncoding: { get: function() { return this.characterSet; } },
|
||||
|
||||
scrollingElement: {
|
||||
get: function() {
|
||||
return this._quirks ? this.body : this.documentElement;
|
||||
}
|
||||
},
|
||||
|
||||
// Return the first <body> child of the document element.
|
||||
// XXX For now, setting this attribute is not implemented.
|
||||
body: {
|
||||
get: function() {
|
||||
return namedHTMLChild(this.documentElement, 'body');
|
||||
},
|
||||
set: utils.nyi
|
||||
},
|
||||
// Return the first <head> child of the document element.
|
||||
head: { get: function() {
|
||||
return namedHTMLChild(this.documentElement, 'head');
|
||||
}},
|
||||
images: { get: utils.nyi },
|
||||
embeds: { get: utils.nyi },
|
||||
plugins: { get: utils.nyi },
|
||||
links: { get: utils.nyi },
|
||||
forms: { get: utils.nyi },
|
||||
scripts: { get: utils.nyi },
|
||||
applets: { get: function() { return []; } },
|
||||
activeElement: { get: function() { return null; } },
|
||||
innerHTML: {
|
||||
get: function() { return this.serialize(); },
|
||||
set: utils.nyi
|
||||
},
|
||||
outerHTML: {
|
||||
get: function() { return this.serialize(); },
|
||||
set: utils.nyi
|
||||
},
|
||||
|
||||
write: { value: function(args) {
|
||||
if (!this.isHTML) utils.InvalidStateError();
|
||||
|
||||
// XXX: still have to implement the ignore part
|
||||
if (!this._parser /* && this._ignore_destructive_writes > 0 */ )
|
||||
return;
|
||||
|
||||
if (!this._parser) {
|
||||
// XXX call document.open, etc.
|
||||
}
|
||||
|
||||
var s = arguments.join('');
|
||||
|
||||
// If the Document object's reload override flag is set, then
|
||||
// append the string consisting of the concatenation of all the
|
||||
// arguments to the method to the Document's reload override
|
||||
// buffer.
|
||||
// XXX: don't know what this is about. Still have to do it
|
||||
|
||||
// If there is no pending parsing-blocking script, have the
|
||||
// tokenizer process the characters that were inserted, one at a
|
||||
// time, processing resulting tokens as they are emitted, and
|
||||
// stopping when the tokenizer reaches the insertion point or when
|
||||
// the processing of the tokenizer is aborted by the tree
|
||||
// construction stage (this can happen if a script end tag token is
|
||||
// emitted by the tokenizer).
|
||||
|
||||
// XXX: still have to do the above. Sounds as if we don't
|
||||
// always call parse() here. If we're blocked, then we just
|
||||
// insert the text into the stream but don't parse it reentrantly...
|
||||
|
||||
// Invoke the parser reentrantly
|
||||
this._parser.parse(s);
|
||||
}},
|
||||
|
||||
writeln: { value: function writeln(args) {
|
||||
this.write(Array.prototype.join.call(arguments, '') + '\n');
|
||||
}},
|
||||
|
||||
open: { value: function() {
|
||||
this.documentElement = null;
|
||||
}},
|
||||
|
||||
close: { value: function() {
|
||||
this.readyState = 'interactive';
|
||||
this._dispatchEvent(new Event('readystatechange'), true);
|
||||
this._dispatchEvent(new Event('DOMContentLoaded'), true);
|
||||
this.readyState = 'complete';
|
||||
this._dispatchEvent(new Event('readystatechange'), true);
|
||||
if (this.defaultView) {
|
||||
this.defaultView._dispatchEvent(new Event('load'), true);
|
||||
}
|
||||
}},
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
var d = new Document(this.isHTML, this._address);
|
||||
d._quirks = this._quirks;
|
||||
d._contentType = this._contentType;
|
||||
return d;
|
||||
}},
|
||||
|
||||
// We need to adopt the nodes if we do a deep clone
|
||||
cloneNode: { value: function cloneNode(deep) {
|
||||
var clone = Node.prototype.cloneNode.call(this, false);
|
||||
if (deep) {
|
||||
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
clone._appendChild(clone.importNode(kid, true));
|
||||
}
|
||||
}
|
||||
clone._updateDocTypeElement();
|
||||
return clone;
|
||||
}},
|
||||
|
||||
isEqual: { value: function isEqual(n) {
|
||||
// Any two documents are shallowly equal.
|
||||
// Node.isEqualNode will also test the children
|
||||
return true;
|
||||
}},
|
||||
|
||||
// Implementation-specific function. Called when a text, comment,
|
||||
// or pi value changes.
|
||||
mutateValue: { value: function(node) {
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.VALUE,
|
||||
target: node,
|
||||
data: node.data
|
||||
});
|
||||
}
|
||||
}},
|
||||
|
||||
// Invoked when an attribute's value changes. Attr holds the new
|
||||
// value. oldval is the old value. Attribute mutations can also
|
||||
// involve changes to the prefix (and therefore the qualified name)
|
||||
mutateAttr: { value: function(attr, oldval) {
|
||||
// Manage id->element mapping for getElementsById()
|
||||
// XXX: this special case id handling should not go here,
|
||||
// but in the attribute declaration for the id attribute
|
||||
/*
|
||||
if (attr.localName === 'id' && attr.namespaceURI === null) {
|
||||
if (oldval) delId(oldval, attr.ownerElement);
|
||||
addId(attr.value, attr.ownerElement);
|
||||
}
|
||||
*/
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.ATTR,
|
||||
target: attr.ownerElement,
|
||||
attr: attr
|
||||
});
|
||||
}
|
||||
}},
|
||||
|
||||
// Used by removeAttribute and removeAttributeNS for attributes.
|
||||
mutateRemoveAttr: { value: function(attr) {
|
||||
/*
|
||||
* This is now handled in Attributes.js
|
||||
// Manage id to element mapping
|
||||
if (attr.localName === 'id' && attr.namespaceURI === null) {
|
||||
this.delId(attr.value, attr.ownerElement);
|
||||
}
|
||||
*/
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.REMOVE_ATTR,
|
||||
target: attr.ownerElement,
|
||||
attr: attr
|
||||
});
|
||||
}
|
||||
}},
|
||||
|
||||
// Called by Node.removeChild, etc. to remove a rooted element from
|
||||
// the tree. Only needs to generate a single mutation event when a
|
||||
// node is removed, but must recursively mark all descendants as not
|
||||
// rooted.
|
||||
mutateRemove: { value: function(node) {
|
||||
// Send a single mutation event
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.REMOVE,
|
||||
target: node.parentNode,
|
||||
node: node
|
||||
});
|
||||
}
|
||||
|
||||
// Mark this and all descendants as not rooted
|
||||
recursivelyUproot(node);
|
||||
}},
|
||||
|
||||
// Called when a new element becomes rooted. It must recursively
|
||||
// generate mutation events for each of the children, and mark them all
|
||||
// as rooted.
|
||||
mutateInsert: { value: function(node) {
|
||||
// Mark node and its descendants as rooted
|
||||
recursivelyRoot(node);
|
||||
|
||||
// Send a single mutation event
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.INSERT,
|
||||
target: node.parentNode,
|
||||
node: node
|
||||
});
|
||||
}
|
||||
}},
|
||||
|
||||
// Called when a rooted element is moved within the document
|
||||
mutateMove: { value: function(node) {
|
||||
if (this.mutationHandler) {
|
||||
this.mutationHandler({
|
||||
type: MUTATE.MOVE,
|
||||
target: node
|
||||
});
|
||||
}
|
||||
}},
|
||||
|
||||
|
||||
// Add a mapping from id to n for n.ownerDocument
|
||||
addId: { value: function addId(id, n) {
|
||||
var val = this.byId[id];
|
||||
if (!val) {
|
||||
this.byId[id] = n;
|
||||
}
|
||||
else {
|
||||
// TODO: Add a way to opt-out console warnings
|
||||
//console.warn('Duplicate element id ' + id);
|
||||
if (!(val instanceof MultiId)) {
|
||||
val = new MultiId(val);
|
||||
this.byId[id] = val;
|
||||
}
|
||||
val.add(n);
|
||||
}
|
||||
}},
|
||||
|
||||
// Delete the mapping from id to n for n.ownerDocument
|
||||
delId: { value: function delId(id, n) {
|
||||
var val = this.byId[id];
|
||||
utils.assert(val);
|
||||
|
||||
if (val instanceof MultiId) {
|
||||
val.del(n);
|
||||
if (val.length === 1) { // convert back to a single node
|
||||
this.byId[id] = val.downgrade();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.byId[id] = undefined;
|
||||
}
|
||||
}},
|
||||
|
||||
_resolve: { value: function(href) {
|
||||
//XXX: Cache the URL
|
||||
return new URL(this._documentBaseURL).resolve(href);
|
||||
}},
|
||||
|
||||
_documentBaseURL: { get: function() {
|
||||
// XXX: This is not implemented correctly yet
|
||||
var url = this._address;
|
||||
if (url === 'about:blank') url = '/';
|
||||
|
||||
var base = this.querySelector('base[href]');
|
||||
if (base) {
|
||||
return new URL(url).resolve(base.getAttribute('href'));
|
||||
}
|
||||
return url;
|
||||
|
||||
// The document base URL of a Document object is the
|
||||
// absolute URL obtained by running these substeps:
|
||||
|
||||
// Let fallback base url be the document's address.
|
||||
|
||||
// If fallback base url is about:blank, and the
|
||||
// Document's browsing context has a creator browsing
|
||||
// context, then let fallback base url be the document
|
||||
// base URL of the creator Document instead.
|
||||
|
||||
// If the Document is an iframe srcdoc document, then
|
||||
// let fallback base url be the document base URL of
|
||||
// the Document's browsing context's browsing context
|
||||
// container's Document instead.
|
||||
|
||||
// If there is no base element that has an href
|
||||
// attribute, then the document base URL is fallback
|
||||
// base url; abort these steps. Otherwise, let url be
|
||||
// the value of the href attribute of the first such
|
||||
// element.
|
||||
|
||||
// Resolve url relative to fallback base url (thus,
|
||||
// the base href attribute isn't affected by xml:base
|
||||
// attributes).
|
||||
|
||||
// The document base URL is the result of the previous
|
||||
// step if it was successful; otherwise it is fallback
|
||||
// base url.
|
||||
}},
|
||||
|
||||
_templateDoc: { get: function() {
|
||||
if (!this._templateDocCache) {
|
||||
// "associated inert template document"
|
||||
var newDoc = new Document(this.isHTML, this._address);
|
||||
this._templateDocCache = newDoc._templateDocCache = newDoc;
|
||||
}
|
||||
return this._templateDocCache;
|
||||
}},
|
||||
|
||||
querySelector: { value: function(selector) {
|
||||
return select(selector, this)[0];
|
||||
}},
|
||||
|
||||
querySelectorAll: { value: function(selector) {
|
||||
var nodes = select(selector, this);
|
||||
return nodes.item ? nodes : new NodeList(nodes);
|
||||
}}
|
||||
|
||||
});
|
||||
|
||||
|
||||
var eventHandlerTypes = [
|
||||
'abort', 'canplay', 'canplaythrough', 'change', 'click', 'contextmenu',
|
||||
'cuechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave',
|
||||
'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended',
|
||||
'input', 'invalid', 'keydown', 'keypress', 'keyup', 'loadeddata',
|
||||
'loadedmetadata', 'loadstart', 'mousedown', 'mousemove', 'mouseout',
|
||||
'mouseover', 'mouseup', 'mousewheel', 'pause', 'play', 'playing',
|
||||
'progress', 'ratechange', 'readystatechange', 'reset', 'seeked',
|
||||
'seeking', 'select', 'show', 'stalled', 'submit', 'suspend',
|
||||
'timeupdate', 'volumechange', 'waiting',
|
||||
|
||||
'blur', 'error', 'focus', 'load', 'scroll'
|
||||
];
|
||||
|
||||
// Add event handler idl attribute getters and setters to Document
|
||||
eventHandlerTypes.forEach(function(type) {
|
||||
// Define the event handler registration IDL attribute for this type
|
||||
Object.defineProperty(Document.prototype, 'on' + type, {
|
||||
get: function() {
|
||||
return this._getEventHandler(type);
|
||||
},
|
||||
set: function(v) {
|
||||
this._setEventHandler(type, v);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function namedHTMLChild(parent, name) {
|
||||
if (parent && parent.isHTML) {
|
||||
for (var kid = parent.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === Node.ELEMENT_NODE &&
|
||||
kid.localName === name &&
|
||||
kid.namespaceURI === NAMESPACE.HTML) {
|
||||
return kid;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function root(n) {
|
||||
n._nid = n.ownerDocument._nextnid++;
|
||||
n.ownerDocument._nodes[n._nid] = n;
|
||||
// Manage id to element mapping
|
||||
if (n.nodeType === Node.ELEMENT_NODE) {
|
||||
var id = n.getAttribute('id');
|
||||
if (id) n.ownerDocument.addId(id, n);
|
||||
|
||||
// Script elements need to know when they're inserted
|
||||
// into the document
|
||||
if (n._roothook) n._roothook();
|
||||
}
|
||||
}
|
||||
|
||||
function uproot(n) {
|
||||
// Manage id to element mapping
|
||||
if (n.nodeType === Node.ELEMENT_NODE) {
|
||||
var id = n.getAttribute('id');
|
||||
if (id) n.ownerDocument.delId(id, n);
|
||||
}
|
||||
n.ownerDocument._nodes[n._nid] = undefined;
|
||||
n._nid = undefined;
|
||||
}
|
||||
|
||||
function recursivelyRoot(node) {
|
||||
root(node);
|
||||
// XXX:
|
||||
// accessing childNodes on a leaf node creates a new array the
|
||||
// first time, so be careful to write this loop so that it
|
||||
// doesn't do that. node is polymorphic, so maybe this is hard to
|
||||
// optimize? Try switching on nodeType?
|
||||
/*
|
||||
if (node.hasChildNodes()) {
|
||||
var kids = node.childNodes;
|
||||
for(var i = 0, n = kids.length; i < n; i++)
|
||||
recursivelyRoot(kids[i]);
|
||||
}
|
||||
*/
|
||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)
|
||||
recursivelyRoot(kid);
|
||||
}
|
||||
}
|
||||
|
||||
function recursivelyUproot(node) {
|
||||
uproot(node);
|
||||
for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)
|
||||
recursivelyUproot(kid);
|
||||
}
|
||||
|
||||
function recursivelySetOwner(node, owner) {
|
||||
node.ownerDocument = owner;
|
||||
node._lastModTime = undefined; // mod times are document-based
|
||||
if (Object.prototype.hasOwnProperty.call(node, '_tagName')) {
|
||||
node._tagName = undefined; // Element subclasses might need to change case
|
||||
}
|
||||
for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)
|
||||
recursivelySetOwner(kid, owner);
|
||||
}
|
||||
|
||||
// A class for storing multiple nodes with the same ID
|
||||
function MultiId(node) {
|
||||
this.nodes = Object.create(null);
|
||||
this.nodes[node._nid] = node;
|
||||
this.length = 1;
|
||||
this.firstNode = undefined;
|
||||
}
|
||||
|
||||
// Add a node to the list, with O(1) time
|
||||
MultiId.prototype.add = function(node) {
|
||||
if (!this.nodes[node._nid]) {
|
||||
this.nodes[node._nid] = node;
|
||||
this.length++;
|
||||
this.firstNode = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
// Remove a node from the list, with O(1) time
|
||||
MultiId.prototype.del = function(node) {
|
||||
if (this.nodes[node._nid]) {
|
||||
delete this.nodes[node._nid];
|
||||
this.length--;
|
||||
this.firstNode = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
// Get the first node from the list, in the document order
|
||||
// Takes O(N) time in the size of the list, with a cache that is invalidated
|
||||
// when the list is modified.
|
||||
MultiId.prototype.getFirst = function() {
|
||||
/* jshint bitwise: false */
|
||||
if (!this.firstNode) {
|
||||
var nid;
|
||||
for (nid in this.nodes) {
|
||||
if (this.firstNode === undefined ||
|
||||
this.firstNode.compareDocumentPosition(this.nodes[nid]) & Node.DOCUMENT_POSITION_PRECEDING) {
|
||||
this.firstNode = this.nodes[nid];
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.firstNode;
|
||||
};
|
||||
|
||||
// If there is only one node left, return it. Otherwise return "this".
|
||||
MultiId.prototype.downgrade = function() {
|
||||
if (this.length === 1) {
|
||||
var nid;
|
||||
for (nid in this.nodes) {
|
||||
return this.nodes[nid];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
module.exports = DocumentFragment;
|
||||
|
||||
var Node = require('./Node');
|
||||
var NodeList = require('./NodeList');
|
||||
var ContainerNode = require('./ContainerNode');
|
||||
var Element = require('./Element');
|
||||
var select = require('./select');
|
||||
var utils = require('./utils');
|
||||
|
||||
function DocumentFragment(doc) {
|
||||
ContainerNode.call(this);
|
||||
this.nodeType = Node.DOCUMENT_FRAGMENT_NODE;
|
||||
this.ownerDocument = doc;
|
||||
}
|
||||
|
||||
DocumentFragment.prototype = Object.create(ContainerNode.prototype, {
|
||||
nodeName: { value: '#document-fragment' },
|
||||
nodeValue: {
|
||||
get: function() {
|
||||
return null;
|
||||
},
|
||||
set: function() {}
|
||||
},
|
||||
// Copy the text content getter/setter from Element
|
||||
textContent: Object.getOwnPropertyDescriptor(Element.prototype, 'textContent'),
|
||||
|
||||
// Copy the text content getter/setter from Element
|
||||
innerText: Object.getOwnPropertyDescriptor(Element.prototype, 'innerText'),
|
||||
|
||||
querySelector: { value: function(selector) {
|
||||
// implement in terms of querySelectorAll
|
||||
var nodes = this.querySelectorAll(selector);
|
||||
return nodes.length ? nodes[0] : null;
|
||||
}},
|
||||
querySelectorAll: { value: function(selector) {
|
||||
// create a context
|
||||
var context = Object.create(this);
|
||||
// add some methods to the context for zest implementation, without
|
||||
// adding them to the public DocumentFragment API
|
||||
context.isHTML = true; // in HTML namespace (case-insensitive match)
|
||||
context.getElementsByTagName = Element.prototype.getElementsByTagName;
|
||||
context.nextElement =
|
||||
Object.getOwnPropertyDescriptor(Element.prototype, 'firstElementChild').
|
||||
get;
|
||||
// invoke zest
|
||||
var nodes = select(selector, context);
|
||||
return nodes.item ? nodes : new NodeList(nodes);
|
||||
}},
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
return new DocumentFragment(this.ownerDocument);
|
||||
}},
|
||||
isEqual: { value: function isEqual(n) {
|
||||
// Any two document fragments are shallowly equal.
|
||||
// Node.isEqualNode() will test their children for equality
|
||||
return true;
|
||||
}},
|
||||
|
||||
// Non-standard, but useful (github issue #73)
|
||||
innerHTML: {
|
||||
get: function() { return this.serialize(); },
|
||||
set: utils.nyi
|
||||
},
|
||||
outerHTML: {
|
||||
get: function() { return this.serialize(); },
|
||||
set: utils.nyi
|
||||
},
|
||||
|
||||
});
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
module.exports = DocumentType;
|
||||
|
||||
var Node = require('./Node');
|
||||
var Leaf = require('./Leaf');
|
||||
var ChildNode = require('./ChildNode');
|
||||
|
||||
function DocumentType(ownerDocument, name, publicId, systemId) {
|
||||
Leaf.call(this);
|
||||
this.nodeType = Node.DOCUMENT_TYPE_NODE;
|
||||
this.ownerDocument = ownerDocument || null;
|
||||
this.name = name;
|
||||
this.publicId = publicId || "";
|
||||
this.systemId = systemId || "";
|
||||
}
|
||||
|
||||
DocumentType.prototype = Object.create(Leaf.prototype, {
|
||||
nodeName: { get: function() { return this.name; }},
|
||||
nodeValue: {
|
||||
get: function() { return null; },
|
||||
set: function() {}
|
||||
},
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
return new DocumentType(this.ownerDocument, this.name, this.publicId, this.systemId);
|
||||
}},
|
||||
|
||||
isEqual: { value: function isEqual(n) {
|
||||
return this.name === n.name &&
|
||||
this.publicId === n.publicId &&
|
||||
this.systemId === n.systemId;
|
||||
}}
|
||||
});
|
||||
|
||||
Object.defineProperties(DocumentType.prototype, ChildNode);
|
||||
+1228
File diff suppressed because it is too large.
Load diff
+66
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
module.exports = Event;
|
||||
|
||||
Event.CAPTURING_PHASE = 1;
|
||||
Event.AT_TARGET = 2;
|
||||
Event.BUBBLING_PHASE = 3;
|
||||
|
||||
function Event(type, dictionary) {
|
||||
// Initialize basic event properties
|
||||
this.type = '';
|
||||
this.target = null;
|
||||
this.currentTarget = null;
|
||||
this.eventPhase = Event.AT_TARGET;
|
||||
this.bubbles = false;
|
||||
this.cancelable = false;
|
||||
this.isTrusted = false;
|
||||
this.defaultPrevented = false;
|
||||
this.timeStamp = Date.now();
|
||||
|
||||
// Initialize internal flags
|
||||
// XXX: Would it be better to inherit these defaults from the prototype?
|
||||
this._propagationStopped = false;
|
||||
this._immediatePropagationStopped = false;
|
||||
this._initialized = true;
|
||||
this._dispatching = false;
|
||||
|
||||
// Now initialize based on the constructor arguments (if any)
|
||||
if (type) this.type = type;
|
||||
if (dictionary) {
|
||||
for(var p in dictionary) {
|
||||
this[p] = dictionary[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Event.prototype = Object.create(Object.prototype, {
|
||||
constructor: { value: Event },
|
||||
stopPropagation: { value: function stopPropagation() {
|
||||
this._propagationStopped = true;
|
||||
}},
|
||||
|
||||
stopImmediatePropagation: { value: function stopImmediatePropagation() {
|
||||
this._propagationStopped = true;
|
||||
this._immediatePropagationStopped = true;
|
||||
}},
|
||||
|
||||
preventDefault: { value: function preventDefault() {
|
||||
if (this.cancelable) this.defaultPrevented = true;
|
||||
}},
|
||||
|
||||
initEvent: { value: function initEvent(type, bubbles, cancelable) {
|
||||
this._initialized = true;
|
||||
if (this._dispatching) return;
|
||||
|
||||
this._propagationStopped = false;
|
||||
this._immediatePropagationStopped = false;
|
||||
this.defaultPrevented = false;
|
||||
this.isTrusted = false;
|
||||
|
||||
this.target = null;
|
||||
this.type = type;
|
||||
this.bubbles = bubbles;
|
||||
this.cancelable = cancelable;
|
||||
}},
|
||||
|
||||
});
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
"use strict";
|
||||
var Event = require('./Event');
|
||||
var MouseEvent = require('./MouseEvent');
|
||||
var utils = require('./utils');
|
||||
|
||||
module.exports = EventTarget;
|
||||
|
||||
function EventTarget() {}
|
||||
|
||||
EventTarget.prototype = {
|
||||
// XXX
|
||||
// See WebIDL §4.8 for details on object event handlers
|
||||
// and how they should behave. We actually have to accept
|
||||
// any object to addEventListener... Can't type check it.
|
||||
// on registration.
|
||||
|
||||
// XXX:
|
||||
// Capturing event listeners are sort of rare. I think I can optimize
|
||||
// them so that dispatchEvent can skip the capturing phase (or much of
|
||||
// it). Each time a capturing listener is added, increment a flag on
|
||||
// the target node and each of its ancestors. Decrement when removed.
|
||||
// And update the counter when nodes are added and removed from the
|
||||
// tree as well. Then, in dispatch event, the capturing phase can
|
||||
// abort if it sees any node with a zero count.
|
||||
addEventListener: function addEventListener(type, listener, capture) {
|
||||
if (!listener) return;
|
||||
if (capture === undefined) capture = false;
|
||||
if (!this._listeners) this._listeners = Object.create(null);
|
||||
if (!this._listeners[type]) this._listeners[type] = [];
|
||||
var list = this._listeners[type];
|
||||
|
||||
// If this listener has already been registered, just return
|
||||
for(var i = 0, n = list.length; i < n; i++) {
|
||||
var l = list[i];
|
||||
if (l.listener === listener && l.capture === capture)
|
||||
return;
|
||||
}
|
||||
|
||||
// Add an object to the list of listeners
|
||||
var obj = { listener: listener, capture: capture };
|
||||
if (typeof listener === 'function') obj.f = listener;
|
||||
list.push(obj);
|
||||
},
|
||||
|
||||
removeEventListener: function removeEventListener(type,
|
||||
listener,
|
||||
capture) {
|
||||
if (capture === undefined) capture = false;
|
||||
if (this._listeners) {
|
||||
var list = this._listeners[type];
|
||||
if (list) {
|
||||
// Find the listener in the list and remove it
|
||||
for(var i = 0, n = list.length; i < n; i++) {
|
||||
var l = list[i];
|
||||
if (l.listener === listener && l.capture === capture) {
|
||||
if (list.length === 1) {
|
||||
this._listeners[type] = undefined;
|
||||
}
|
||||
else {
|
||||
list.splice(i, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// This is the public API for dispatching untrusted public events.
|
||||
// See _dispatchEvent for the implementation
|
||||
dispatchEvent: function dispatchEvent(event) {
|
||||
// Dispatch an untrusted event
|
||||
return this._dispatchEvent(event, false);
|
||||
},
|
||||
|
||||
//
|
||||
// See DOMCore §4.4
|
||||
// XXX: I'll probably need another version of this method for
|
||||
// internal use, one that does not set isTrusted to false.
|
||||
// XXX: see Document._dispatchEvent: perhaps that and this could
|
||||
// call a common internal function with different settings of
|
||||
// a trusted boolean argument
|
||||
//
|
||||
// XXX:
|
||||
// The spec has changed in how to deal with handlers registered
|
||||
// on idl or content attributes rather than with addEventListener.
|
||||
// Used to say that they always ran first. That's how webkit does it
|
||||
// Spec now says that they run in a position determined by
|
||||
// when they were first set. FF does it that way. See:
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-handlers
|
||||
//
|
||||
_dispatchEvent: function _dispatchEvent(event, trusted) {
|
||||
if (typeof trusted !== 'boolean') trusted = false;
|
||||
function invoke(target, event) {
|
||||
var type = event.type, phase = event.eventPhase;
|
||||
event.currentTarget = target;
|
||||
|
||||
// If there was an individual handler defined, invoke it first
|
||||
// XXX: see comment above: this shouldn't always be first.
|
||||
if (phase !== Event.CAPTURING_PHASE &&
|
||||
target._handlers && target._handlers[type])
|
||||
{
|
||||
var handler = target._handlers[type];
|
||||
var rv;
|
||||
if (typeof handler === 'function') {
|
||||
rv=handler.call(event.currentTarget, event);
|
||||
}
|
||||
else {
|
||||
var f = handler.handleEvent;
|
||||
if (typeof f !== 'function')
|
||||
throw new TypeError('handleEvent property of ' +
|
||||
'event handler object is' +
|
||||
'not a function.');
|
||||
rv=f.call(handler, event);
|
||||
}
|
||||
|
||||
switch(event.type) {
|
||||
case 'mouseover':
|
||||
if (rv === true) // Historical baggage
|
||||
event.preventDefault();
|
||||
break;
|
||||
case 'beforeunload':
|
||||
// XXX: eventually we need a special case here
|
||||
/* falls through */
|
||||
default:
|
||||
if (rv === false)
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now invoke list list of listeners for this target and type
|
||||
var list = target._listeners && target._listeners[type];
|
||||
if (!list) return;
|
||||
list = list.slice();
|
||||
for(var i = 0, n = list.length; i < n; i++) {
|
||||
if (event._immediatePropagationStopped) return;
|
||||
var l = list[i];
|
||||
if ((phase === Event.CAPTURING_PHASE && !l.capture) ||
|
||||
(phase === Event.BUBBLING_PHASE && l.capture))
|
||||
continue;
|
||||
if (l.f) {
|
||||
l.f.call(event.currentTarget, event);
|
||||
}
|
||||
else {
|
||||
var fn = l.listener.handleEvent;
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('handleEvent property of event listener object is not a function.');
|
||||
fn.call(l.listener, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!event._initialized || event._dispatching) utils.InvalidStateError();
|
||||
event.isTrusted = trusted;
|
||||
|
||||
// Begin dispatching the event now
|
||||
event._dispatching = true;
|
||||
event.target = this;
|
||||
|
||||
// Build the list of targets for the capturing and bubbling phases
|
||||
// XXX: we'll eventually have to add Window to this list.
|
||||
var ancestors = [];
|
||||
for(var n = this.parentNode; n; n = n.parentNode)
|
||||
ancestors.push(n);
|
||||
|
||||
// Capturing phase
|
||||
event.eventPhase = Event.CAPTURING_PHASE;
|
||||
for(var i = ancestors.length-1; i >= 0; i--) {
|
||||
invoke(ancestors[i], event);
|
||||
if (event._propagationStopped) break;
|
||||
}
|
||||
|
||||
// At target phase
|
||||
if (!event._propagationStopped) {
|
||||
event.eventPhase = Event.AT_TARGET;
|
||||
invoke(this, event);
|
||||
}
|
||||
|
||||
// Bubbling phase
|
||||
if (event.bubbles && !event._propagationStopped) {
|
||||
event.eventPhase = Event.BUBBLING_PHASE;
|
||||
for(var ii = 0, nn = ancestors.length; ii < nn; ii++) {
|
||||
invoke(ancestors[ii], event);
|
||||
if (event._propagationStopped) break;
|
||||
}
|
||||
}
|
||||
|
||||
event._dispatching = false;
|
||||
event.eventPhase = Event.AT_TARGET;
|
||||
event.currentTarget = null;
|
||||
|
||||
// Deal with mouse events and figure out when
|
||||
// a click has happened
|
||||
if (trusted && !event.defaultPrevented && event instanceof MouseEvent) {
|
||||
switch(event.type) {
|
||||
case 'mousedown':
|
||||
this._armed = {
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
t: event.timeStamp
|
||||
};
|
||||
break;
|
||||
case 'mouseout':
|
||||
case 'mouseover':
|
||||
this._armed = null;
|
||||
break;
|
||||
case 'mouseup':
|
||||
if (this._isClick(event)) this._doClick(event);
|
||||
this._armed = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return !event.defaultPrevented;
|
||||
},
|
||||
|
||||
// Determine whether a click occurred
|
||||
// XXX We don't support double clicks for now
|
||||
_isClick: function(event) {
|
||||
return (this._armed !== null &&
|
||||
event.type === 'mouseup' &&
|
||||
event.isTrusted &&
|
||||
event.button === 0 &&
|
||||
event.timeStamp - this._armed.t < 1000 &&
|
||||
Math.abs(event.clientX - this._armed.x) < 10 &&
|
||||
Math.abs(event.clientY - this._armed.Y) < 10);
|
||||
},
|
||||
|
||||
// Clicks are handled like this:
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content-0
|
||||
//
|
||||
// Note that this method is similar to the HTMLElement.click() method
|
||||
// The event argument must be the trusted mouseup event
|
||||
_doClick: function(event) {
|
||||
if (this._click_in_progress) return;
|
||||
this._click_in_progress = true;
|
||||
|
||||
// Find the nearest enclosing element that is activatable
|
||||
// An element is activatable if it has a
|
||||
// _post_click_activation_steps hook
|
||||
var activated = this;
|
||||
while(activated && !activated._post_click_activation_steps)
|
||||
activated = activated.parentNode;
|
||||
|
||||
if (activated && activated._pre_click_activation_steps) {
|
||||
activated._pre_click_activation_steps();
|
||||
}
|
||||
|
||||
var click = this.ownerDocument.createEvent('MouseEvent');
|
||||
click.initMouseEvent('click', true, true,
|
||||
this.ownerDocument.defaultView, 1,
|
||||
event.screenX, event.screenY,
|
||||
event.clientX, event.clientY,
|
||||
event.ctrlKey, event.altKey,
|
||||
event.shiftKey, event.metaKey,
|
||||
event.button, null);
|
||||
|
||||
var result = this._dispatchEvent(click, true);
|
||||
|
||||
if (activated) {
|
||||
if (result) {
|
||||
// This is where hyperlinks get followed, for example.
|
||||
if (activated._post_click_activation_steps)
|
||||
activated._post_click_activation_steps(click);
|
||||
}
|
||||
else {
|
||||
if (activated._cancelled_activation_steps)
|
||||
activated._cancelled_activation_steps();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// An event handler is like an event listener, but it registered
|
||||
// by setting an IDL or content attribute like onload or onclick.
|
||||
// There can only be one of these at a time for any event type.
|
||||
// This is an internal method for the attribute accessors and
|
||||
// content attribute handlers that need to register events handlers.
|
||||
// The type argument is the same as in addEventListener().
|
||||
// The handler argument is the same as listeners in addEventListener:
|
||||
// it can be a function or an object. Pass null to remove any existing
|
||||
// handler. Handlers are always invoked before any listeners of
|
||||
// the same type. They are not invoked during the capturing phase
|
||||
// of event dispatch.
|
||||
//
|
||||
_setEventHandler: function _setEventHandler(type, handler) {
|
||||
if (!this._handlers) this._handlers = Object.create(null);
|
||||
this._handlers[type] = handler;
|
||||
},
|
||||
|
||||
_getEventHandler: function _getEventHandler(type) {
|
||||
return (this._handlers && this._handlers[type]) || null;
|
||||
}
|
||||
|
||||
};
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
module.exports = FilteredElementList;
|
||||
|
||||
var Node = require('./Node');
|
||||
|
||||
//
|
||||
// This file defines node list implementation that lazily traverses
|
||||
// the document tree (or a subtree rooted at any element) and includes
|
||||
// only those elements for which a specified filter function returns true.
|
||||
// It is used to implement the
|
||||
// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods.
|
||||
//
|
||||
// XXX this should inherit from NodeList
|
||||
|
||||
function FilteredElementList(root, filter) {
|
||||
this.root = root;
|
||||
this.filter = filter;
|
||||
this.lastModTime = root.lastModTime;
|
||||
this.done = false;
|
||||
this.cache = [];
|
||||
this.traverse();
|
||||
}
|
||||
|
||||
FilteredElementList.prototype = Object.create(Object.prototype, {
|
||||
length: { get: function() {
|
||||
this.checkcache();
|
||||
if (!this.done) this.traverse();
|
||||
return this.cache.length;
|
||||
} },
|
||||
|
||||
item: { value: function(n) {
|
||||
this.checkcache();
|
||||
if (!this.done && n >= this.cache.length) {
|
||||
// This can lead to O(N^2) behavior if we stop when we get to n
|
||||
// and the caller is iterating through the items in order; so
|
||||
// be sure to do the full traverse here.
|
||||
this.traverse(/*n*/);
|
||||
}
|
||||
return this.cache[n];
|
||||
} },
|
||||
|
||||
checkcache: { value: function() {
|
||||
if (this.lastModTime !== this.root.lastModTime) {
|
||||
// subtree has changed, so invalidate cache
|
||||
for (var i = this.cache.length-1; i>=0; i--) {
|
||||
this[i] = undefined;
|
||||
}
|
||||
this.cache.length = 0;
|
||||
this.done = false;
|
||||
this.lastModTime = this.root.lastModTime;
|
||||
}
|
||||
} },
|
||||
|
||||
// If n is specified, then traverse the tree until we've found the nth
|
||||
// item (or until we've found all items). If n is not specified,
|
||||
// traverse until we've found all items.
|
||||
traverse: { value: function(n) {
|
||||
// increment n so we can compare to length, and so it is never falsy
|
||||
if (n !== undefined) n++;
|
||||
|
||||
var elt;
|
||||
while ((elt = this.next()) !== null) {
|
||||
this[this.cache.length] = elt; //XXX Use proxy instead
|
||||
this.cache.push(elt);
|
||||
if (n && this.cache.length === n) return;
|
||||
}
|
||||
|
||||
// no next element, so we've found everything
|
||||
this.done = true;
|
||||
} },
|
||||
|
||||
// Return the next element under root that matches filter
|
||||
next: { value: function() {
|
||||
var start = (this.cache.length === 0) ? this.root // Start at the root or at
|
||||
: this.cache[this.cache.length-1]; // the last element we found
|
||||
|
||||
var elt;
|
||||
if (start.nodeType === Node.DOCUMENT_NODE)
|
||||
elt = start.documentElement;
|
||||
else
|
||||
elt = start.nextElement(this.root);
|
||||
|
||||
while(elt) {
|
||||
if (this.filter(elt)) {
|
||||
return elt;
|
||||
}
|
||||
|
||||
elt = elt.nextElement(this.root);
|
||||
}
|
||||
return null;
|
||||
} },
|
||||
});
|
||||
+7254
File diff suppressed because it is too large.
Load diff
+37
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
module.exports = Leaf;
|
||||
|
||||
var Node = require('./Node');
|
||||
var NodeList = require('./NodeList');
|
||||
var utils = require('./utils');
|
||||
var HierarchyRequestError = utils.HierarchyRequestError;
|
||||
var NotFoundError = utils.NotFoundError;
|
||||
|
||||
// This class defines common functionality for node subtypes that
|
||||
// can never have children
|
||||
function Leaf() {
|
||||
Node.call(this);
|
||||
}
|
||||
|
||||
Leaf.prototype = Object.create(Node.prototype, {
|
||||
hasChildNodes: { value: function() { return false; }},
|
||||
firstChild: { value: null },
|
||||
lastChild: { value: null },
|
||||
insertBefore: { value: function(node, child) {
|
||||
if (!node.nodeType) throw new TypeError('not a node');
|
||||
HierarchyRequestError();
|
||||
}},
|
||||
replaceChild: { value: function(node, child) {
|
||||
if (!node.nodeType) throw new TypeError('not a node');
|
||||
HierarchyRequestError();
|
||||
}},
|
||||
removeChild: { value: function(node) {
|
||||
if (!node.nodeType) throw new TypeError('not a node');
|
||||
NotFoundError();
|
||||
}},
|
||||
removeChildren: { value: function() { /* no op */ }},
|
||||
childNodes: { get: function() {
|
||||
if (!this._childNodes) this._childNodes = new NodeList();
|
||||
return this._childNodes;
|
||||
}}
|
||||
});
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
var utils = require('./utils');
|
||||
|
||||
var LinkedList = module.exports = {
|
||||
// basic validity tests on a circular linked list a
|
||||
valid: function(a) {
|
||||
utils.assert(a, "list falsy");
|
||||
utils.assert(a._previousSibling, "previous falsy");
|
||||
utils.assert(a._nextSibling, "next falsy");
|
||||
// xxx check that list is actually circular
|
||||
return true;
|
||||
},
|
||||
// insert a before b
|
||||
insertBefore: function(a, b) {
|
||||
utils.assert(LinkedList.valid(a) && LinkedList.valid(b));
|
||||
var a_first = a, a_last = a._previousSibling;
|
||||
var b_first = b, b_last = b._previousSibling;
|
||||
a_first._previousSibling = b_last;
|
||||
a_last._nextSibling = b_first;
|
||||
b_last._nextSibling = a_first;
|
||||
b_first._previousSibling = a_last;
|
||||
utils.assert(LinkedList.valid(a) && LinkedList.valid(b));
|
||||
},
|
||||
// replace a single node a with a list b (which could be null)
|
||||
replace: function(a, b) {
|
||||
utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b)));
|
||||
if (b!==null) {
|
||||
LinkedList.insertBefore(b, a);
|
||||
}
|
||||
LinkedList.remove(a);
|
||||
utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b)));
|
||||
},
|
||||
// remove single node a from its list
|
||||
remove: function(a) {
|
||||
utils.assert(LinkedList.valid(a));
|
||||
var prev = a._previousSibling;
|
||||
if (prev === a) { return; }
|
||||
var next = a._nextSibling;
|
||||
prev._nextSibling = next;
|
||||
next._previousSibling = prev;
|
||||
a._previousSibling = a._nextSibling = a;
|
||||
utils.assert(LinkedList.valid(a));
|
||||
}
|
||||
};
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var URL = require('./URL');
|
||||
var URLUtils = require('./URLUtils');
|
||||
|
||||
module.exports = Location;
|
||||
|
||||
function Location(window, href) {
|
||||
this._window = window;
|
||||
this._href = href;
|
||||
}
|
||||
|
||||
Location.prototype = Object.create(URLUtils.prototype, {
|
||||
constructor: { value: Location },
|
||||
|
||||
// Special behavior when href is set
|
||||
href: {
|
||||
get: function() { return this._href; },
|
||||
set: function(v) { this.assign(v); }
|
||||
},
|
||||
|
||||
assign: { value: function(url) {
|
||||
// Resolve the new url against the current one
|
||||
// XXX:
|
||||
// This is not actually correct. It should be resolved against
|
||||
// the URL of the document of the script. For now, though, I only
|
||||
// support a single window and there is only one base url.
|
||||
// So this is good enough for now.
|
||||
var current = new URL(this._href);
|
||||
var newurl = current.resolve(url);
|
||||
|
||||
// Save the new url
|
||||
this._href = newurl;
|
||||
|
||||
// Start loading the new document!
|
||||
// XXX
|
||||
// This is just something hacked together.
|
||||
// The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate
|
||||
}},
|
||||
|
||||
replace: { value: function(url) {
|
||||
// XXX
|
||||
// Since we aren't tracking history yet, replace is the same as assign
|
||||
this.assign(url);
|
||||
}},
|
||||
|
||||
reload: { value: function() {
|
||||
// XXX:
|
||||
// Actually, the spec is a lot more complicated than this
|
||||
this.assign(this.href);
|
||||
}},
|
||||
|
||||
toString: { value: function() {
|
||||
return this.href;
|
||||
}}
|
||||
|
||||
});
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
var UIEvent = require('./UIEvent');
|
||||
|
||||
module.exports = MouseEvent;
|
||||
|
||||
function MouseEvent() {
|
||||
// Just use the superclass constructor to initialize
|
||||
UIEvent.call(this);
|
||||
|
||||
this.screenX = this.screenY = this.clientX = this.clientY = 0;
|
||||
this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false;
|
||||
this.button = 0;
|
||||
this.buttons = 1;
|
||||
this.relatedTarget = null;
|
||||
}
|
||||
MouseEvent.prototype = Object.create(UIEvent.prototype, {
|
||||
constructor: { value: MouseEvent },
|
||||
initMouseEvent: { value: function(type, bubbles, cancelable,
|
||||
view, detail,
|
||||
screenX, screenY, clientX, clientY,
|
||||
ctrlKey, altKey, shiftKey, metaKey,
|
||||
button, relatedTarget) {
|
||||
|
||||
this.initEvent(type, bubbles, cancelable, view, detail);
|
||||
this.screenX = screenX;
|
||||
this.screenY = screenY;
|
||||
this.clientX = clientX;
|
||||
this.clientY = clientY;
|
||||
this.ctrlKey = ctrlKey;
|
||||
this.altKey = altKey;
|
||||
this.shiftKey = shiftKey;
|
||||
this.metaKey = metaKey;
|
||||
this.button = button;
|
||||
switch(button) {
|
||||
case 0: this.buttons = 1; break;
|
||||
case 1: this.buttons = 4; break;
|
||||
case 2: this.buttons = 2; break;
|
||||
default: this.buttons = 0; break;
|
||||
}
|
||||
this.relatedTarget = relatedTarget;
|
||||
}},
|
||||
|
||||
getModifierState: { value: function(key) {
|
||||
switch(key) {
|
||||
case "Alt": return this.altKey;
|
||||
case "Control": return this.ctrlKey;
|
||||
case "Shift": return this.shiftKey;
|
||||
case "Meta": return this.metaKey;
|
||||
default: return false;
|
||||
}
|
||||
}}
|
||||
});
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
VALUE: 1, // The value of a Text, Comment or PI node changed
|
||||
ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed
|
||||
REMOVE_ATTR: 3, // An attribute was removed
|
||||
REMOVE: 4, // A node was removed
|
||||
MOVE: 5, // A node was moved
|
||||
INSERT: 6 // A node (or a subtree of nodes) was inserted
|
||||
};
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
module.exports = NamedNodeMap;
|
||||
|
||||
var utils = require('./utils');
|
||||
|
||||
/* This is a hacky implementation of NamedNodeMap, intended primarily to
|
||||
* satisfy clients (like dompurify and the web-platform-tests) which check
|
||||
* to ensure that Node#attributes instanceof NamedNodeMap. */
|
||||
|
||||
function NamedNodeMap(element) {
|
||||
this.element = element;
|
||||
}
|
||||
Object.defineProperties(NamedNodeMap.prototype, {
|
||||
length: { get: utils.shouldOverride },
|
||||
item: { value: utils.shouldOverride },
|
||||
|
||||
getNamedItem: { value: function getNamedItem(qualifiedName) {
|
||||
return this.element.getAttributeNode(qualifiedName);
|
||||
} },
|
||||
getNamedItemNS: { value: function getNamedItemNS(namespace, localName) {
|
||||
return this.element.getAttributeNodeNS(namespace, localName);
|
||||
} },
|
||||
setNamedItem: { value: utils.nyi },
|
||||
setNamedItemNS: { value: utils.nyi },
|
||||
removeNamedItem: { value: function removeNamedItem(qualifiedName) {
|
||||
var attr = this.element.getAttributeNode(qualifiedName);
|
||||
if (attr) {
|
||||
this.element.removeAttribute(qualifiedName);
|
||||
return attr;
|
||||
}
|
||||
utils.NotFoundError();
|
||||
} },
|
||||
removeNamedItemNS: { value: function removeNamedItemNS(ns, lname) {
|
||||
var attr = this.element.getAttributeNodeNS(ns, lname);
|
||||
if (attr) {
|
||||
this.element.removeAttributeNS(ns, lname);
|
||||
return attr;
|
||||
}
|
||||
utils.NotFoundError();
|
||||
} },
|
||||
});
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid
|
||||
var NavigatorID = Object.create(null, {
|
||||
appCodeName: { value: "Mozilla" },
|
||||
appName: { value: "Netscape" },
|
||||
appVersion: { value: "4.0" },
|
||||
platform: { value: "" },
|
||||
product: { value: "Gecko" },
|
||||
productSub: { value: "20100101" },
|
||||
userAgent: { value: "" },
|
||||
vendor: { value: "" },
|
||||
vendorSub: { value: "" },
|
||||
taintEnabled: { value: function() { return false; } }
|
||||
});
|
||||
|
||||
module.exports = NavigatorID;
|
||||
+764
@@ -0,0 +1,764 @@
|
||||
"use strict";
|
||||
module.exports = Node;
|
||||
|
||||
var EventTarget = require('./EventTarget');
|
||||
var LinkedList = require('./LinkedList');
|
||||
var NodeUtils = require('./NodeUtils');
|
||||
var utils = require('./utils');
|
||||
|
||||
// All nodes have a nodeType and an ownerDocument.
|
||||
// Once inserted, they also have a parentNode.
|
||||
// This is an abstract class; all nodes in a document are instances
|
||||
// of a subtype, so all the properties are defined by more specific
|
||||
// constructors.
|
||||
function Node() {
|
||||
EventTarget.call(this);
|
||||
this.parentNode = null;
|
||||
this._nextSibling = this._previousSibling = this;
|
||||
this._index = undefined;
|
||||
}
|
||||
|
||||
var ELEMENT_NODE = Node.ELEMENT_NODE = 1;
|
||||
var ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2;
|
||||
var TEXT_NODE = Node.TEXT_NODE = 3;
|
||||
var CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4;
|
||||
var ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5;
|
||||
var ENTITY_NODE = Node.ENTITY_NODE = 6;
|
||||
var PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7;
|
||||
var COMMENT_NODE = Node.COMMENT_NODE = 8;
|
||||
var DOCUMENT_NODE = Node.DOCUMENT_NODE = 9;
|
||||
var DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10;
|
||||
var DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11;
|
||||
var NOTATION_NODE = Node.NOTATION_NODE = 12;
|
||||
|
||||
var DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 0x01;
|
||||
var DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 0x02;
|
||||
var DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 0x04;
|
||||
var DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 0x08;
|
||||
var DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10;
|
||||
var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
|
||||
|
||||
Node.prototype = Object.create(EventTarget.prototype, {
|
||||
|
||||
// Node that are not inserted into the tree inherit a null parent
|
||||
|
||||
// XXX: the baseURI attribute is defined by dom core, but
|
||||
// a correct implementation of it requires HTML features, so
|
||||
// we'll come back to this later.
|
||||
baseURI: { get: utils.nyi },
|
||||
|
||||
parentElement: { get: function() {
|
||||
return (this.parentNode && this.parentNode.nodeType===ELEMENT_NODE) ? this.parentNode : null;
|
||||
}},
|
||||
|
||||
hasChildNodes: { value: utils.shouldOverride },
|
||||
|
||||
firstChild: { get: utils.shouldOverride },
|
||||
|
||||
lastChild: { get: utils.shouldOverride },
|
||||
|
||||
isConnected: {
|
||||
get: function () {
|
||||
let node = this;
|
||||
while (node != null) {
|
||||
if (node.nodeType === Node.DOCUMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
if (node != null && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||||
node = node.host;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
|
||||
previousSibling: { get: function() {
|
||||
var parent = this.parentNode;
|
||||
if (!parent) return null;
|
||||
if (this === parent.firstChild) return null;
|
||||
return this._previousSibling;
|
||||
}},
|
||||
|
||||
nextSibling: { get: function() {
|
||||
var parent = this.parentNode, next = this._nextSibling;
|
||||
if (!parent) return null;
|
||||
if (next === parent.firstChild) return null;
|
||||
return next;
|
||||
}},
|
||||
|
||||
textContent: {
|
||||
// Should override for DocumentFragment/Element/Attr/Text/PI/Comment
|
||||
get: function() { return null; },
|
||||
set: function(v) { /* do nothing */ },
|
||||
},
|
||||
|
||||
innerText: {
|
||||
// Should override for DocumentFragment/Element/Attr/Text/PI/Comment
|
||||
get: function() { return null; },
|
||||
set: function(v) { /* do nothing */ },
|
||||
},
|
||||
|
||||
_countChildrenOfType: { value: function(type) {
|
||||
var sum = 0;
|
||||
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === type) sum++;
|
||||
}
|
||||
return sum;
|
||||
}},
|
||||
|
||||
_ensureInsertValid: { value: function _ensureInsertValid(node, child, isPreinsert) {
|
||||
var parent = this, i, kid;
|
||||
if (!node.nodeType) throw new TypeError('not a node');
|
||||
// 1. If parent is not a Document, DocumentFragment, or Element
|
||||
// node, throw a HierarchyRequestError.
|
||||
switch (parent.nodeType) {
|
||||
case DOCUMENT_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
case ELEMENT_NODE:
|
||||
break;
|
||||
default: utils.HierarchyRequestError();
|
||||
}
|
||||
// 2. If node is a host-including inclusive ancestor of parent,
|
||||
// throw a HierarchyRequestError.
|
||||
if (node.isAncestor(parent)) utils.HierarchyRequestError();
|
||||
// 3. If child is not null and its parent is not parent, then
|
||||
// throw a NotFoundError. (replaceChild omits the 'child is not null'
|
||||
// and throws a TypeError here if child is null.)
|
||||
if (child !== null || !isPreinsert) {
|
||||
if (child.parentNode !== parent) utils.NotFoundError();
|
||||
}
|
||||
// 4. If node is not a DocumentFragment, DocumentType, Element,
|
||||
// Text, ProcessingInstruction, or Comment node, throw a
|
||||
// HierarchyRequestError.
|
||||
switch (node.nodeType) {
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
case DOCUMENT_TYPE_NODE:
|
||||
case ELEMENT_NODE:
|
||||
case TEXT_NODE:
|
||||
case PROCESSING_INSTRUCTION_NODE:
|
||||
case COMMENT_NODE:
|
||||
break;
|
||||
default: utils.HierarchyRequestError();
|
||||
}
|
||||
// 5. If either node is a Text node and parent is a document, or
|
||||
// node is a doctype and parent is not a document, throw a
|
||||
// HierarchyRequestError.
|
||||
// 6. If parent is a document, and any of the statements below, switched
|
||||
// on node, are true, throw a HierarchyRequestError.
|
||||
if (parent.nodeType === DOCUMENT_NODE) {
|
||||
switch (node.nodeType) {
|
||||
case TEXT_NODE:
|
||||
utils.HierarchyRequestError();
|
||||
break;
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
// 6a1. If node has more than one element child or has a Text
|
||||
// node child.
|
||||
if (node._countChildrenOfType(TEXT_NODE) > 0)
|
||||
utils.HierarchyRequestError();
|
||||
switch (node._countChildrenOfType(ELEMENT_NODE)) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
// 6a2. Otherwise, if node has one element child and either
|
||||
// parent has an element child, child is a doctype, or child
|
||||
// is not null and a doctype is following child. [preinsert]
|
||||
// 6a2. Otherwise, if node has one element child and either
|
||||
// parent has an element child that is not child or a
|
||||
// doctype is following child. [replaceWith]
|
||||
if (child !== null /* always true here for replaceWith */) {
|
||||
if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)
|
||||
utils.HierarchyRequestError();
|
||||
for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === DOCUMENT_TYPE_NODE)
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
}
|
||||
i = parent._countChildrenOfType(ELEMENT_NODE);
|
||||
if (isPreinsert) {
|
||||
// "parent has an element child"
|
||||
if (i > 0)
|
||||
utils.HierarchyRequestError();
|
||||
} else {
|
||||
// "parent has an element child that is not child"
|
||||
if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE))
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
break;
|
||||
default: // 6a1, continued. (more than one Element child)
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
break;
|
||||
case ELEMENT_NODE:
|
||||
// 6b. parent has an element child, child is a doctype, or
|
||||
// child is not null and a doctype is following child. [preinsert]
|
||||
// 6b. parent has an element child that is not child or a
|
||||
// doctype is following child. [replaceWith]
|
||||
if (child !== null /* always true here for replaceWith */) {
|
||||
if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)
|
||||
utils.HierarchyRequestError();
|
||||
for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === DOCUMENT_TYPE_NODE)
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
}
|
||||
i = parent._countChildrenOfType(ELEMENT_NODE);
|
||||
if (isPreinsert) {
|
||||
// "parent has an element child"
|
||||
if (i > 0)
|
||||
utils.HierarchyRequestError();
|
||||
} else {
|
||||
// "parent has an element child that is not child"
|
||||
if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE))
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
break;
|
||||
case DOCUMENT_TYPE_NODE:
|
||||
// 6c. parent has a doctype child, child is non-null and an
|
||||
// element is preceding child, or child is null and parent has
|
||||
// an element child. [preinsert]
|
||||
// 6c. parent has a doctype child that is not child, or an
|
||||
// element is preceding child. [replaceWith]
|
||||
if (child === null) {
|
||||
if (parent._countChildrenOfType(ELEMENT_NODE))
|
||||
utils.HierarchyRequestError();
|
||||
} else {
|
||||
// child is always non-null for [replaceWith] case
|
||||
for (kid = parent.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid === child) break;
|
||||
if (kid.nodeType === ELEMENT_NODE)
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
}
|
||||
i = parent._countChildrenOfType(DOCUMENT_TYPE_NODE);
|
||||
if (isPreinsert) {
|
||||
// "parent has an doctype child"
|
||||
if (i > 0)
|
||||
utils.HierarchyRequestError();
|
||||
} else {
|
||||
// "parent has an doctype child that is not child"
|
||||
if (i > 1 || (i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE))
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// 5, continued: (parent is not a document)
|
||||
if (node.nodeType === DOCUMENT_TYPE_NODE) utils.HierarchyRequestError();
|
||||
}
|
||||
}},
|
||||
|
||||
insertBefore: { value: function insertBefore(node, child) {
|
||||
var parent = this;
|
||||
// 1. Ensure pre-insertion validity
|
||||
parent._ensureInsertValid(node, child, true);
|
||||
// 2. Let reference child be child.
|
||||
var refChild = child;
|
||||
// 3. If reference child is node, set it to node's next sibling
|
||||
if (refChild === node) { refChild = node.nextSibling; }
|
||||
// 4. Adopt node into parent's node document.
|
||||
parent.doc.adoptNode(node);
|
||||
// 5. Insert node into parent before reference child.
|
||||
node._insertOrReplace(parent, refChild, false);
|
||||
// 6. Return node
|
||||
return node;
|
||||
}},
|
||||
|
||||
|
||||
appendChild: { value: function(child) {
|
||||
// This invokes _appendChild after doing validity checks.
|
||||
return this.insertBefore(child, null);
|
||||
}},
|
||||
|
||||
_appendChild: { value: function(child) {
|
||||
child._insertOrReplace(this, null, false);
|
||||
}},
|
||||
|
||||
removeChild: { value: function removeChild(child) {
|
||||
var parent = this;
|
||||
if (!child.nodeType) throw new TypeError('not a node');
|
||||
if (child.parentNode !== parent) utils.NotFoundError();
|
||||
child.remove();
|
||||
return child;
|
||||
}},
|
||||
|
||||
// To replace a `child` with `node` within a `parent` (this)
|
||||
replaceChild: { value: function replaceChild(node, child) {
|
||||
var parent = this;
|
||||
// Ensure validity (slight differences from pre-insertion check)
|
||||
parent._ensureInsertValid(node, child, false);
|
||||
// Adopt node into parent's node document.
|
||||
if (node.doc !== parent.doc) {
|
||||
// XXX adoptNode has side-effect of removing node from its parent
|
||||
// and generating a mutation event, thus causing the _insertOrReplace
|
||||
// to generate two deletes and an insert instead of a 'move'
|
||||
// event. It looks like the new MutationObserver stuff avoids
|
||||
// this problem, but for now let's only adopt (ie, remove `node`
|
||||
// from its parent) here if we need to.
|
||||
parent.doc.adoptNode(node);
|
||||
}
|
||||
// Do the replace.
|
||||
node._insertOrReplace(parent, child, true);
|
||||
return child;
|
||||
}},
|
||||
|
||||
// See: http://ejohn.org/blog/comparing-document-position/
|
||||
contains: { value: function contains(node) {
|
||||
if (node === null) { return false; }
|
||||
if (this === node) { return true; /* inclusive descendant */ }
|
||||
/* jshint bitwise: false */
|
||||
return (this.compareDocumentPosition(node) &
|
||||
DOCUMENT_POSITION_CONTAINED_BY) !== 0;
|
||||
}},
|
||||
|
||||
compareDocumentPosition: { value: function compareDocumentPosition(that){
|
||||
// Basic algorithm for finding the relative position of two nodes.
|
||||
// Make a list the ancestors of each node, starting with the
|
||||
// document element and proceeding down to the nodes themselves.
|
||||
// Then, loop through the lists, looking for the first element
|
||||
// that differs. The order of those two elements give the
|
||||
// order of their descendant nodes. Or, if one list is a prefix
|
||||
// of the other one, then that node contains the other.
|
||||
|
||||
if (this === that) return 0;
|
||||
|
||||
// If they're not owned by the same document or if one is rooted
|
||||
// and one is not, then they're disconnected.
|
||||
if (this.doc !== that.doc ||
|
||||
this.rooted !== that.rooted)
|
||||
return (DOCUMENT_POSITION_DISCONNECTED +
|
||||
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);
|
||||
|
||||
// Get arrays of ancestors for this and that
|
||||
var these = [], those = [];
|
||||
for(var n = this; n !== null; n = n.parentNode) these.push(n);
|
||||
for(n = that; n !== null; n = n.parentNode) those.push(n);
|
||||
these.reverse(); // So we start with the outermost
|
||||
those.reverse();
|
||||
|
||||
if (these[0] !== those[0]) // No common ancestor
|
||||
return (DOCUMENT_POSITION_DISCONNECTED +
|
||||
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);
|
||||
|
||||
n = Math.min(these.length, those.length);
|
||||
for(var i = 1; i < n; i++) {
|
||||
if (these[i] !== those[i]) {
|
||||
// We found two different ancestors, so compare
|
||||
// their positions
|
||||
if (these[i].index < those[i].index)
|
||||
return DOCUMENT_POSITION_FOLLOWING;
|
||||
else
|
||||
return DOCUMENT_POSITION_PRECEDING;
|
||||
}
|
||||
}
|
||||
|
||||
// If we get to here, then one of the nodes (the one with the
|
||||
// shorter list of ancestors) contains the other one.
|
||||
if (these.length < those.length)
|
||||
return (DOCUMENT_POSITION_FOLLOWING +
|
||||
DOCUMENT_POSITION_CONTAINED_BY);
|
||||
else
|
||||
return (DOCUMENT_POSITION_PRECEDING +
|
||||
DOCUMENT_POSITION_CONTAINS);
|
||||
}},
|
||||
|
||||
isSameNode: {value : function isSameNode(node) {
|
||||
return this === node;
|
||||
}},
|
||||
|
||||
|
||||
// This method implements the generic parts of node equality testing
|
||||
// and defers to the (non-recursive) type-specific isEqual() method
|
||||
// defined by subclasses
|
||||
isEqualNode: { value: function isEqualNode(node) {
|
||||
if (!node) return false;
|
||||
if (node.nodeType !== this.nodeType) return false;
|
||||
|
||||
// Check type-specific properties for equality
|
||||
if (!this.isEqual(node)) return false;
|
||||
|
||||
// Now check children for number and equality
|
||||
for (var c1 = this.firstChild, c2 = node.firstChild;
|
||||
c1 && c2;
|
||||
c1 = c1.nextSibling, c2 = c2.nextSibling) {
|
||||
if (!c1.isEqualNode(c2)) return false;
|
||||
}
|
||||
return c1 === null && c2 === null;
|
||||
}},
|
||||
|
||||
// This method delegates shallow cloning to a clone() method
|
||||
// that each concrete subclass must implement
|
||||
cloneNode: { value: function(deep) {
|
||||
// Clone this node
|
||||
var clone = this.clone();
|
||||
|
||||
// Handle the recursive case if necessary
|
||||
if (deep) {
|
||||
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
clone._appendChild(kid.cloneNode(true));
|
||||
}
|
||||
}
|
||||
|
||||
return clone;
|
||||
}},
|
||||
|
||||
lookupPrefix: { value: function lookupPrefix(ns) {
|
||||
var e;
|
||||
if (ns === '' || ns === null || ns === undefined) return null;
|
||||
switch(this.nodeType) {
|
||||
case ELEMENT_NODE:
|
||||
return this._lookupNamespacePrefix(ns, this);
|
||||
case DOCUMENT_NODE:
|
||||
e = this.documentElement;
|
||||
return e ? e.lookupPrefix(ns) : null;
|
||||
case ENTITY_NODE:
|
||||
case NOTATION_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
case DOCUMENT_TYPE_NODE:
|
||||
return null;
|
||||
case ATTRIBUTE_NODE:
|
||||
e = this.ownerElement;
|
||||
return e ? e.lookupPrefix(ns) : null;
|
||||
default:
|
||||
e = this.parentElement;
|
||||
return e ? e.lookupPrefix(ns) : null;
|
||||
}
|
||||
}},
|
||||
|
||||
|
||||
lookupNamespaceURI: {value: function lookupNamespaceURI(prefix) {
|
||||
if (prefix === '' || prefix === undefined) { prefix = null; }
|
||||
var e;
|
||||
switch(this.nodeType) {
|
||||
case ELEMENT_NODE:
|
||||
return utils.shouldOverride();
|
||||
case DOCUMENT_NODE:
|
||||
e = this.documentElement;
|
||||
return e ? e.lookupNamespaceURI(prefix) : null;
|
||||
case ENTITY_NODE:
|
||||
case NOTATION_NODE:
|
||||
case DOCUMENT_TYPE_NODE:
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
return null;
|
||||
case ATTRIBUTE_NODE:
|
||||
e = this.ownerElement;
|
||||
return e ? e.lookupNamespaceURI(prefix) : null;
|
||||
default:
|
||||
e = this.parentElement;
|
||||
return e ? e.lookupNamespaceURI(prefix) : null;
|
||||
}
|
||||
}},
|
||||
|
||||
isDefaultNamespace: { value: function isDefaultNamespace(ns) {
|
||||
if (ns === '' || ns === undefined) { ns = null; }
|
||||
var defaultNamespace = this.lookupNamespaceURI(null);
|
||||
return (defaultNamespace === ns);
|
||||
}},
|
||||
|
||||
// Utility methods for nodes. Not part of the DOM
|
||||
|
||||
// Return the index of this node in its parent.
|
||||
// Throw if no parent, or if this node is not a child of its parent
|
||||
index: { get: function() {
|
||||
var parent = this.parentNode;
|
||||
if (this === parent.firstChild) return 0; // fast case
|
||||
var kids = parent.childNodes;
|
||||
if (this._index === undefined || kids[this._index] !== this) {
|
||||
// Ensure that we don't have an O(N^2) blowup if none of the
|
||||
// kids have defined indices yet and we're traversing via
|
||||
// nextSibling or previousSibling
|
||||
for (var i=0; i<kids.length; i++) {
|
||||
kids[i]._index = i;
|
||||
}
|
||||
utils.assert(kids[this._index] === this);
|
||||
}
|
||||
return this._index;
|
||||
}},
|
||||
|
||||
// Return true if this node is equal to or is an ancestor of that node
|
||||
// Note that nodes are considered to be ancestors of themselves
|
||||
isAncestor: { value: function(that) {
|
||||
// If they belong to different documents, then they're unrelated.
|
||||
if (this.doc !== that.doc) return false;
|
||||
// If one is rooted and one isn't then they're not related
|
||||
if (this.rooted !== that.rooted) return false;
|
||||
|
||||
// Otherwise check by traversing the parentNode chain
|
||||
for(var e = that; e; e = e.parentNode) {
|
||||
if (e === this) return true;
|
||||
}
|
||||
return false;
|
||||
}},
|
||||
|
||||
// DOMINO Changed the behavior to conform with the specs. See:
|
||||
// https://groups.google.com/d/topic/mozilla.dev.platform/77sIYcpdDmc/discussion
|
||||
ensureSameDoc: { value: function(that) {
|
||||
if (that.ownerDocument === null) {
|
||||
that.ownerDocument = this.doc;
|
||||
}
|
||||
else if(that.ownerDocument !== this.doc) {
|
||||
utils.WrongDocumentError();
|
||||
}
|
||||
}},
|
||||
|
||||
removeChildren: { value: utils.shouldOverride },
|
||||
|
||||
// Insert this node as a child of parent before the specified child,
|
||||
// or insert as the last child of parent if specified child is null,
|
||||
// or replace the specified child with this node, firing mutation events as
|
||||
// necessary
|
||||
_insertOrReplace: { value: function _insertOrReplace(parent, before, isReplace) {
|
||||
var child = this, before_index, i;
|
||||
|
||||
if (child.nodeType === DOCUMENT_FRAGMENT_NODE && child.rooted) {
|
||||
utils.HierarchyRequestError();
|
||||
}
|
||||
|
||||
/* Ensure index of `before` is cached before we (possibly) remove it. */
|
||||
if (parent._childNodes) {
|
||||
before_index = (before === null) ? parent._childNodes.length :
|
||||
before.index; /* ensure _index is cached */
|
||||
|
||||
// If we are already a child of the specified parent, then
|
||||
// the index may have to be adjusted.
|
||||
if (child.parentNode === parent) {
|
||||
var child_index = child.index;
|
||||
// If the child is before the spot it is to be inserted at,
|
||||
// then when it is removed, the index of that spot will be
|
||||
// reduced.
|
||||
if (child_index < before_index) {
|
||||
before_index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the old child
|
||||
if (isReplace) {
|
||||
if (before.rooted) before.doc.mutateRemove(before);
|
||||
before.parentNode = null;
|
||||
}
|
||||
|
||||
var n = before;
|
||||
if (n === null) { n = parent.firstChild; }
|
||||
|
||||
// If both the child and the parent are rooted, then we want to
|
||||
// transplant the child without uprooting and rerooting it.
|
||||
var bothRooted = child.rooted && parent.rooted;
|
||||
if (child.nodeType === DOCUMENT_FRAGMENT_NODE) {
|
||||
var spliceArgs = [0, isReplace ? 1 : 0], next;
|
||||
for (var kid = child.firstChild; kid !== null; kid = next) {
|
||||
next = kid.nextSibling;
|
||||
spliceArgs.push(kid);
|
||||
kid.parentNode = parent;
|
||||
}
|
||||
var len = spliceArgs.length;
|
||||
// Add all nodes to the new parent, overwriting the old child
|
||||
if (isReplace) {
|
||||
LinkedList.replace(n, len > 2 ? spliceArgs[2] : null);
|
||||
} else if (len > 2 && n !== null) {
|
||||
LinkedList.insertBefore(spliceArgs[2], n);
|
||||
}
|
||||
if (parent._childNodes) {
|
||||
spliceArgs[0] = (before === null) ?
|
||||
parent._childNodes.length : before._index;
|
||||
parent._childNodes.splice.apply(parent._childNodes, spliceArgs);
|
||||
for (i=2; i<len; i++) {
|
||||
spliceArgs[i]._index = spliceArgs[0] + (i - 2);
|
||||
}
|
||||
} else if (parent._firstChild === before) {
|
||||
if (len > 2) {
|
||||
parent._firstChild = spliceArgs[2];
|
||||
} else if (isReplace) {
|
||||
parent._firstChild = null;
|
||||
}
|
||||
}
|
||||
// Remove all nodes from the document fragment
|
||||
if (child._childNodes) {
|
||||
child._childNodes.length = 0;
|
||||
} else {
|
||||
child._firstChild = null;
|
||||
}
|
||||
// Call the mutation handlers
|
||||
// Use spliceArgs since the original array has been destroyed. The
|
||||
// liveness guarantee requires us to clone the array so that
|
||||
// references to the childNodes of the DocumentFragment will be empty
|
||||
// when the insertion handlers are called.
|
||||
if (parent.rooted) {
|
||||
parent.modify();
|
||||
for (i = 2; i < len; i++) {
|
||||
parent.doc.mutateInsert(spliceArgs[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (before === child) { return; }
|
||||
if (bothRooted) {
|
||||
// Remove the child from its current position in the tree
|
||||
// without calling remove(), since we don't want to uproot it.
|
||||
child._remove();
|
||||
} else if (child.parentNode) {
|
||||
child.remove();
|
||||
}
|
||||
|
||||
// Insert it as a child of its new parent
|
||||
child.parentNode = parent;
|
||||
if (isReplace) {
|
||||
LinkedList.replace(n, child);
|
||||
if (parent._childNodes) {
|
||||
child._index = before_index;
|
||||
parent._childNodes[before_index] = child;
|
||||
} else if (parent._firstChild === before) {
|
||||
parent._firstChild = child;
|
||||
}
|
||||
} else {
|
||||
if (n !== null) {
|
||||
LinkedList.insertBefore(child, n);
|
||||
}
|
||||
if (parent._childNodes) {
|
||||
child._index = before_index;
|
||||
parent._childNodes.splice(before_index, 0, child);
|
||||
} else if (parent._firstChild === before) {
|
||||
parent._firstChild = child;
|
||||
}
|
||||
}
|
||||
if (bothRooted) {
|
||||
parent.modify();
|
||||
// Generate a move mutation event
|
||||
parent.doc.mutateMove(child);
|
||||
} else if (parent.rooted) {
|
||||
parent.modify();
|
||||
parent.doc.mutateInsert(child);
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
||||
|
||||
// Return the lastModTime value for this node. (For use as a
|
||||
// cache invalidation mechanism. If the node does not already
|
||||
// have one, initialize it from the owner document's modclock
|
||||
// property. (Note that modclock does not return the actual
|
||||
// time; it is simply a counter incremented on each document
|
||||
// modification)
|
||||
lastModTime: { get: function() {
|
||||
if (!this._lastModTime) {
|
||||
this._lastModTime = this.doc.modclock;
|
||||
}
|
||||
return this._lastModTime;
|
||||
}},
|
||||
|
||||
// Increment the owner document's modclock and use the new
|
||||
// value to update the lastModTime value for this node and
|
||||
// all of its ancestors. Nodes that have never had their
|
||||
// lastModTime value queried do not need to have a
|
||||
// lastModTime property set on them since there is no
|
||||
// previously queried value to ever compare the new value
|
||||
// against, so only update nodes that already have a
|
||||
// _lastModTime property.
|
||||
modify: { value: function() {
|
||||
if (this.doc.modclock) { // Skip while doc.modclock == 0
|
||||
var time = ++this.doc.modclock;
|
||||
for(var n = this; n; n = n.parentElement) {
|
||||
if (n._lastModTime) {
|
||||
n._lastModTime = time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
||||
// This attribute is not part of the DOM but is quite helpful.
|
||||
// It returns the document with which a node is associated. Usually
|
||||
// this is the ownerDocument. But ownerDocument is null for the
|
||||
// document object itself, so this is a handy way to get the document
|
||||
// regardless of the node type
|
||||
doc: { get: function() {
|
||||
return this.ownerDocument || this;
|
||||
}},
|
||||
|
||||
|
||||
// If the node has a nid (node id), then it is rooted in a document
|
||||
rooted: { get: function() {
|
||||
return !!this._nid;
|
||||
}},
|
||||
|
||||
normalize: { value: function() {
|
||||
var next;
|
||||
for (var child=this.firstChild; child !== null; child=next) {
|
||||
next = child.nextSibling;
|
||||
|
||||
if (child.normalize) {
|
||||
child.normalize();
|
||||
}
|
||||
|
||||
if (child.nodeType !== Node.TEXT_NODE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.nodeValue === "") {
|
||||
this.removeChild(child);
|
||||
continue;
|
||||
}
|
||||
|
||||
var prevChild = child.previousSibling;
|
||||
if (prevChild === null) {
|
||||
continue;
|
||||
} else if (prevChild.nodeType === Node.TEXT_NODE) {
|
||||
// merge this with previous and remove the child
|
||||
prevChild.appendData(child.nodeValue);
|
||||
this.removeChild(child);
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
||||
// Convert the children of a node to an HTML string.
|
||||
// This is used by the innerHTML getter
|
||||
// The serialization spec is at:
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments
|
||||
//
|
||||
// The serialization logic is intentionally implemented in a separate
|
||||
// `NodeUtils` helper instead of the more obvious choice of a private
|
||||
// `_serializeOne()` method on the `Node.prototype` in order to avoid
|
||||
// the megamorphic `this._serializeOne` property access, which reduces
|
||||
// performance unnecessarily. If you need specialized behavior for a
|
||||
// certain subclass, you'll need to implement that in `NodeUtils`.
|
||||
// See https://github.com/fgnass/domino/pull/142 for more information.
|
||||
serialize: { value: function() {
|
||||
if (this._innerHTML) {
|
||||
return this._innerHTML;
|
||||
}
|
||||
var s = '';
|
||||
for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {
|
||||
s += NodeUtils.serializeOne(kid, this);
|
||||
}
|
||||
return s;
|
||||
}},
|
||||
|
||||
// Non-standard, but often useful for debugging.
|
||||
outerHTML: {
|
||||
get: function() {
|
||||
return NodeUtils.serializeOne(this, { nodeType: 0 });
|
||||
},
|
||||
set: utils.nyi,
|
||||
},
|
||||
|
||||
// mirror node type properties in the prototype, so they are present
|
||||
// in instances of Node (and subclasses)
|
||||
ELEMENT_NODE: { value: ELEMENT_NODE },
|
||||
ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE },
|
||||
TEXT_NODE: { value: TEXT_NODE },
|
||||
CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE },
|
||||
ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE },
|
||||
ENTITY_NODE: { value: ENTITY_NODE },
|
||||
PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE },
|
||||
COMMENT_NODE: { value: COMMENT_NODE },
|
||||
DOCUMENT_NODE: { value: DOCUMENT_NODE },
|
||||
DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE },
|
||||
DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE },
|
||||
NOTATION_NODE: { value: NOTATION_NODE },
|
||||
|
||||
DOCUMENT_POSITION_DISCONNECTED: { value: DOCUMENT_POSITION_DISCONNECTED },
|
||||
DOCUMENT_POSITION_PRECEDING: { value: DOCUMENT_POSITION_PRECEDING },
|
||||
DOCUMENT_POSITION_FOLLOWING: { value: DOCUMENT_POSITION_FOLLOWING },
|
||||
DOCUMENT_POSITION_CONTAINS: { value: DOCUMENT_POSITION_CONTAINS },
|
||||
DOCUMENT_POSITION_CONTAINED_BY: { value: DOCUMENT_POSITION_CONTAINED_BY },
|
||||
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC },
|
||||
});
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var NodeFilter = {
|
||||
// Constants for acceptNode()
|
||||
FILTER_ACCEPT: 1,
|
||||
FILTER_REJECT: 2,
|
||||
FILTER_SKIP: 3,
|
||||
|
||||
// Constants for whatToShow
|
||||
SHOW_ALL: 0xFFFFFFFF,
|
||||
SHOW_ELEMENT: 0x1,
|
||||
SHOW_ATTRIBUTE: 0x2, // historical
|
||||
SHOW_TEXT: 0x4,
|
||||
SHOW_CDATA_SECTION: 0x8, // historical
|
||||
SHOW_ENTITY_REFERENCE: 0x10, // historical
|
||||
SHOW_ENTITY: 0x20, // historical
|
||||
SHOW_PROCESSING_INSTRUCTION: 0x40,
|
||||
SHOW_COMMENT: 0x80,
|
||||
SHOW_DOCUMENT: 0x100,
|
||||
SHOW_DOCUMENT_TYPE: 0x200,
|
||||
SHOW_DOCUMENT_FRAGMENT: 0x400,
|
||||
SHOW_NOTATION: 0x800 // historical
|
||||
};
|
||||
|
||||
module.exports = (NodeFilter.constructor = NodeFilter.prototype = NodeFilter);
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
"use strict";
|
||||
module.exports = NodeIterator;
|
||||
|
||||
var NodeFilter = require('./NodeFilter');
|
||||
var NodeTraversal = require('./NodeTraversal');
|
||||
var utils = require('./utils');
|
||||
|
||||
/* Private methods and helpers */
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51
|
||||
*/
|
||||
function move(node, stayWithin, directionIsNext) {
|
||||
if (directionIsNext) {
|
||||
return NodeTraversal.next(node, stayWithin);
|
||||
} else {
|
||||
if (node === stayWithin) {
|
||||
return null;
|
||||
}
|
||||
return NodeTraversal.previous(node, null);
|
||||
}
|
||||
}
|
||||
|
||||
function isInclusiveAncestor(node, possibleChild) {
|
||||
for ( ; possibleChild; possibleChild = possibleChild.parentNode) {
|
||||
if (node === possibleChild) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse
|
||||
* @method
|
||||
* @access private
|
||||
* @param {NodeIterator} ni
|
||||
* @param {string} direction One of 'next' or 'previous'.
|
||||
* @return {Node|null}
|
||||
*/
|
||||
function traverse(ni, directionIsNext) {
|
||||
var node, beforeNode;
|
||||
node = ni._referenceNode;
|
||||
beforeNode = ni._pointerBeforeReferenceNode;
|
||||
while (true) {
|
||||
if (beforeNode === directionIsNext) {
|
||||
beforeNode = !beforeNode;
|
||||
} else {
|
||||
node = move(node, ni._root, directionIsNext);
|
||||
if (node === null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
var result = ni._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ni._referenceNode = node;
|
||||
ni._pointerBeforeReferenceNode = beforeNode;
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
/**
|
||||
* Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator
|
||||
* Latest version: http://www.w3.org/TR/dom/#nodeiterator
|
||||
*
|
||||
* @constructor
|
||||
* @param {Node} root
|
||||
* @param {number} whatToShow [optional]
|
||||
* @param {Function|NodeFilter} filter [optional]
|
||||
* @throws Error
|
||||
*/
|
||||
function NodeIterator(root, whatToShow, filter) {
|
||||
if (!root || !root.nodeType) {
|
||||
utils.NotSupportedError();
|
||||
}
|
||||
|
||||
// Read-only properties
|
||||
this._root = root;
|
||||
this._referenceNode = root;
|
||||
this._pointerBeforeReferenceNode = true;
|
||||
this._whatToShow = Number(whatToShow) || 0;
|
||||
this._filter = filter || null;
|
||||
this._active = false;
|
||||
// Record active node iterators in the document, in order to perform
|
||||
// "node iterator pre-removal steps".
|
||||
root.doc._attachNodeIterator(this);
|
||||
}
|
||||
|
||||
Object.defineProperties(NodeIterator.prototype, {
|
||||
root: { get: function root() {
|
||||
return this._root;
|
||||
} },
|
||||
referenceNode: { get: function referenceNode() {
|
||||
return this._referenceNode;
|
||||
} },
|
||||
pointerBeforeReferenceNode: { get: function pointerBeforeReferenceNode() {
|
||||
return this._pointerBeforeReferenceNode;
|
||||
} },
|
||||
whatToShow: { get: function whatToShow() {
|
||||
return this._whatToShow;
|
||||
} },
|
||||
filter: { get: function filter() {
|
||||
return this._filter;
|
||||
} },
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @param {Node} node
|
||||
* @return {Number} Constant NodeFilter.FILTER_ACCEPT,
|
||||
* NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP.
|
||||
*/
|
||||
_internalFilter: { value: function _internalFilter(node) {
|
||||
/* jshint bitwise: false */
|
||||
var result, filter;
|
||||
if (this._active) {
|
||||
utils.InvalidStateError();
|
||||
}
|
||||
|
||||
// Maps nodeType to whatToShow
|
||||
if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) {
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
|
||||
filter = this._filter;
|
||||
if (filter === null) {
|
||||
result = NodeFilter.FILTER_ACCEPT;
|
||||
} else {
|
||||
this._active = true;
|
||||
try {
|
||||
if (typeof filter === 'function') {
|
||||
result = filter(node);
|
||||
} else {
|
||||
result = filter.acceptNode(node);
|
||||
}
|
||||
} finally {
|
||||
this._active = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Note that coercing to a number means that
|
||||
// `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT)
|
||||
// `false` becomes `0` (neither accept, reject, or skip)
|
||||
return (+result);
|
||||
} },
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps
|
||||
* @method
|
||||
* @return void
|
||||
*/
|
||||
_preremove: { value: function _preremove(toBeRemovedNode) {
|
||||
if (isInclusiveAncestor(toBeRemovedNode, this._root)) { return; }
|
||||
if (!isInclusiveAncestor(toBeRemovedNode, this._referenceNode)) { return; }
|
||||
if (this._pointerBeforeReferenceNode) {
|
||||
var next = toBeRemovedNode;
|
||||
while (next.lastChild) {
|
||||
next = next.lastChild;
|
||||
}
|
||||
next = NodeTraversal.next(next, this.root);
|
||||
if (next) {
|
||||
this._referenceNode = next;
|
||||
return;
|
||||
}
|
||||
this._pointerBeforeReferenceNode = false;
|
||||
// fall through
|
||||
}
|
||||
if (toBeRemovedNode.previousSibling === null) {
|
||||
this._referenceNode = toBeRemovedNode.parentNode;
|
||||
} else {
|
||||
this._referenceNode = toBeRemovedNode.previousSibling;
|
||||
var lastChild;
|
||||
for (lastChild = this._referenceNode.lastChild;
|
||||
lastChild;
|
||||
lastChild = this._referenceNode.lastChild) {
|
||||
this._referenceNode = lastChild;
|
||||
}
|
||||
}
|
||||
} },
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
nextNode: { value: function nextNode() {
|
||||
return traverse(this, true);
|
||||
} },
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
previousNode: { value: function previousNode() {
|
||||
return traverse(this, false);
|
||||
} },
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach
|
||||
* @method
|
||||
* @return void
|
||||
*/
|
||||
detach: { value: function detach() {
|
||||
/* "The detach() method must do nothing.
|
||||
* Its functionality (disabling a NodeIterator object) was removed,
|
||||
* but the method itself is preserved for compatibility.
|
||||
*/
|
||||
} },
|
||||
|
||||
/** For compatibility with web-platform-tests. */
|
||||
toString: { value: function toString() {
|
||||
return "[object NodeIterator]";
|
||||
} },
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
// No support for subclassing array, return an actual Array object.
|
||||
function item(i) {
|
||||
/* jshint validthis: true */
|
||||
return this[i] || null;
|
||||
}
|
||||
|
||||
function NodeList(a) {
|
||||
if (!a) a = [];
|
||||
a.item = item;
|
||||
return a;
|
||||
}
|
||||
|
||||
module.exports = NodeList;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/* jshint esversion: 6 */
|
||||
"use strict";
|
||||
|
||||
module.exports = class NodeList extends Array {
|
||||
constructor(a) {
|
||||
super((a && a.length) || 0);
|
||||
if (a) {
|
||||
for (var idx in a) { this[idx] = a[idx]; }
|
||||
}
|
||||
}
|
||||
item(i) { return this[i] || null; }
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var NodeList;
|
||||
|
||||
try {
|
||||
// Attempt to use ES6-style Array subclass if possible.
|
||||
NodeList = require('./NodeList.es6.js');
|
||||
} catch (e) {
|
||||
// No support for subclassing array, return an actual Array object.
|
||||
NodeList = require('./NodeList.es5.js');
|
||||
}
|
||||
|
||||
module.exports = NodeList;
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
/* exported NodeTraversal */
|
||||
var NodeTraversal = module.exports = {
|
||||
nextSkippingChildren: nextSkippingChildren,
|
||||
nextAncestorSibling: nextAncestorSibling,
|
||||
next: next,
|
||||
previous: previous,
|
||||
deepLastChild: deepLastChild
|
||||
};
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeTraversal::nextSkippingChildren
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L109
|
||||
*/
|
||||
function nextSkippingChildren(node, stayWithin) {
|
||||
if (node === stayWithin) {
|
||||
return null;
|
||||
}
|
||||
if (node.nextSibling !== null) {
|
||||
return node.nextSibling;
|
||||
}
|
||||
return nextAncestorSibling(node, stayWithin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeTraversal::nextAncestorSibling
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L93
|
||||
*/
|
||||
function nextAncestorSibling(node, stayWithin) {
|
||||
for (node = node.parentNode; node !== null; node = node.parentNode) {
|
||||
if (node === stayWithin) {
|
||||
return null;
|
||||
}
|
||||
if (node.nextSibling !== null) {
|
||||
return node.nextSibling;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeTraversal::next
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L99
|
||||
*/
|
||||
function next(node, stayWithin) {
|
||||
var n;
|
||||
n = node.firstChild;
|
||||
if (n !== null) {
|
||||
return n;
|
||||
}
|
||||
if (node === stayWithin) {
|
||||
return null;
|
||||
}
|
||||
n = node.nextSibling;
|
||||
if (n !== null) {
|
||||
return n;
|
||||
}
|
||||
return nextAncestorSibling(node, stayWithin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeTraversal::deepLastChild
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L116
|
||||
*/
|
||||
function deepLastChild(node) {
|
||||
while (node.lastChild) {
|
||||
node = node.lastChild;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @based on WebKit's NodeTraversal::previous
|
||||
* https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L121
|
||||
*/
|
||||
function previous(node, stayWithin) {
|
||||
var p;
|
||||
p = node.previousSibling;
|
||||
if (p !== null) {
|
||||
return deepLastChild(p);
|
||||
}
|
||||
p = node.parentNode;
|
||||
if (p === stayWithin) {
|
||||
return null;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
// NOTE: The `serializeOne()` function used to live on the `Node.prototype`
|
||||
// as a private method `Node#_serializeOne(child)`, however that requires
|
||||
// a megamorphic property access `this._serializeOne` just to get to the
|
||||
// method, and this is being done on lots of different `Node` subclasses,
|
||||
// which puts a lot of pressure on V8's megamorphic stub cache. So by
|
||||
// moving the helper off of the `Node.prototype` and into a separate
|
||||
// function in this helper module, we get a monomorphic property access
|
||||
// `NodeUtils.serializeOne` to get to the function and reduce pressure
|
||||
// on the megamorphic stub cache.
|
||||
// See https://github.com/fgnass/domino/pull/142 for more information.
|
||||
serializeOne: serializeOne,
|
||||
|
||||
// Export util functions so that we can run extra test for them.
|
||||
// Note: we prefix function names with `ɵ`, similar to what we do
|
||||
// with internal functions in Angular packages.
|
||||
ɵescapeMatchingClosingTag: escapeMatchingClosingTag,
|
||||
ɵescapeClosingCommentTag: escapeClosingCommentTag,
|
||||
ɵescapeProcessingInstructionContent: escapeProcessingInstructionContent
|
||||
};
|
||||
|
||||
var utils = require('./utils');
|
||||
var NAMESPACE = utils.NAMESPACE;
|
||||
|
||||
var hasRawContent = {
|
||||
STYLE: true,
|
||||
SCRIPT: true,
|
||||
XMP: true,
|
||||
IFRAME: true,
|
||||
NOEMBED: true,
|
||||
NOFRAMES: true,
|
||||
PLAINTEXT: true
|
||||
};
|
||||
|
||||
var emptyElements = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
bgsound: true,
|
||||
br: true,
|
||||
col: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
hr: true,
|
||||
img: true,
|
||||
input: true,
|
||||
keygen: true,
|
||||
link: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
source: true,
|
||||
track: true,
|
||||
wbr: true
|
||||
};
|
||||
|
||||
var extraNewLine = {
|
||||
/* Removed in https://github.com/whatwg/html/issues/944
|
||||
pre: true,
|
||||
textarea: true,
|
||||
listing: true
|
||||
*/
|
||||
};
|
||||
|
||||
const ESCAPE_REGEXP = /[&<>\u00A0]/g;
|
||||
const ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g;
|
||||
|
||||
function escape(s) {
|
||||
if (!ESCAPE_REGEXP.test(s)) {
|
||||
// nothing to do, fast path
|
||||
return s;
|
||||
}
|
||||
|
||||
return s.replace(ESCAPE_REGEXP, (c) => {
|
||||
switch (c) {
|
||||
case "&":
|
||||
return "&";
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "\u00A0":
|
||||
return " ";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function escapeAttr(s) {
|
||||
if (!ESCAPE_ATTR_REGEXP.test(s)) {
|
||||
// nothing to do, fast path
|
||||
return s;
|
||||
}
|
||||
|
||||
return s.replace(ESCAPE_ATTR_REGEXP, (c) => {
|
||||
switch (c) {
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "&":
|
||||
return "&";
|
||||
case '"':
|
||||
return """;
|
||||
case "\u00A0":
|
||||
return " ";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function attrname(a) {
|
||||
var ns = a.namespaceURI;
|
||||
if (!ns)
|
||||
return a.localName;
|
||||
if (ns === NAMESPACE.XML)
|
||||
return 'xml:' + a.localName;
|
||||
if (ns === NAMESPACE.XLINK)
|
||||
return 'xlink:' + a.localName;
|
||||
|
||||
if (ns === NAMESPACE.XMLNS) {
|
||||
if (a.localName === 'xmlns') return 'xmlns';
|
||||
else return 'xmlns:' + a.localName;
|
||||
}
|
||||
return a.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes matching closing tag in a raw text.
|
||||
*
|
||||
* For example, given `<style>#text(</style><script></script>)</style>`,
|
||||
* the parent tag would by "style" and the raw text is
|
||||
* "</style><script></script>". If we come across a matching closing tag
|
||||
* (in out case `</style>`) - replace `<` with `<` to avoid unexpected
|
||||
* and unsafe behavior after de-serialization.
|
||||
*/
|
||||
function escapeMatchingClosingTag(rawText, parentTag) {
|
||||
const parentClosingTag = '</' + parentTag;
|
||||
if (!rawText.toLowerCase().includes(parentClosingTag)) {
|
||||
return rawText; // fast path
|
||||
}
|
||||
const result = [...rawText];
|
||||
const matches = rawText.matchAll(new RegExp(parentClosingTag, 'ig'));
|
||||
for (const match of matches) {
|
||||
result[match.index] = '<';
|
||||
}
|
||||
return result.join('');
|
||||
}
|
||||
|
||||
const CLOSING_COMMENT_REGEXP = /--!?>/;
|
||||
|
||||
/**
|
||||
* Escapes closing comment tag in a comment content.
|
||||
*
|
||||
* For example, given `#comment('-->')`, the content of a comment would be
|
||||
* updated to `-->` to avoid unexpected and unsafe behavior after
|
||||
* de-serialization.
|
||||
*/
|
||||
function escapeClosingCommentTag(rawContent) {
|
||||
if (!CLOSING_COMMENT_REGEXP.test(rawContent)) {
|
||||
return rawContent; // fast path
|
||||
}
|
||||
return rawContent.replace(/(--\!?)>/g, '$1>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes processing instruction content by replacing `>` with `>`.
|
||||
*/
|
||||
function escapeProcessingInstructionContent(rawContent) {
|
||||
return rawContent.includes('>')
|
||||
? rawContent.replaceAll('>', '>')
|
||||
: rawContent;
|
||||
}
|
||||
|
||||
function serializeOne(kid, parent) {
|
||||
var s = '';
|
||||
switch(kid.nodeType) {
|
||||
case 1: //ELEMENT_NODE
|
||||
var ns = kid.namespaceURI;
|
||||
var html = ns === NAMESPACE.HTML;
|
||||
var tagname = (html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML) ? kid.localName : kid.tagName;
|
||||
|
||||
s += '<' + tagname;
|
||||
|
||||
for(var j = 0, k = kid._numattrs; j < k; j++) {
|
||||
var a = kid._attr(j);
|
||||
s += ' ' + attrname(a);
|
||||
if (a.value !== undefined) s += '="' + escapeAttr(a.value) + '"';
|
||||
}
|
||||
s += '>';
|
||||
|
||||
if (!(html && emptyElements[tagname])) {
|
||||
var ss = kid.serialize();
|
||||
// If an element can have raw content, this content may
|
||||
// potentially require escaping to avoid XSS.
|
||||
if (hasRawContent[tagname.toUpperCase()]) {
|
||||
ss = escapeMatchingClosingTag(ss, tagname);
|
||||
}
|
||||
if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n';
|
||||
// Serialize children and add end tag for all others
|
||||
s += ss;
|
||||
s += '</' + tagname + '>';
|
||||
}
|
||||
break;
|
||||
case 3: //TEXT_NODE
|
||||
case 4: //CDATA_SECTION_NODE
|
||||
var parenttag;
|
||||
if (parent.nodeType === 1 /*ELEMENT_NODE*/ &&
|
||||
parent.namespaceURI === NAMESPACE.HTML)
|
||||
parenttag = parent.tagName;
|
||||
else
|
||||
parenttag = '';
|
||||
|
||||
if (hasRawContent[parenttag] ||
|
||||
(parenttag==='NOSCRIPT' && parent.ownerDocument._scripting_enabled)) {
|
||||
s += kid.data;
|
||||
} else {
|
||||
s += escape(kid.data);
|
||||
}
|
||||
break;
|
||||
case 8: //COMMENT_NODE
|
||||
s += '<!--' + escapeClosingCommentTag(kid.data) + '-->';
|
||||
break;
|
||||
case 7: //PROCESSING_INSTRUCTION_NODE
|
||||
const content = escapeProcessingInstructionContent(kid.data);
|
||||
s += '<?' + kid.target + ' ' + content + '?>';
|
||||
break;
|
||||
case 10: //DOCUMENT_TYPE_NODE
|
||||
s += '<!DOCTYPE ' + kid.name;
|
||||
|
||||
if (false) {
|
||||
// Latest HTML serialization spec omits the public/system ID
|
||||
if (kid.publicID) {
|
||||
s += ' PUBLIC "' + kid.publicId + '"';
|
||||
}
|
||||
|
||||
if (kid.systemId) {
|
||||
s += ' "' + kid.systemId + '"';
|
||||
}
|
||||
}
|
||||
|
||||
s += '>';
|
||||
break;
|
||||
default:
|
||||
utils.InvalidStateError();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
var Node = require('./Node');
|
||||
|
||||
var NonDocumentTypeChildNode = {
|
||||
|
||||
nextElementSibling: { get: function() {
|
||||
if (this.parentNode) {
|
||||
for (var kid = this.nextSibling; kid !== null; kid = kid.nextSibling) {
|
||||
if (kid.nodeType === Node.ELEMENT_NODE) return kid;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}},
|
||||
|
||||
previousElementSibling: { get: function() {
|
||||
if (this.parentNode) {
|
||||
for (var kid = this.previousSibling; kid !== null; kid = kid.previousSibling) {
|
||||
if (kid.nodeType === Node.ELEMENT_NODE) return kid;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}}
|
||||
|
||||
};
|
||||
|
||||
module.exports = NonDocumentTypeChildNode;
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
module.exports = ProcessingInstruction;
|
||||
|
||||
var Node = require('./Node');
|
||||
var CharacterData = require('./CharacterData');
|
||||
|
||||
function ProcessingInstruction(doc, target, data) {
|
||||
CharacterData.call(this);
|
||||
this.nodeType = Node.PROCESSING_INSTRUCTION_NODE;
|
||||
this.ownerDocument = doc;
|
||||
this.target = target;
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
var nodeValue = {
|
||||
get: function() { return this._data; },
|
||||
set: function(v) {
|
||||
if (v === null || v === undefined) { v = ''; } else { v = String(v); }
|
||||
this._data = v;
|
||||
if (this.rooted) this.ownerDocument.mutateValue(this);
|
||||
}
|
||||
};
|
||||
|
||||
ProcessingInstruction.prototype = Object.create(CharacterData.prototype, {
|
||||
nodeName: { get: function() { return this.target; }},
|
||||
nodeValue: nodeValue,
|
||||
textContent: nodeValue,
|
||||
innerText: nodeValue,
|
||||
data: {
|
||||
get: nodeValue.get,
|
||||
set: function(v) {
|
||||
nodeValue.set.call(this, v===null ? '' : String(v));
|
||||
},
|
||||
},
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
return new ProcessingInstruction(this.ownerDocument, this.target, this._data);
|
||||
}},
|
||||
isEqual: { value: function isEqual(n) {
|
||||
return this.target === n.target && this._data === n._data;
|
||||
}}
|
||||
|
||||
});
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
module.exports = Text;
|
||||
|
||||
var utils = require('./utils');
|
||||
var Node = require('./Node');
|
||||
var CharacterData = require('./CharacterData');
|
||||
|
||||
function Text(doc, data) {
|
||||
CharacterData.call(this);
|
||||
this.nodeType = Node.TEXT_NODE;
|
||||
this.ownerDocument = doc;
|
||||
this._data = data;
|
||||
this._index = undefined;
|
||||
}
|
||||
|
||||
var nodeValue = {
|
||||
get: function() { return this._data; },
|
||||
set: function(v) {
|
||||
if (v === null || v === undefined) { v = ''; } else { v = String(v); }
|
||||
if (v === this._data) return;
|
||||
this._data = v;
|
||||
if (this.rooted)
|
||||
this.ownerDocument.mutateValue(this);
|
||||
if (this.parentNode &&
|
||||
this.parentNode._textchangehook)
|
||||
this.parentNode._textchangehook(this);
|
||||
}
|
||||
};
|
||||
|
||||
Text.prototype = Object.create(CharacterData.prototype, {
|
||||
nodeName: { value: "#text" },
|
||||
// These three attributes are all the same.
|
||||
// The data attribute has a [TreatNullAs=EmptyString] but we'll
|
||||
// implement that at the interface level
|
||||
nodeValue: nodeValue,
|
||||
textContent: nodeValue,
|
||||
innerText: nodeValue,
|
||||
data: {
|
||||
get: nodeValue.get,
|
||||
set: function(v) {
|
||||
nodeValue.set.call(this, v===null ? '' : String(v));
|
||||
},
|
||||
},
|
||||
|
||||
splitText: { value: function splitText(offset) {
|
||||
if (offset > this._data.length || offset < 0) utils.IndexSizeError();
|
||||
|
||||
var newdata = this._data.substring(offset),
|
||||
newnode = this.ownerDocument.createTextNode(newdata);
|
||||
this.data = this.data.substring(0, offset);
|
||||
|
||||
var parent = this.parentNode;
|
||||
if (parent !== null)
|
||||
parent.insertBefore(newnode, this.nextSibling);
|
||||
|
||||
return newnode;
|
||||
}},
|
||||
|
||||
wholeText: { get: function wholeText() {
|
||||
var result = this.textContent;
|
||||
for (var next = this.nextSibling; next; next = next.nextSibling) {
|
||||
if (next.nodeType !== Node.TEXT_NODE) { break; }
|
||||
result += next.textContent;
|
||||
}
|
||||
return result;
|
||||
}},
|
||||
// Obsolete, removed from spec.
|
||||
replaceWholeText: { value: utils.nyi },
|
||||
|
||||
// Utility methods
|
||||
clone: { value: function clone() {
|
||||
return new Text(this.ownerDocument, this._data);
|
||||
}},
|
||||
|
||||
});
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
"use strict";
|
||||
module.exports = TreeWalker;
|
||||
|
||||
var Node = require('./Node');
|
||||
var NodeFilter = require('./NodeFilter');
|
||||
var NodeTraversal = require('./NodeTraversal');
|
||||
var utils = require('./utils');
|
||||
|
||||
var mapChild = {
|
||||
first: 'firstChild',
|
||||
last: 'lastChild',
|
||||
next: 'firstChild',
|
||||
previous: 'lastChild'
|
||||
};
|
||||
|
||||
var mapSibling = {
|
||||
first: 'nextSibling',
|
||||
last: 'previousSibling',
|
||||
next: 'nextSibling',
|
||||
previous: 'previousSibling'
|
||||
};
|
||||
|
||||
/* Private methods and helpers */
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#concept-traverse-children
|
||||
* @method
|
||||
* @access private
|
||||
* @param {TreeWalker} tw
|
||||
* @param {string} type One of 'first' or 'last'.
|
||||
* @return {Node|null}
|
||||
*/
|
||||
function traverseChildren(tw, type) {
|
||||
var child, node, parent, result, sibling;
|
||||
node = tw._currentNode[mapChild[type]];
|
||||
while (node !== null) {
|
||||
result = tw._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
tw._currentNode = node;
|
||||
return node;
|
||||
}
|
||||
if (result === NodeFilter.FILTER_SKIP) {
|
||||
child = node[mapChild[type]];
|
||||
if (child !== null) {
|
||||
node = child;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (node !== null) {
|
||||
sibling = node[mapSibling[type]];
|
||||
if (sibling !== null) {
|
||||
node = sibling;
|
||||
break;
|
||||
}
|
||||
parent = node.parentNode;
|
||||
if (parent === null || parent === tw.root || parent === tw._currentNode) {
|
||||
return null;
|
||||
} else {
|
||||
node = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#concept-traverse-siblings
|
||||
* @method
|
||||
* @access private
|
||||
* @param {TreeWalker} tw
|
||||
* @param {TreeWalker} type One of 'next' or 'previous'.
|
||||
* @return {Node|nul}
|
||||
*/
|
||||
function traverseSiblings(tw, type) {
|
||||
var node, result, sibling;
|
||||
node = tw._currentNode;
|
||||
if (node === tw.root) {
|
||||
return null;
|
||||
}
|
||||
while (true) {
|
||||
sibling = node[mapSibling[type]];
|
||||
while (sibling !== null) {
|
||||
node = sibling;
|
||||
result = tw._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
tw._currentNode = node;
|
||||
return node;
|
||||
}
|
||||
sibling = node[mapChild[type]];
|
||||
if (result === NodeFilter.FILTER_REJECT || sibling === null) {
|
||||
sibling = node[mapSibling[type]];
|
||||
}
|
||||
}
|
||||
node = node.parentNode;
|
||||
if (node === null || node === tw.root) {
|
||||
return null;
|
||||
}
|
||||
if (tw._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Public API */
|
||||
|
||||
/**
|
||||
* Latest version: https://dom.spec.whatwg.org/#treewalker
|
||||
*
|
||||
* @constructor
|
||||
* @param {Node} root
|
||||
* @param {number} whatToShow [optional]
|
||||
* @param {Function|NodeFilter} filter [optional]
|
||||
* @throws Error
|
||||
*/
|
||||
function TreeWalker(root, whatToShow, filter) {
|
||||
if (!root || !root.nodeType) {
|
||||
utils.NotSupportedError();
|
||||
}
|
||||
|
||||
// Read-only properties
|
||||
this._root = root;
|
||||
this._whatToShow = Number(whatToShow) || 0;
|
||||
this._filter = filter || null;
|
||||
this._active = false;
|
||||
// Read-write property
|
||||
this._currentNode = root;
|
||||
}
|
||||
|
||||
Object.defineProperties(TreeWalker.prototype, {
|
||||
root: { get: function() { return this._root; } },
|
||||
whatToShow: { get: function() { return this._whatToShow; } },
|
||||
filter: { get: function() { return this._filter; } },
|
||||
|
||||
currentNode: {
|
||||
get: function currentNode() {
|
||||
return this._currentNode;
|
||||
},
|
||||
set: function setCurrentNode(v) {
|
||||
if (!(v instanceof Node)) {
|
||||
throw new TypeError("Not a Node"); // `null` is also not a node
|
||||
}
|
||||
this._currentNode = v;
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* @method
|
||||
* @param {Node} node
|
||||
* @return {Number} Constant NodeFilter.FILTER_ACCEPT,
|
||||
* NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP.
|
||||
*/
|
||||
_internalFilter: { value: function _internalFilter(node) {
|
||||
/* jshint bitwise: false */
|
||||
var result, filter;
|
||||
if (this._active) {
|
||||
utils.InvalidStateError();
|
||||
}
|
||||
|
||||
// Maps nodeType to whatToShow
|
||||
if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) {
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
|
||||
filter = this._filter;
|
||||
if (filter === null) {
|
||||
result = NodeFilter.FILTER_ACCEPT;
|
||||
} else {
|
||||
this._active = true;
|
||||
try {
|
||||
if (typeof filter === 'function') {
|
||||
result = filter(node);
|
||||
} else {
|
||||
result = filter.acceptNode(node);
|
||||
}
|
||||
} finally {
|
||||
this._active = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Note that coercing to a number means that
|
||||
// `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT)
|
||||
// `false` becomes `0` (neither accept, reject, or skip)
|
||||
return (+result);
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#dom-treewalker-parentnode
|
||||
* @based on WebKit's TreeWalker::parentNode
|
||||
* https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L50
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
parentNode: { value: function parentNode() {
|
||||
var node = this._currentNode;
|
||||
while (node !== this.root) {
|
||||
node = node.parentNode;
|
||||
if (node === null) {
|
||||
return null;
|
||||
}
|
||||
if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {
|
||||
this._currentNode = node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#dom-treewalker-firstchild
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
firstChild: { value: function firstChild() {
|
||||
return traverseChildren(this, 'first');
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#dom-treewalker-lastchild
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
lastChild: { value: function lastChild() {
|
||||
return traverseChildren(this, 'last');
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
previousSibling: { value: function previousSibling() {
|
||||
return traverseSiblings(this, 'previous');
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
nextSibling: { value: function nextSibling() {
|
||||
return traverseSiblings(this, 'next');
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#dom-treewalker-previousnode
|
||||
* @based on WebKit's TreeWalker::previousNode
|
||||
* https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L181
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
previousNode: { value: function previousNode() {
|
||||
var node, result, previousSibling, lastChild;
|
||||
node = this._currentNode;
|
||||
while (node !== this._root) {
|
||||
for (previousSibling = node.previousSibling;
|
||||
previousSibling;
|
||||
previousSibling = node.previousSibling) {
|
||||
node = previousSibling;
|
||||
result = this._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_REJECT) {
|
||||
continue;
|
||||
}
|
||||
for (lastChild = node.lastChild;
|
||||
lastChild;
|
||||
lastChild = node.lastChild) {
|
||||
node = lastChild;
|
||||
result = this._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_REJECT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
this._currentNode = node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
if (node === this.root || node.parentNode === null) {
|
||||
return null;
|
||||
}
|
||||
node = node.parentNode;
|
||||
if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {
|
||||
this._currentNode = node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}},
|
||||
|
||||
/**
|
||||
* @spec https://dom.spec.whatwg.org/#dom-treewalker-nextnode
|
||||
* @based on WebKit's TreeWalker::nextNode
|
||||
* https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L228
|
||||
* @method
|
||||
* @return {Node|null}
|
||||
*/
|
||||
nextNode: { value: function nextNode() {
|
||||
var node, result, firstChild, nextSibling;
|
||||
node = this._currentNode;
|
||||
result = NodeFilter.FILTER_ACCEPT;
|
||||
|
||||
CHILDREN:
|
||||
while (true) {
|
||||
for (firstChild = node.firstChild;
|
||||
firstChild;
|
||||
firstChild = node.firstChild) {
|
||||
node = firstChild;
|
||||
result = this._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
this._currentNode = node;
|
||||
return node;
|
||||
} else if (result === NodeFilter.FILTER_REJECT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (nextSibling = NodeTraversal.nextSkippingChildren(node, this.root);
|
||||
nextSibling;
|
||||
nextSibling = NodeTraversal.nextSkippingChildren(node, this.root)) {
|
||||
node = nextSibling;
|
||||
result = this._internalFilter(node);
|
||||
if (result === NodeFilter.FILTER_ACCEPT) {
|
||||
this._currentNode = node;
|
||||
return node;
|
||||
} else if (result === NodeFilter.FILTER_SKIP) {
|
||||
continue CHILDREN;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}},
|
||||
|
||||
/** For compatibility with web-platform-tests. */
|
||||
toString: { value: function toString() {
|
||||
return "[object TreeWalker]";
|
||||
}},
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var Event = require('./Event');
|
||||
|
||||
module.exports = UIEvent;
|
||||
|
||||
function UIEvent() {
|
||||
// Just use the superclass constructor to initialize
|
||||
Event.call(this);
|
||||
this.view = null; // FF uses the current window
|
||||
this.detail = 0;
|
||||
}
|
||||
UIEvent.prototype = Object.create(Event.prototype, {
|
||||
constructor: { value: UIEvent },
|
||||
initUIEvent: { value: function(type, bubbles, cancelable, view, detail) {
|
||||
this.initEvent(type, bubbles, cancelable);
|
||||
this.view = view;
|
||||
this.detail = detail;
|
||||
}}
|
||||
});
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
module.exports = URL;
|
||||
|
||||
function URL(url) {
|
||||
if (!url) return Object.create(URL.prototype);
|
||||
// Can't use String.trim() since it defines whitespace differently than HTML
|
||||
this.url = url.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, "");
|
||||
|
||||
// See http://tools.ietf.org/html/rfc3986#appendix-B
|
||||
// and https://url.spec.whatwg.org/#parsing
|
||||
var match = URL.pattern.exec(this.url);
|
||||
if (match) {
|
||||
if (match[2]) this.scheme = match[2];
|
||||
if (match[4]) {
|
||||
// parse username/password
|
||||
var userinfo = match[4].match(URL.userinfoPattern);
|
||||
if (userinfo) {
|
||||
this.username = userinfo[1];
|
||||
this.password = userinfo[3];
|
||||
match[4] = match[4].substring(userinfo[0].length);
|
||||
}
|
||||
if (match[4].match(URL.portPattern)) {
|
||||
var pos = match[4].lastIndexOf(':');
|
||||
this.host = match[4].substring(0, pos);
|
||||
this.port = match[4].substring(pos+1);
|
||||
}
|
||||
else {
|
||||
this.host = match[4];
|
||||
}
|
||||
}
|
||||
if (match[5]) this.path = match[5];
|
||||
if (match[6]) this.query = match[7];
|
||||
if (match[8]) this.fragment = match[9];
|
||||
}
|
||||
}
|
||||
|
||||
URL.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/;
|
||||
URL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/;
|
||||
URL.portPattern = /:\d+$/;
|
||||
URL.authorityPattern = /^[^:\/?#]+:\/\//;
|
||||
URL.hierarchyPattern = /^[^:\/?#]+:\//;
|
||||
|
||||
// Return a percentEncoded version of s.
|
||||
// S should be a single-character string
|
||||
// XXX: needs to do utf-8 encoding?
|
||||
URL.percentEncode = function percentEncode(s) {
|
||||
var c = s.charCodeAt(0);
|
||||
if (c < 256) return "%" + c.toString(16);
|
||||
else throw Error("can't percent-encode codepoints > 255 yet");
|
||||
};
|
||||
|
||||
URL.prototype = {
|
||||
constructor: URL,
|
||||
|
||||
// XXX: not sure if this is the precise definition of absolute
|
||||
isAbsolute: function() { return !!this.scheme; },
|
||||
isAuthorityBased: function() {
|
||||
return URL.authorityPattern.test(this.url);
|
||||
},
|
||||
isHierarchical: function() {
|
||||
return URL.hierarchyPattern.test(this.url);
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
var s = "";
|
||||
if (this.scheme !== undefined) s += this.scheme + ":";
|
||||
if (this.isAbsolute()) {
|
||||
s += '//';
|
||||
if (this.username || this.password) {
|
||||
s += this.username || '';
|
||||
if (this.password) {
|
||||
s += ':' + this.password;
|
||||
}
|
||||
s += '@';
|
||||
}
|
||||
if (this.host) {
|
||||
s += this.host;
|
||||
}
|
||||
}
|
||||
if (this.port !== undefined) s += ":" + this.port;
|
||||
if (this.path !== undefined) s += this.path;
|
||||
if (this.query !== undefined) s += "?" + this.query;
|
||||
if (this.fragment !== undefined) s += "#" + this.fragment;
|
||||
return s;
|
||||
},
|
||||
|
||||
// See: http://tools.ietf.org/html/rfc3986#section-5.2
|
||||
// and https://url.spec.whatwg.org/#constructors
|
||||
resolve: function(relative) {
|
||||
var base = this; // The base url we're resolving against
|
||||
var r = new URL(relative); // The relative reference url to resolve
|
||||
var t = new URL(); // The absolute target url we will return
|
||||
|
||||
if (r.scheme !== undefined) {
|
||||
t.scheme = r.scheme;
|
||||
t.username = r.username;
|
||||
t.password = r.password;
|
||||
t.host = r.host;
|
||||
t.port = r.port;
|
||||
t.path = remove_dot_segments(r.path);
|
||||
t.query = r.query;
|
||||
}
|
||||
else {
|
||||
t.scheme = base.scheme;
|
||||
if (r.host !== undefined) {
|
||||
t.username = r.username;
|
||||
t.password = r.password;
|
||||
t.host = r.host;
|
||||
t.port = r.port;
|
||||
t.path = remove_dot_segments(r.path);
|
||||
t.query = r.query;
|
||||
}
|
||||
else {
|
||||
t.username = base.username;
|
||||
t.password = base.password;
|
||||
t.host = base.host;
|
||||
t.port = base.port;
|
||||
if (!r.path) { // undefined or empty
|
||||
t.path = base.path;
|
||||
if (r.query !== undefined)
|
||||
t.query = r.query;
|
||||
else
|
||||
t.query = base.query;
|
||||
}
|
||||
else {
|
||||
if (r.path.charAt(0) === "/") {
|
||||
t.path = remove_dot_segments(r.path);
|
||||
}
|
||||
else {
|
||||
t.path = merge(base.path, r.path);
|
||||
t.path = remove_dot_segments(t.path);
|
||||
}
|
||||
t.query = r.query;
|
||||
}
|
||||
}
|
||||
}
|
||||
t.fragment = r.fragment;
|
||||
|
||||
return t.toString();
|
||||
|
||||
|
||||
function merge(basepath, refpath) {
|
||||
if (base.host !== undefined && !base.path)
|
||||
return "/" + refpath;
|
||||
|
||||
var lastslash = basepath.lastIndexOf("/");
|
||||
if (lastslash === -1)
|
||||
return refpath;
|
||||
else
|
||||
return basepath.substring(0, lastslash+1) + refpath;
|
||||
}
|
||||
|
||||
function remove_dot_segments(path) {
|
||||
if (!path) return path; // For "" or undefined
|
||||
|
||||
var output = "";
|
||||
while(path.length > 0) {
|
||||
if (path === "." || path === "..") {
|
||||
path = "";
|
||||
break;
|
||||
}
|
||||
|
||||
var twochars = path.substring(0,2);
|
||||
var threechars = path.substring(0,3);
|
||||
var fourchars = path.substring(0,4);
|
||||
if (threechars === "../") {
|
||||
path = path.substring(3);
|
||||
}
|
||||
else if (twochars === "./") {
|
||||
path = path.substring(2);
|
||||
}
|
||||
else if (threechars === "/./") {
|
||||
path = "/" + path.substring(3);
|
||||
}
|
||||
else if (twochars === "/." && path.length === 2) {
|
||||
path = "/";
|
||||
}
|
||||
else if (fourchars === "/../" ||
|
||||
(threechars === "/.." && path.length === 3)) {
|
||||
path = "/" + path.substring(4);
|
||||
|
||||
output = output.replace(/\/?[^\/]*$/, "");
|
||||
}
|
||||
else {
|
||||
var segment = path.match(/(\/?([^\/]*))/)[0];
|
||||
output += segment;
|
||||
path = path.substring(segment.length);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
},
|
||||
};
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
"use strict";
|
||||
var URL = require('./URL');
|
||||
|
||||
module.exports = URLUtils;
|
||||
|
||||
// Allow the `x == null` pattern. This is eslint's "null: 'ignore'" option,
|
||||
// but jshint doesn't support this.
|
||||
/* jshint eqeqeq: false */
|
||||
|
||||
// This is an abstract superclass for Location, HTMLAnchorElement and
|
||||
// other types that have the standard complement of "URL decomposition
|
||||
// IDL attributes". This is now standardized as URLUtils, see:
|
||||
// https://url.spec.whatwg.org/#urlutils
|
||||
// Subclasses must define a getter/setter on href.
|
||||
// The getter and setter methods parse and rebuild the URL on each
|
||||
// invocation; there is no attempt to cache the value and be more efficient
|
||||
function URLUtils() {}
|
||||
URLUtils.prototype = Object.create(Object.prototype, {
|
||||
|
||||
_url: { get: function() {
|
||||
// XXX: this should do the "Reinitialize url" steps, and "null" should
|
||||
// be a valid return value.
|
||||
return new URL(this.href);
|
||||
} },
|
||||
|
||||
protocol: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url && url.scheme) return url.scheme + ":";
|
||||
else return ":";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute()) {
|
||||
v = v.replace(/:+$/, "");
|
||||
v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL.percentEncode);
|
||||
if (v.length > 0) {
|
||||
url.scheme = v;
|
||||
output = url.toString();
|
||||
}
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
host: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url.isAbsolute() && url.isAuthorityBased())
|
||||
return url.host + (url.port ? (":" + url.port) : "");
|
||||
else
|
||||
return "";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute() && url.isAuthorityBased()) {
|
||||
v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);
|
||||
if (v.length > 0) {
|
||||
url.host = v;
|
||||
delete url.port;
|
||||
output = url.toString();
|
||||
}
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
hostname: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url.isAbsolute() && url.isAuthorityBased())
|
||||
return url.host;
|
||||
else
|
||||
return "";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute() && url.isAuthorityBased()) {
|
||||
v = v.replace(/^\/+/, "");
|
||||
v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);
|
||||
if (v.length > 0) {
|
||||
url.host = v;
|
||||
output = url.toString();
|
||||
}
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
port: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url.isAbsolute() && url.isAuthorityBased() && url.port!==undefined)
|
||||
return url.port;
|
||||
else
|
||||
return "";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute() && url.isAuthorityBased()) {
|
||||
v = '' + v;
|
||||
v = v.replace(/[^0-9].*$/, "");
|
||||
v = v.replace(/^0+/, "");
|
||||
if (v.length === 0) v = "0";
|
||||
if (parseInt(v, 10) <= 65535) {
|
||||
url.port = v;
|
||||
output = url.toString();
|
||||
}
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
pathname: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url.isAbsolute() && url.isHierarchical())
|
||||
return url.path;
|
||||
else
|
||||
return "";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute() && url.isHierarchical()) {
|
||||
if (v.charAt(0) !== "/")
|
||||
v = "/" + v;
|
||||
v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL.percentEncode);
|
||||
url.path = v;
|
||||
output = url.toString();
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
search: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url.isAbsolute() && url.isHierarchical() && url.query!==undefined)
|
||||
return "?" + url.query;
|
||||
else
|
||||
return "";
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute() && url.isHierarchical()) {
|
||||
if (v.charAt(0) === "?") v = v.substring(1);
|
||||
v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode);
|
||||
url.query = v;
|
||||
output = url.toString();
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
hash: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
if (url == null || url.fragment == null || url.fragment === '') {
|
||||
return "";
|
||||
} else {
|
||||
return "#" + url.fragment;
|
||||
}
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
|
||||
if (v.charAt(0) === "#") v = v.substring(1);
|
||||
v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode);
|
||||
url.fragment = v;
|
||||
output = url.toString();
|
||||
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
username: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
return url.username || '';
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute()) {
|
||||
v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL.percentEncode);
|
||||
url.username = v;
|
||||
output = url.toString();
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
password: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
return url.password || '';
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
if (url.isAbsolute()) {
|
||||
if (v==='') {
|
||||
url.password = null;
|
||||
} else {
|
||||
v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL.percentEncode);
|
||||
url.password = v;
|
||||
}
|
||||
output = url.toString();
|
||||
}
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
|
||||
origin: { get: function() {
|
||||
var url = this._url;
|
||||
if (url == null) { return ''; }
|
||||
var originForPort = function(defaultPort) {
|
||||
var origin = [url.scheme, url.host, +url.port || defaultPort];
|
||||
// XXX should be "unicode serialization"
|
||||
return origin[0] + '://' + origin[1] +
|
||||
(origin[2] === defaultPort ? '' : (':' + origin[2]));
|
||||
};
|
||||
switch (url.scheme) {
|
||||
case 'ftp':
|
||||
return originForPort(21);
|
||||
case 'gopher':
|
||||
return originForPort(70);
|
||||
case 'http':
|
||||
case 'ws':
|
||||
return originForPort(80);
|
||||
case 'https':
|
||||
case 'wss':
|
||||
return originForPort(443);
|
||||
default:
|
||||
// this is what chrome does
|
||||
return url.scheme + '://';
|
||||
}
|
||||
} },
|
||||
|
||||
/*
|
||||
searchParams: {
|
||||
get: function() {
|
||||
var url = this._url;
|
||||
// XXX
|
||||
},
|
||||
set: function(v) {
|
||||
var output = this.href;
|
||||
var url = new URL(output);
|
||||
// XXX
|
||||
this.href = output;
|
||||
},
|
||||
},
|
||||
*/
|
||||
});
|
||||
|
||||
URLUtils._inherit = function(proto) {
|
||||
// copy getters/setters from URLUtils to o.
|
||||
Object.getOwnPropertyNames(URLUtils.prototype).forEach(function(p) {
|
||||
if (p==='constructor' || p==='href') { return; }
|
||||
var desc = Object.getOwnPropertyDescriptor(URLUtils.prototype, p);
|
||||
Object.defineProperty(proto, p, desc);
|
||||
});
|
||||
};
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var DOMImplementation = require('./DOMImplementation');
|
||||
var EventTarget = require('./EventTarget');
|
||||
var Location = require('./Location');
|
||||
var utils = require('./utils');
|
||||
|
||||
module.exports = Window;
|
||||
|
||||
function Window(document) {
|
||||
this.document = document || new DOMImplementation(null).createHTMLDocument("");
|
||||
this.document._scripting_enabled = true;
|
||||
this.document.defaultView = this;
|
||||
this.location = new Location(this, this.document._address || 'about:blank');
|
||||
}
|
||||
|
||||
Window.prototype = Object.create(EventTarget.prototype, {
|
||||
console: { value: console },
|
||||
history: { value: {
|
||||
back: utils.nyi,
|
||||
forward: utils.nyi,
|
||||
go: utils.nyi
|
||||
}},
|
||||
navigator: { value: require("./NavigatorID") },
|
||||
|
||||
// Self-referential properties
|
||||
window: { get: function() { return this; }},
|
||||
self: { get: function() { return this; }},
|
||||
frames: { get: function() { return this; }},
|
||||
|
||||
// Self-referential properties for a top-level window
|
||||
parent: { get: function() { return this; }},
|
||||
top: { get: function() { return this; }},
|
||||
|
||||
// We don't support any other windows for now
|
||||
length: { value: 0 }, // no frames
|
||||
frameElement: { value: null }, // not part of a frame
|
||||
opener: { value: null }, // not opened by another window
|
||||
|
||||
// The onload event handler.
|
||||
// XXX: need to support a bunch of other event types, too,
|
||||
// and have them interoperate with document.body.
|
||||
|
||||
onload: {
|
||||
get: function() {
|
||||
return this._getEventHandler("load");
|
||||
},
|
||||
set: function(v) {
|
||||
this._setEventHandler("load", v);
|
||||
}
|
||||
},
|
||||
|
||||
// XXX This is a completely broken implementation
|
||||
getComputedStyle: { value: function getComputedStyle(elt) {
|
||||
return elt.style;
|
||||
}}
|
||||
|
||||
});
|
||||
|
||||
utils.expose(require('./WindowTimers'), Window);
|
||||
utils.expose(require('./impl'), Window);
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers
|
||||
var WindowTimers = {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout,
|
||||
setInterval: setInterval,
|
||||
clearInterval: clearInterval
|
||||
};
|
||||
|
||||
module.exports = WindowTimers;
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
var utils = require('./utils');
|
||||
|
||||
exports.property = function(attr) {
|
||||
if (Array.isArray(attr.type)) {
|
||||
var valid = Object.create(null);
|
||||
attr.type.forEach(function(val) {
|
||||
valid[val.value || val] = val.alias || val;
|
||||
});
|
||||
var missingValueDefault = attr.missing;
|
||||
if (missingValueDefault===undefined) { missingValueDefault = null; }
|
||||
var invalidValueDefault = attr.invalid;
|
||||
if (invalidValueDefault===undefined) { invalidValueDefault = missingValueDefault; }
|
||||
return {
|
||||
get: function() {
|
||||
var v = this._getattr(attr.name);
|
||||
if (v === null) return missingValueDefault;
|
||||
|
||||
v = valid[v.toLowerCase()];
|
||||
if (v !== undefined) return v;
|
||||
if (invalidValueDefault !== null) return invalidValueDefault;
|
||||
return v;
|
||||
},
|
||||
set: function(v) {
|
||||
this._setattr(attr.name, v);
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (attr.type === Boolean) {
|
||||
return {
|
||||
get: function() {
|
||||
return this.hasAttribute(attr.name);
|
||||
},
|
||||
set: function(v) {
|
||||
if (v) {
|
||||
this._setattr(attr.name, '');
|
||||
}
|
||||
else {
|
||||
this.removeAttribute(attr.name);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (attr.type === Number ||
|
||||
attr.type === "long" ||
|
||||
attr.type === "unsigned long" ||
|
||||
attr.type === "limited unsigned long with fallback") {
|
||||
return numberPropDesc(attr);
|
||||
}
|
||||
else if (!attr.type || attr.type === String) {
|
||||
return {
|
||||
get: function() { return this._getattr(attr.name) || ''; },
|
||||
set: function(v) {
|
||||
if (attr.treatNullAsEmptyString && v === null) { v = ''; }
|
||||
this._setattr(attr.name, v);
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (typeof attr.type === 'function') {
|
||||
return attr.type(attr.name, attr);
|
||||
}
|
||||
throw new Error('Invalid attribute definition');
|
||||
};
|
||||
|
||||
// See http://www.whatwg.org/specs/web-apps/current-work/#reflect
|
||||
//
|
||||
// defval is the default value. If it is a function, then that function
|
||||
// will be invoked as a method of the element to obtain the default.
|
||||
// If no default is specified for a given attribute, then the default
|
||||
// depends on the type of the attribute, but since this function handles
|
||||
// 4 integer cases, you must specify the default value in each call
|
||||
//
|
||||
// min and max define a valid range for getting the attribute.
|
||||
//
|
||||
// setmin defines a minimum value when setting. If the value is less
|
||||
// than that, then throw INDEX_SIZE_ERR.
|
||||
//
|
||||
// Conveniently, JavaScript's parseInt function appears to be
|
||||
// compatible with HTML's 'rules for parsing integers'
|
||||
function numberPropDesc(a) {
|
||||
var def;
|
||||
if(typeof a.default === 'function') {
|
||||
def = a.default;
|
||||
}
|
||||
else if(typeof a.default === 'number') {
|
||||
def = function() { return a.default; };
|
||||
}
|
||||
else {
|
||||
def = function() { utils.assert(false, typeof a.default); };
|
||||
}
|
||||
var unsigned_long = (a.type === 'unsigned long');
|
||||
var signed_long = (a.type === 'long');
|
||||
var unsigned_fallback = (a.type === 'limited unsigned long with fallback');
|
||||
var min = a.min, max = a.max, setmin = a.setmin;
|
||||
if (min === undefined) {
|
||||
if (unsigned_long) min = 0;
|
||||
if (signed_long) min = -0x80000000;
|
||||
if (unsigned_fallback) min = 1;
|
||||
}
|
||||
if (max === undefined) {
|
||||
if (unsigned_long || signed_long || unsigned_fallback) max = 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
return {
|
||||
get: function() {
|
||||
var v = this._getattr(a.name);
|
||||
var n = a.float ? parseFloat(v) : parseInt(v, 10);
|
||||
if (v === null || !isFinite(n) || (min !== undefined && n < min) || (max !== undefined && n > max)) {
|
||||
return def.call(this);
|
||||
}
|
||||
if (unsigned_long || signed_long || unsigned_fallback) {
|
||||
if (!/^[ \t\n\f\r]*[-+]?[0-9]/.test(v)) { return def.call(this); }
|
||||
n = n|0; // jshint ignore:line
|
||||
}
|
||||
return n;
|
||||
},
|
||||
set: function(v) {
|
||||
if (!a.float) { v = Math.floor(v); }
|
||||
if (setmin !== undefined && v < setmin) {
|
||||
utils.IndexSizeError(a.name + ' set to ' + v);
|
||||
}
|
||||
if (unsigned_long) {
|
||||
v = (v < 0 || v > 0x7FFFFFFF) ? def.call(this) :
|
||||
(v|0); // jshint ignore:line
|
||||
} else if (unsigned_fallback) {
|
||||
v = (v < 1 || v > 0x7FFFFFFF) ? def.call(this) :
|
||||
(v|0); // jshint ignore:line
|
||||
} else if (signed_long) {
|
||||
v = (v < -0x80000000 || v > 0x7FFFFFFF) ? def.call(this) :
|
||||
(v|0); // jshint ignore:line
|
||||
}
|
||||
this._setattr(a.name, String(v));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// This is a utility function for setting up change handler functions
|
||||
// for attributes like 'id' that require special handling when they change.
|
||||
exports.registerChangeHandler = function(c, name, handler) {
|
||||
var p = c.prototype;
|
||||
|
||||
// If p does not already have its own _attributeChangeHandlers
|
||||
// then create one for it, inheriting from the inherited
|
||||
// _attributeChangeHandlers. At the top (for the Element class) the
|
||||
// _attributeChangeHandlers object will be created with a null prototype.
|
||||
if (!Object.prototype.hasOwnProperty.call(p, '_attributeChangeHandlers')) {
|
||||
p._attributeChangeHandlers =
|
||||
Object.create(p._attributeChangeHandlers || null);
|
||||
}
|
||||
|
||||
p._attributeChangeHandlers[name] = handler;
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This file defines Domino behaviour that can be externally configured.
|
||||
* To change these settings, set the relevant global property *before*
|
||||
* you call `require("domino")`.
|
||||
*/
|
||||
|
||||
exports.isApiWritable = !globalThis.__domino_frozen__;
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
|
||||
var attributes = require('./attributes');
|
||||
var isApiWritable = require("./config").isApiWritable;
|
||||
|
||||
module.exports = function(spec, defaultConstructor, tagList, tagNameToImpl) {
|
||||
var c = spec.ctor;
|
||||
if (c) {
|
||||
var props = spec.props || {};
|
||||
|
||||
if (spec.attributes) {
|
||||
for (var n in spec.attributes) {
|
||||
var attr = spec.attributes[n];
|
||||
if (typeof attr !== 'object' || Array.isArray(attr)) attr = {type: attr};
|
||||
if (!attr.name) attr.name = n.toLowerCase();
|
||||
props[n] = attributes.property(attr);
|
||||
}
|
||||
}
|
||||
|
||||
props.constructor = { value : c, writable: isApiWritable };
|
||||
c.prototype = Object.create((spec.superclass || defaultConstructor).prototype, props);
|
||||
if (spec.events) {
|
||||
addEventHandlers(c, spec.events);
|
||||
}
|
||||
tagList[spec.name] = c;
|
||||
}
|
||||
else {
|
||||
c = defaultConstructor;
|
||||
}
|
||||
|
||||
(spec.tags || spec.tag && [spec.tag] || []).forEach(function(tag) {
|
||||
tagNameToImpl[tag] = c;
|
||||
});
|
||||
|
||||
return c;
|
||||
};
|
||||
|
||||
function EventHandlerBuilder(body, document, form, element) {
|
||||
this.body = body;
|
||||
this.document = document;
|
||||
this.form = form;
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
EventHandlerBuilder.prototype.build = function () {
|
||||
return () => {};
|
||||
};
|
||||
|
||||
function EventHandlerChangeHandler(elt, name, oldval, newval) {
|
||||
var doc = elt.ownerDocument || Object.create(null);
|
||||
var form = elt.form || Object.create(null);
|
||||
elt[name] = new EventHandlerBuilder(newval, doc, form, elt).build();
|
||||
}
|
||||
|
||||
function addEventHandlers(c, eventHandlerTypes) {
|
||||
var p = c.prototype;
|
||||
eventHandlerTypes.forEach(function(type) {
|
||||
// Define the event handler registration IDL attribute for this type
|
||||
Object.defineProperty(p, "on" + type, {
|
||||
get: function() {
|
||||
return this._getEventHandler(type);
|
||||
},
|
||||
set: function(v) {
|
||||
this._setEventHandler(type, v);
|
||||
},
|
||||
});
|
||||
|
||||
// Define special behavior for the content attribute as well
|
||||
attributes.registerChangeHandler(c, "on" + type, EventHandlerChangeHandler);
|
||||
});
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
Event: require('./Event'),
|
||||
UIEvent: require('./UIEvent'),
|
||||
MouseEvent: require('./MouseEvent'),
|
||||
CustomEvent: require('./CustomEvent')
|
||||
};
|
||||
+1499
File diff suppressed because it is too large.
Load diff
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
var utils = require('./utils');
|
||||
|
||||
exports = module.exports = {
|
||||
CSSStyleDeclaration: require('./CSSStyleDeclaration'),
|
||||
CharacterData: require('./CharacterData'),
|
||||
Comment: require('./Comment'),
|
||||
DOMException: require('./DOMException'),
|
||||
DOMImplementation: require('./DOMImplementation'),
|
||||
DOMTokenList: require('./DOMTokenList'),
|
||||
Document: require('./Document'),
|
||||
DocumentFragment: require('./DocumentFragment'),
|
||||
DocumentType: require('./DocumentType'),
|
||||
Element: require('./Element'),
|
||||
HTMLParser: require('./HTMLParser'),
|
||||
NamedNodeMap: require('./NamedNodeMap'),
|
||||
Node: require('./Node'),
|
||||
NodeList: require('./NodeList'),
|
||||
NodeFilter: require('./NodeFilter'),
|
||||
ProcessingInstruction: require('./ProcessingInstruction'),
|
||||
Text: require('./Text'),
|
||||
Window: require('./Window')
|
||||
};
|
||||
|
||||
utils.merge(exports, require('./events'));
|
||||
utils.merge(exports, require('./htmlelts').elements);
|
||||
utils.merge(exports, require('./svg').elements);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
declare module 'domino' {
|
||||
function createDOMImplementation(): DOMImplementation;
|
||||
function createDocument(html?: string, force?: boolean): Document;
|
||||
function createWindow(html?: string, address?: string): Window;
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
var DOMImplementation = require('./DOMImplementation');
|
||||
var HTMLParser = require('./HTMLParser');
|
||||
var Window = require('./Window');
|
||||
var impl = require('./impl');
|
||||
|
||||
exports.createDOMImplementation = function() {
|
||||
return new DOMImplementation(null);
|
||||
};
|
||||
|
||||
exports.createDocument = function(html, force) {
|
||||
// Previous API couldn't let you pass '' as a document, and that
|
||||
// yields a slightly different document than createHTMLDocument('')
|
||||
// does. The new `force` parameter lets you pass '' if you want to.
|
||||
if (html || force) {
|
||||
var parser = new HTMLParser();
|
||||
parser.parse(html || '', true);
|
||||
return parser.document();
|
||||
}
|
||||
return new DOMImplementation(null).createHTMLDocument("");
|
||||
};
|
||||
|
||||
exports.createIncrementalHTMLParser = function() {
|
||||
var parser = new HTMLParser();
|
||||
/** API for incremental parser. */
|
||||
return {
|
||||
/** Provide an additional chunk of text to be parsed. */
|
||||
write: function(s) {
|
||||
if (s.length > 0) {
|
||||
parser.parse(s, false, function() { return true; });
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Signal that we are done providing input text, optionally
|
||||
* providing one last chunk as a parameter.
|
||||
*/
|
||||
end: function(s) {
|
||||
parser.parse(s || '', true, function() { return true; });
|
||||
},
|
||||
/**
|
||||
* Performs a chunk of parsing work, returning at the end of
|
||||
* the next token as soon as shouldPauseFunc() returns true.
|
||||
* Returns true iff there is more work to do.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* var incrParser = domino.createIncrementalHTMLParser();
|
||||
* incrParser.end('...long html document...');
|
||||
* while (true) {
|
||||
* // Pause every 10ms
|
||||
* var start = Date.now();
|
||||
* var pauseIn10 = function() { return (Date.now() - start) >= 10; };
|
||||
* if (!incrParser.process(pauseIn10)) {
|
||||
* break;
|
||||
* }
|
||||
* ...yield to other tasks, do other housekeeping, etc...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
process: function(shouldPauseFunc) {
|
||||
return parser.parse('', false, shouldPauseFunc);
|
||||
},
|
||||
/**
|
||||
* Returns the result of the incremental parse. Valid after
|
||||
* `this.end()` has been called and `this.process()` has returned
|
||||
* false.
|
||||
*/
|
||||
document: function() {
|
||||
return parser.document();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
exports.createWindow = function(html, address) {
|
||||
var document = exports.createDocument(html);
|
||||
if (address !== undefined) { document._address = address; }
|
||||
return new impl.Window(document);
|
||||
};
|
||||
|
||||
exports.impl = impl;
|
||||
+933
@@ -0,0 +1,933 @@
|
||||
"use strict";
|
||||
/* jshint eqnull: true */
|
||||
/**
|
||||
* Zest (https://github.com/chjj/zest)
|
||||
* A css selector engine.
|
||||
* Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed)
|
||||
* Domino version based on Zest v0.1.3 with bugfixes applied.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
var window = Object.create(null, {
|
||||
location: { get: function() {
|
||||
throw new Error('window.location is not supported.');
|
||||
} }
|
||||
});
|
||||
|
||||
var compareDocumentPosition = function(a, b) {
|
||||
return a.compareDocumentPosition(b);
|
||||
};
|
||||
|
||||
var order = function(a, b) {
|
||||
/* jshint bitwise: false */
|
||||
return compareDocumentPosition(a, b) & 2 ? 1 : -1;
|
||||
};
|
||||
|
||||
var next = function(el) {
|
||||
while ((el = el.nextSibling)
|
||||
&& el.nodeType !== 1);
|
||||
return el;
|
||||
};
|
||||
|
||||
var prev = function(el) {
|
||||
while ((el = el.previousSibling)
|
||||
&& el.nodeType !== 1);
|
||||
return el;
|
||||
};
|
||||
|
||||
var child = function(el) {
|
||||
/*jshint -W084 */
|
||||
if (el = el.firstChild) {
|
||||
while (el.nodeType !== 1
|
||||
&& (el = el.nextSibling));
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
var lastChild = function(el) {
|
||||
/*jshint -W084 */
|
||||
if (el = el.lastChild) {
|
||||
while (el.nodeType !== 1
|
||||
&& (el = el.previousSibling));
|
||||
}
|
||||
return el;
|
||||
};
|
||||
|
||||
var parentIsElement = function(n) {
|
||||
if (!n.parentNode) { return false; }
|
||||
var nodeType = n.parentNode.nodeType;
|
||||
// The root `html` element can be a first- or last-child, too.
|
||||
return nodeType === 1 || nodeType === 9;
|
||||
};
|
||||
|
||||
var unquote = function(str) {
|
||||
if (!str) return str;
|
||||
var ch = str[0];
|
||||
if (ch === '"' || ch === '\'') {
|
||||
if (str[str.length-1] === ch) {
|
||||
str = str.slice(1, -1);
|
||||
} else {
|
||||
// bad string.
|
||||
str = str.slice(1);
|
||||
}
|
||||
return str.replace(rules.str_escape, function(s) {
|
||||
var m = /^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(s);
|
||||
if (!m) { return s.slice(1); }
|
||||
if (m[2]) { return ''; /* escaped newlines are ignored in strings. */ }
|
||||
var cp = parseInt(m[1], 16);
|
||||
return String.fromCodePoint ? String.fromCodePoint(cp) :
|
||||
// Not all JavaScript implementations have String.fromCodePoint yet.
|
||||
String.fromCharCode(cp);
|
||||
});
|
||||
} else if (rules.ident.test(str)) {
|
||||
return decodeid(str);
|
||||
} else {
|
||||
// NUMBER, PERCENTAGE, DIMENSION, etc
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
var decodeid = function(str) {
|
||||
return str.replace(rules.escape, function(s) {
|
||||
var m = /^\\([0-9A-Fa-f]+)/.exec(s);
|
||||
if (!m) { return s[1]; }
|
||||
var cp = parseInt(m[1], 16);
|
||||
return String.fromCodePoint ? String.fromCodePoint(cp) :
|
||||
// Not all JavaScript implementations have String.fromCodePoint yet.
|
||||
String.fromCharCode(cp);
|
||||
});
|
||||
};
|
||||
|
||||
var indexOf = (function() {
|
||||
if (Array.prototype.indexOf) {
|
||||
return Array.prototype.indexOf;
|
||||
}
|
||||
return function(obj, item) {
|
||||
var i = this.length;
|
||||
while (i--) {
|
||||
if (this[i] === item) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
})();
|
||||
|
||||
var makeInside = function(start, end) {
|
||||
var regex = rules.inside.source
|
||||
.replace(/</g, start)
|
||||
.replace(/>/g, end);
|
||||
|
||||
return new RegExp(regex);
|
||||
};
|
||||
|
||||
var replace = function(regex, name, val) {
|
||||
regex = regex.source;
|
||||
regex = regex.replace(name, val.source || val);
|
||||
return new RegExp(regex);
|
||||
};
|
||||
|
||||
var truncateUrl = function(url, num) {
|
||||
return url
|
||||
.replace(/^(?:\w+:\/\/|\/+)/, '')
|
||||
.replace(/(?:\/+|\/*#.*?)$/, '')
|
||||
.split('/', num)
|
||||
.join('/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle `nth` Selectors
|
||||
*/
|
||||
|
||||
var parseNth = function(param_, test) {
|
||||
var param = param_.replace(/\s+/g, '')
|
||||
, cap;
|
||||
|
||||
if (param === 'even') {
|
||||
param = '2n+0';
|
||||
} else if (param === 'odd') {
|
||||
param = '2n+1';
|
||||
} else if (param.indexOf('n') === -1) {
|
||||
param = '0n' + param;
|
||||
}
|
||||
|
||||
cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param);
|
||||
|
||||
return {
|
||||
group: cap[1] === '-'
|
||||
? -(cap[2] || 1)
|
||||
: +(cap[2] || 1),
|
||||
offset: cap[4]
|
||||
? (cap[3] === '-' ? -cap[4] : +cap[4])
|
||||
: 0
|
||||
};
|
||||
};
|
||||
|
||||
var nth = function(param_, test, last) {
|
||||
var param = parseNth(param_)
|
||||
, group = param.group
|
||||
, offset = param.offset
|
||||
, find = !last ? child : lastChild
|
||||
, advance = !last ? next : prev;
|
||||
|
||||
return function(el) {
|
||||
if (!parentIsElement(el)) return;
|
||||
|
||||
var rel = find(el.parentNode)
|
||||
, pos = 0;
|
||||
|
||||
while (rel) {
|
||||
if (test(rel, el)) pos++;
|
||||
if (rel === el) {
|
||||
pos -= offset;
|
||||
return group && pos
|
||||
? (pos % group) === 0 && (pos < 0 === group < 0)
|
||||
: !pos;
|
||||
}
|
||||
rel = advance(rel);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple Selectors
|
||||
*/
|
||||
|
||||
var selectors = {
|
||||
'*': (function() {
|
||||
if (false/*function() {
|
||||
var el = document.createElement('div');
|
||||
el.appendChild(document.createComment(''));
|
||||
return !!el.getElementsByTagName('*')[0];
|
||||
}()*/) {
|
||||
return function(el) {
|
||||
if (el.nodeType === 1) return true;
|
||||
};
|
||||
}
|
||||
return function() {
|
||||
return true;
|
||||
};
|
||||
})(),
|
||||
'type': function(type) {
|
||||
type = type.toLowerCase();
|
||||
return function(el) {
|
||||
return el.nodeName.toLowerCase() === type;
|
||||
};
|
||||
},
|
||||
'attr': function(key, op, val, i) {
|
||||
op = operators[op];
|
||||
return function(el) {
|
||||
var attr;
|
||||
switch (key) {
|
||||
case 'for':
|
||||
attr = el.htmlFor;
|
||||
break;
|
||||
case 'class':
|
||||
// className is '' when non-existent
|
||||
// getAttribute('class') is null
|
||||
attr = el.className;
|
||||
if (attr === '' && el.getAttribute('class') == null) {
|
||||
attr = null;
|
||||
}
|
||||
break;
|
||||
case 'href':
|
||||
case 'src':
|
||||
attr = el.getAttribute(key, 2);
|
||||
break;
|
||||
case 'title':
|
||||
// getAttribute('title') can be '' when non-existent sometimes?
|
||||
attr = el.getAttribute('title') || null;
|
||||
break;
|
||||
// careful with attributes with special getter functions
|
||||
case 'id':
|
||||
case 'lang':
|
||||
case 'dir':
|
||||
case 'accessKey':
|
||||
case 'hidden':
|
||||
case 'tabIndex':
|
||||
case 'style':
|
||||
if (el.getAttribute) {
|
||||
attr = el.getAttribute(key);
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
default:
|
||||
if (el.hasAttribute && !el.hasAttribute(key)) {
|
||||
break;
|
||||
}
|
||||
attr = el[key] != null
|
||||
? el[key]
|
||||
: el.getAttribute && el.getAttribute(key);
|
||||
break;
|
||||
}
|
||||
if (attr == null) return;
|
||||
attr = attr + '';
|
||||
if (i) {
|
||||
attr = attr.toLowerCase();
|
||||
val = val.toLowerCase();
|
||||
}
|
||||
return op(attr, val);
|
||||
};
|
||||
},
|
||||
':first-child': function(el) {
|
||||
return !prev(el) && parentIsElement(el);
|
||||
},
|
||||
':last-child': function(el) {
|
||||
return !next(el) && parentIsElement(el);
|
||||
},
|
||||
':only-child': function(el) {
|
||||
return !prev(el) && !next(el) && parentIsElement(el);
|
||||
},
|
||||
':nth-child': function(param, last) {
|
||||
return nth(param, function() {
|
||||
return true;
|
||||
}, last);
|
||||
},
|
||||
':nth-last-child': function(param) {
|
||||
return selectors[':nth-child'](param, true);
|
||||
},
|
||||
':root': function(el) {
|
||||
return el.ownerDocument.documentElement === el;
|
||||
},
|
||||
':empty': function(el) {
|
||||
return !el.firstChild;
|
||||
},
|
||||
':not': function(sel) {
|
||||
var test = compileGroup(sel);
|
||||
return function(el) {
|
||||
return !test(el);
|
||||
};
|
||||
},
|
||||
':first-of-type': function(el) {
|
||||
if (!parentIsElement(el)) return;
|
||||
var type = el.nodeName;
|
||||
/*jshint -W084 */
|
||||
while (el = prev(el)) {
|
||||
if (el.nodeName === type) return;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
':last-of-type': function(el) {
|
||||
if (!parentIsElement(el)) return;
|
||||
var type = el.nodeName;
|
||||
/*jshint -W084 */
|
||||
while (el = next(el)) {
|
||||
if (el.nodeName === type) return;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
':only-of-type': function(el) {
|
||||
return selectors[':first-of-type'](el)
|
||||
&& selectors[':last-of-type'](el);
|
||||
},
|
||||
':nth-of-type': function(param, last) {
|
||||
return nth(param, function(rel, el) {
|
||||
return rel.nodeName === el.nodeName;
|
||||
}, last);
|
||||
},
|
||||
':nth-last-of-type': function(param) {
|
||||
return selectors[':nth-of-type'](param, true);
|
||||
},
|
||||
':checked': function(el) {
|
||||
return !!(el.checked || el.selected);
|
||||
},
|
||||
':indeterminate': function(el) {
|
||||
return !selectors[':checked'](el);
|
||||
},
|
||||
':enabled': function(el) {
|
||||
return !el.disabled && el.type !== 'hidden';
|
||||
},
|
||||
':disabled': function(el) {
|
||||
return !!el.disabled;
|
||||
},
|
||||
':target': function(el) {
|
||||
return el.id === window.location.hash.substring(1);
|
||||
},
|
||||
':focus': function(el) {
|
||||
return el === el.ownerDocument.activeElement;
|
||||
},
|
||||
':is': function(sel) {
|
||||
return compileGroup(sel);
|
||||
},
|
||||
// :matches is an older name for :is; see
|
||||
// https://github.com/w3c/csswg-drafts/issues/3258
|
||||
':matches': function(sel) {
|
||||
return selectors[':is'](sel);
|
||||
},
|
||||
':nth-match': function(param, last) {
|
||||
var args = param.split(/\s*,\s*/)
|
||||
, arg = args.shift()
|
||||
, test = compileGroup(args.join(','));
|
||||
|
||||
return nth(arg, test, last);
|
||||
},
|
||||
':nth-last-match': function(param) {
|
||||
return selectors[':nth-match'](param, true);
|
||||
},
|
||||
':links-here': function(el) {
|
||||
return el + '' === window.location + '';
|
||||
},
|
||||
':lang': function(param) {
|
||||
return function(el) {
|
||||
while (el) {
|
||||
if (el.lang) return el.lang.indexOf(param) === 0;
|
||||
el = el.parentNode;
|
||||
}
|
||||
};
|
||||
},
|
||||
':dir': function(param) {
|
||||
return function(el) {
|
||||
while (el) {
|
||||
if (el.dir) return el.dir === param;
|
||||
el = el.parentNode;
|
||||
}
|
||||
};
|
||||
},
|
||||
':scope': function(el, con) {
|
||||
var context = con || el.ownerDocument;
|
||||
if (context.nodeType === 9) {
|
||||
return el === context.documentElement;
|
||||
}
|
||||
return el === context;
|
||||
},
|
||||
':any-link': function(el) {
|
||||
return typeof el.href === 'string';
|
||||
},
|
||||
':local-link': function(el) {
|
||||
if (el.nodeName) {
|
||||
return el.href && el.host === window.location.host;
|
||||
}
|
||||
var param = +el + 1;
|
||||
return function(el) {
|
||||
if (!el.href) return;
|
||||
|
||||
var url = window.location + ''
|
||||
, href = el + '';
|
||||
|
||||
return truncateUrl(url, param) === truncateUrl(href, param);
|
||||
};
|
||||
},
|
||||
':default': function(el) {
|
||||
return !!el.defaultSelected;
|
||||
},
|
||||
':valid': function(el) {
|
||||
return el.willValidate || (el.validity && el.validity.valid);
|
||||
},
|
||||
':invalid': function(el) {
|
||||
return !selectors[':valid'](el);
|
||||
},
|
||||
':in-range': function(el) {
|
||||
return el.value > el.min && el.value <= el.max;
|
||||
},
|
||||
':out-of-range': function(el) {
|
||||
return !selectors[':in-range'](el);
|
||||
},
|
||||
':required': function(el) {
|
||||
return !!el.required;
|
||||
},
|
||||
':optional': function(el) {
|
||||
return !el.required;
|
||||
},
|
||||
':read-only': function(el) {
|
||||
if (el.readOnly) return true;
|
||||
|
||||
var attr = el.getAttribute('contenteditable')
|
||||
, prop = el.contentEditable
|
||||
, name = el.nodeName.toLowerCase();
|
||||
|
||||
name = name !== 'input' && name !== 'textarea';
|
||||
|
||||
return (name || el.disabled) && attr == null && prop !== 'true';
|
||||
},
|
||||
':read-write': function(el) {
|
||||
return !selectors[':read-only'](el);
|
||||
},
|
||||
':hover': function() {
|
||||
throw new Error(':hover is not supported.');
|
||||
},
|
||||
':active': function() {
|
||||
throw new Error(':active is not supported.');
|
||||
},
|
||||
':link': function() {
|
||||
throw new Error(':link is not supported.');
|
||||
},
|
||||
':visited': function() {
|
||||
throw new Error(':visited is not supported.');
|
||||
},
|
||||
':column': function() {
|
||||
throw new Error(':column is not supported.');
|
||||
},
|
||||
':nth-column': function() {
|
||||
throw new Error(':nth-column is not supported.');
|
||||
},
|
||||
':nth-last-column': function() {
|
||||
throw new Error(':nth-last-column is not supported.');
|
||||
},
|
||||
':current': function() {
|
||||
throw new Error(':current is not supported.');
|
||||
},
|
||||
':past': function() {
|
||||
throw new Error(':past is not supported.');
|
||||
},
|
||||
':future': function() {
|
||||
throw new Error(':future is not supported.');
|
||||
},
|
||||
// Non-standard, for compatibility purposes.
|
||||
':contains': function(param) {
|
||||
return function(el) {
|
||||
var text = el.innerText || el.textContent || el.value || '';
|
||||
return text.indexOf(param) !== -1;
|
||||
};
|
||||
},
|
||||
':has': function(param) {
|
||||
return function(el) {
|
||||
return find(param, el).length > 0;
|
||||
};
|
||||
}
|
||||
// Potentially add more pseudo selectors for
|
||||
// compatibility with sizzle and most other
|
||||
// selector engines (?).
|
||||
};
|
||||
|
||||
/**
|
||||
* Attribute Operators
|
||||
*/
|
||||
|
||||
var operators = {
|
||||
'-': function() {
|
||||
return true;
|
||||
},
|
||||
'=': function(attr, val) {
|
||||
return attr === val;
|
||||
},
|
||||
'*=': function(attr, val) {
|
||||
return attr.indexOf(val) !== -1;
|
||||
},
|
||||
'~=': function(attr, val) {
|
||||
var i
|
||||
, s
|
||||
, f
|
||||
, l;
|
||||
|
||||
for (s = 0; true; s = i + 1) {
|
||||
i = attr.indexOf(val, s);
|
||||
if (i === -1) return false;
|
||||
f = attr[i - 1];
|
||||
l = attr[i + val.length];
|
||||
if ((!f || f === ' ') && (!l || l === ' ')) return true;
|
||||
}
|
||||
},
|
||||
'|=': function(attr, val) {
|
||||
var i = attr.indexOf(val)
|
||||
, l;
|
||||
|
||||
if (i !== 0) return;
|
||||
l = attr[i + val.length];
|
||||
|
||||
return l === '-' || !l;
|
||||
},
|
||||
'^=': function(attr, val) {
|
||||
return attr.indexOf(val) === 0;
|
||||
},
|
||||
'$=': function(attr, val) {
|
||||
var i = attr.lastIndexOf(val);
|
||||
return i !== -1 && i + val.length === attr.length;
|
||||
},
|
||||
// non-standard
|
||||
'!=': function(attr, val) {
|
||||
return attr !== val;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Combinator Logic
|
||||
*/
|
||||
|
||||
var combinators = {
|
||||
' ': function(test) {
|
||||
return function(el) {
|
||||
/*jshint -W084 */
|
||||
while (el = el.parentNode) {
|
||||
if (test(el)) return el;
|
||||
}
|
||||
};
|
||||
},
|
||||
'>': function(test) {
|
||||
return function(el) {
|
||||
/*jshint -W084 */
|
||||
if (el = el.parentNode) {
|
||||
return test(el) && el;
|
||||
}
|
||||
};
|
||||
},
|
||||
'+': function(test) {
|
||||
return function(el) {
|
||||
/*jshint -W084 */
|
||||
if (el = prev(el)) {
|
||||
return test(el) && el;
|
||||
}
|
||||
};
|
||||
},
|
||||
'~': function(test) {
|
||||
return function(el) {
|
||||
/*jshint -W084 */
|
||||
while (el = prev(el)) {
|
||||
if (test(el)) return el;
|
||||
}
|
||||
};
|
||||
},
|
||||
'noop': function(test) {
|
||||
return function(el) {
|
||||
return test(el) && el;
|
||||
};
|
||||
},
|
||||
'ref': function(test, name) {
|
||||
var node;
|
||||
|
||||
function ref(el) {
|
||||
var doc = el.ownerDocument
|
||||
, nodes = doc.getElementsByTagName('*')
|
||||
, i = nodes.length;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (ref.test(el)) {
|
||||
node = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
node = null;
|
||||
}
|
||||
|
||||
ref.combinator = function(el) {
|
||||
if (!node || !node.getAttribute) return;
|
||||
|
||||
var attr = node.getAttribute(name) || '';
|
||||
if (attr[0] === '#') attr = attr.substring(1);
|
||||
|
||||
if (attr === el.id && test(node)) {
|
||||
return node;
|
||||
}
|
||||
};
|
||||
|
||||
return ref;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Grammar
|
||||
*/
|
||||
|
||||
var rules = {
|
||||
escape: /\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g,
|
||||
str_escape: /(escape)|\\(\n|\r\n?|\f)/g,
|
||||
nonascii: /[\u00A0-\uFFFF]/,
|
||||
cssid: /(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/,
|
||||
qname: /^ *(cssid|\*)/,
|
||||
simple: /^(?:([.#]cssid)|pseudo|attr)/,
|
||||
ref: /^ *\/(cssid)\/ */,
|
||||
combinator: /^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/,
|
||||
attr: /^\[(cssid)(?:([^\w]?=)(inside))?\]/,
|
||||
pseudo: /^(:cssid)(?:\((inside)\))?/,
|
||||
inside: /(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/,
|
||||
ident: /^(cssid)$/
|
||||
};
|
||||
|
||||
rules.cssid = replace(rules.cssid, 'nonascii', rules.nonascii);
|
||||
rules.cssid = replace(rules.cssid, 'escape', rules.escape);
|
||||
rules.qname = replace(rules.qname, 'cssid', rules.cssid);
|
||||
rules.simple = replace(rules.simple, 'cssid', rules.cssid);
|
||||
rules.ref = replace(rules.ref, 'cssid', rules.cssid);
|
||||
rules.attr = replace(rules.attr, 'cssid', rules.cssid);
|
||||
rules.pseudo = replace(rules.pseudo, 'cssid', rules.cssid);
|
||||
rules.inside = replace(rules.inside, '[^"\'>]*', rules.inside);
|
||||
rules.attr = replace(rules.attr, 'inside', makeInside('\\[', '\\]'));
|
||||
rules.pseudo = replace(rules.pseudo, 'inside', makeInside('\\(', '\\)'));
|
||||
rules.simple = replace(rules.simple, 'pseudo', rules.pseudo);
|
||||
rules.simple = replace(rules.simple, 'attr', rules.attr);
|
||||
rules.ident = replace(rules.ident, 'cssid', rules.cssid);
|
||||
rules.str_escape = replace(rules.str_escape, 'escape', rules.escape);
|
||||
|
||||
/**
|
||||
* Compiling
|
||||
*/
|
||||
|
||||
var compile = function(sel_) {
|
||||
var sel = sel_.replace(/^\s+|\s+$/g, '')
|
||||
, test
|
||||
, filter = []
|
||||
, buff = []
|
||||
, subject
|
||||
, qname
|
||||
, cap
|
||||
, op
|
||||
, ref;
|
||||
|
||||
/*jshint -W084 */
|
||||
while (sel) {
|
||||
if (cap = rules.qname.exec(sel)) {
|
||||
sel = sel.substring(cap[0].length);
|
||||
qname = decodeid(cap[1]);
|
||||
buff.push(tok(qname, true));
|
||||
} else if (cap = rules.simple.exec(sel)) {
|
||||
sel = sel.substring(cap[0].length);
|
||||
qname = '*';
|
||||
buff.push(tok(qname, true));
|
||||
buff.push(tok(cap));
|
||||
} else {
|
||||
throw new SyntaxError('Invalid selector.');
|
||||
}
|
||||
|
||||
while (cap = rules.simple.exec(sel)) {
|
||||
sel = sel.substring(cap[0].length);
|
||||
buff.push(tok(cap));
|
||||
}
|
||||
|
||||
if (sel[0] === '!') {
|
||||
sel = sel.substring(1);
|
||||
subject = makeSubject();
|
||||
subject.qname = qname;
|
||||
buff.push(subject.simple);
|
||||
}
|
||||
|
||||
if (cap = rules.ref.exec(sel)) {
|
||||
sel = sel.substring(cap[0].length);
|
||||
ref = combinators.ref(makeSimple(buff), decodeid(cap[1]));
|
||||
filter.push(ref.combinator);
|
||||
buff = [];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cap = rules.combinator.exec(sel)) {
|
||||
sel = sel.substring(cap[0].length);
|
||||
op = cap[1] || cap[2] || cap[3];
|
||||
if (op === ',') {
|
||||
filter.push(combinators.noop(makeSimple(buff)));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
op = 'noop';
|
||||
}
|
||||
|
||||
if (!combinators[op]) { throw new SyntaxError('Bad combinator.'); }
|
||||
filter.push(combinators[op](makeSimple(buff)));
|
||||
buff = [];
|
||||
}
|
||||
|
||||
test = makeTest(filter);
|
||||
test.qname = qname;
|
||||
test.sel = sel;
|
||||
|
||||
if (subject) {
|
||||
subject.lname = test.qname;
|
||||
|
||||
subject.test = test;
|
||||
subject.qname = subject.qname;
|
||||
subject.sel = test.sel;
|
||||
test = subject;
|
||||
}
|
||||
|
||||
if (ref) {
|
||||
ref.test = test;
|
||||
ref.qname = test.qname;
|
||||
ref.sel = test.sel;
|
||||
test = ref;
|
||||
}
|
||||
|
||||
return test;
|
||||
};
|
||||
|
||||
var tok = function(cap, qname) {
|
||||
// qname
|
||||
if (qname) {
|
||||
return cap === '*'
|
||||
? selectors['*']
|
||||
: selectors.type(cap);
|
||||
}
|
||||
|
||||
// class/id
|
||||
if (cap[1]) {
|
||||
return cap[1][0] === '.'
|
||||
// XXX unescape here? or in attr?
|
||||
? selectors.attr('class', '~=', decodeid(cap[1].substring(1)), false)
|
||||
: selectors.attr('id', '=', decodeid(cap[1].substring(1)), false);
|
||||
}
|
||||
|
||||
// pseudo-name
|
||||
// inside-pseudo
|
||||
if (cap[2]) {
|
||||
return cap[3]
|
||||
? selectors[decodeid(cap[2])](unquote(cap[3]))
|
||||
: selectors[decodeid(cap[2])];
|
||||
}
|
||||
|
||||
// attr name
|
||||
// attr op
|
||||
// attr value
|
||||
if (cap[4]) {
|
||||
var value = cap[6];
|
||||
var i = /["'\s]\s*I$/i.test(value);
|
||||
if (i) {
|
||||
value = value.replace(/\s*I$/i, '');
|
||||
}
|
||||
return selectors.attr(decodeid(cap[4]), cap[5] || '-', unquote(value), i);
|
||||
}
|
||||
|
||||
throw new SyntaxError('Unknown Selector.');
|
||||
};
|
||||
|
||||
var makeSimple = function(func) {
|
||||
var l = func.length
|
||||
, i;
|
||||
|
||||
// Potentially make sure
|
||||
// `el` is truthy.
|
||||
if (l < 2) return func[0];
|
||||
|
||||
return function(el) {
|
||||
if (!el) return;
|
||||
for (i = 0; i < l; i++) {
|
||||
if (!func[i](el)) return;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
var makeTest = function(func) {
|
||||
if (func.length < 2) {
|
||||
return function(el) {
|
||||
return !!func[0](el);
|
||||
};
|
||||
}
|
||||
return function(el) {
|
||||
var i = func.length;
|
||||
while (i--) {
|
||||
if (!(el = func[i](el))) return;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
var makeSubject = function() {
|
||||
var target;
|
||||
|
||||
function subject(el) {
|
||||
var node = el.ownerDocument
|
||||
, scope = node.getElementsByTagName(subject.lname)
|
||||
, i = scope.length;
|
||||
|
||||
while (i--) {
|
||||
if (subject.test(scope[i]) && target === el) {
|
||||
target = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
target = null;
|
||||
}
|
||||
|
||||
subject.simple = function(el) {
|
||||
target = el;
|
||||
return true;
|
||||
};
|
||||
|
||||
return subject;
|
||||
};
|
||||
|
||||
var compileGroup = function(sel) {
|
||||
var test = compile(sel)
|
||||
, tests = [ test ];
|
||||
|
||||
while (test.sel) {
|
||||
test = compile(test.sel);
|
||||
tests.push(test);
|
||||
}
|
||||
|
||||
if (tests.length < 2) return test;
|
||||
|
||||
return function(el) {
|
||||
var l = tests.length
|
||||
, i = 0;
|
||||
|
||||
for (; i < l; i++) {
|
||||
if (tests[i](el)) return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Selection
|
||||
*/
|
||||
|
||||
var find = function(sel, node) {
|
||||
var results = []
|
||||
, test = compile(sel)
|
||||
, scope = node.getElementsByTagName(test.qname)
|
||||
, i = 0
|
||||
, el;
|
||||
|
||||
/*jshint -W084 */
|
||||
while (el = scope[i++]) {
|
||||
if (test(el)) results.push(el);
|
||||
}
|
||||
|
||||
if (test.sel) {
|
||||
while (test.sel) {
|
||||
test = compile(test.sel);
|
||||
scope = node.getElementsByTagName(test.qname);
|
||||
i = 0;
|
||||
/*jshint -W084 */
|
||||
while (el = scope[i++]) {
|
||||
if (test(el) && indexOf.call(results, el) === -1) {
|
||||
results.push(el);
|
||||
}
|
||||
}
|
||||
}
|
||||
results.sort(order);
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose
|
||||
*/
|
||||
|
||||
module.exports = exports = function(sel, context) {
|
||||
/* when context isn't a DocumentFragment and the selector is simple: */
|
||||
var id, r;
|
||||
if (context.nodeType !== 11 && sel.indexOf(' ') === -1) {
|
||||
if (sel[0] === '#' && context.rooted && /^#[A-Z_][-A-Z0-9_]*$/i.test(sel)) {
|
||||
if (context.doc._hasMultipleElementsWithId) {
|
||||
id = sel.substring(1);
|
||||
if (!context.doc._hasMultipleElementsWithId(id)) {
|
||||
r = context.doc.getElementById(id);
|
||||
return r ? [r] : [];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sel[0] === '.' && /^\.\w+$/.test(sel)) {
|
||||
return context.getElementsByClassName(sel.substring(1));
|
||||
}
|
||||
if (/^\w+$/.test(sel)) {
|
||||
return context.getElementsByTagName(sel);
|
||||
}
|
||||
}
|
||||
/* do things the hard/slow way */
|
||||
return find(sel, context);
|
||||
};
|
||||
|
||||
exports.selectors = selectors;
|
||||
exports.operators = operators;
|
||||
exports.combinators = combinators;
|
||||
|
||||
exports.matches = function(el, sel) {
|
||||
var test = { sel: sel };
|
||||
do {
|
||||
test = compile(test.sel);
|
||||
if (test(el)) { return true; }
|
||||
} while (test.sel);
|
||||
return false;
|
||||
};
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
// The below is a compiled copy of https://github.com/angular/angular/blob/92e41e9cb417223d9888a4c23b4c0e73188f87d0/packages/compiler/src/render3/view/style_parser.ts
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hyphenate = exports.parse = void 0;
|
||||
/**
|
||||
* Parses string representation of a style and converts it into object literal.
|
||||
*
|
||||
* @param value string representation of style as used in the `style` attribute in HTML.
|
||||
* Example: `color: red; height: auto`.
|
||||
* @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height',
|
||||
* 'auto']`
|
||||
*/
|
||||
function parse(value) {
|
||||
// we use a string array here instead of a string map
|
||||
// because a string-map is not guaranteed to retain the
|
||||
// order of the entries whereas a string array can be
|
||||
// constructed in a [key, value, key, value] format.
|
||||
const styles = [];
|
||||
let i = 0;
|
||||
let parenDepth = 0;
|
||||
let quote = 0; /* Char.QuoteNone */
|
||||
let valueStart = 0;
|
||||
let propStart = 0;
|
||||
let currentProp = null;
|
||||
while (i < value.length) {
|
||||
const token = value.charCodeAt(i++);
|
||||
switch (token) {
|
||||
case 40 /* Char.OpenParen */:
|
||||
parenDepth++;
|
||||
break;
|
||||
case 41 /* Char.CloseParen */:
|
||||
parenDepth--;
|
||||
break;
|
||||
case 39 /* Char.QuoteSingle */:
|
||||
// valueStart needs to be there since prop values don't
|
||||
// have quotes in CSS
|
||||
if (quote === 0 /* Char.QuoteNone */) {
|
||||
quote = 39 /* Char.QuoteSingle */;
|
||||
} else if (
|
||||
quote === 39 /* Char.QuoteSingle */ &&
|
||||
value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */
|
||||
) {
|
||||
quote = 0 /* Char.QuoteNone */;
|
||||
}
|
||||
break;
|
||||
case 34 /* Char.QuoteDouble */:
|
||||
// same logic as above
|
||||
if (quote === 0 /* Char.QuoteNone */) {
|
||||
quote = 34 /* Char.QuoteDouble */;
|
||||
} else if (
|
||||
quote === 34 /* Char.QuoteDouble */ &&
|
||||
value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */
|
||||
) {
|
||||
quote = 0 /* Char.QuoteNone */;
|
||||
}
|
||||
break;
|
||||
case 58 /* Char.Colon */:
|
||||
if (
|
||||
!currentProp &&
|
||||
parenDepth === 0 &&
|
||||
quote === 0 /* Char.QuoteNone */
|
||||
) {
|
||||
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
||||
valueStart = i;
|
||||
}
|
||||
break;
|
||||
case 59 /* Char.Semicolon */:
|
||||
if (
|
||||
currentProp &&
|
||||
valueStart > 0 &&
|
||||
parenDepth === 0 &&
|
||||
quote === 0 /* Char.QuoteNone */
|
||||
) {
|
||||
const styleVal = value.substring(valueStart, i - 1).trim();
|
||||
styles.push(currentProp, styleVal);
|
||||
propStart = i;
|
||||
valueStart = 0;
|
||||
currentProp = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentProp && valueStart) {
|
||||
const styleVal = value.slice(valueStart).trim();
|
||||
styles.push(currentProp, styleVal);
|
||||
}
|
||||
return styles;
|
||||
}
|
||||
exports.parse = parse;
|
||||
function hyphenate(value) {
|
||||
return value
|
||||
.replace(/[a-z][A-Z]/g, (v) => {
|
||||
return v.charAt(0) + "-" + v.charAt(1);
|
||||
})
|
||||
.toLowerCase();
|
||||
}
|
||||
exports.hyphenate = hyphenate;
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var Element = require('./Element');
|
||||
var defineElement = require('./defineElement');
|
||||
var utils = require('./utils');
|
||||
var CSSStyleDeclaration = require('./CSSStyleDeclaration');
|
||||
|
||||
var svgElements = exports.elements = {};
|
||||
var svgNameToImpl = Object.create(null);
|
||||
|
||||
exports.createElement = function(doc, localName, prefix) {
|
||||
var impl = svgNameToImpl[localName] || SVGElement;
|
||||
return new impl(doc, localName, prefix);
|
||||
};
|
||||
|
||||
function define(spec) {
|
||||
return defineElement(spec, SVGElement, svgElements, svgNameToImpl);
|
||||
}
|
||||
|
||||
var SVGElement = define({
|
||||
superclass: Element,
|
||||
name: 'SVGElement',
|
||||
ctor: function SVGElement(doc, localName, prefix) {
|
||||
Element.call(this, doc, localName, utils.NAMESPACE.SVG, prefix);
|
||||
},
|
||||
props: {
|
||||
style: { get: function() {
|
||||
if (!this._style)
|
||||
this._style = new CSSStyleDeclaration(this);
|
||||
return this._style;
|
||||
}}
|
||||
}
|
||||
});
|
||||
|
||||
define({
|
||||
name: 'SVGSVGElement',
|
||||
ctor: function SVGSVGElement(doc, localName, prefix) {
|
||||
SVGElement.call(this, doc, localName, prefix);
|
||||
},
|
||||
tag: 'svg',
|
||||
props: {
|
||||
createSVGRect: { value: function () {
|
||||
return exports.createElement(this.ownerDocument, 'rect', null);
|
||||
} }
|
||||
}
|
||||
});
|
||||
|
||||
define({
|
||||
tags: [
|
||||
'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
|
||||
'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',
|
||||
'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight',
|
||||
'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode',
|
||||
'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter',
|
||||
'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignObject', 'g',
|
||||
'glyph', 'glyphRef', 'hkern', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph',
|
||||
'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style',
|
||||
'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern'
|
||||
]
|
||||
});
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
var DOMException = require('./DOMException');
|
||||
var ERR = DOMException;
|
||||
var isApiWritable = require("./config").isApiWritable;
|
||||
|
||||
exports.NAMESPACE = {
|
||||
HTML: 'http://www.w3.org/1999/xhtml',
|
||||
XML: 'http://www.w3.org/XML/1998/namespace',
|
||||
XMLNS: 'http://www.w3.org/2000/xmlns/',
|
||||
MATHML: 'http://www.w3.org/1998/Math/MathML',
|
||||
SVG: 'http://www.w3.org/2000/svg',
|
||||
XLINK: 'http://www.w3.org/1999/xlink'
|
||||
};
|
||||
|
||||
//
|
||||
// Shortcut functions for throwing errors of various types.
|
||||
//
|
||||
exports.IndexSizeError = function() { throw new DOMException(ERR.INDEX_SIZE_ERR); };
|
||||
exports.HierarchyRequestError = function() { throw new DOMException(ERR.HIERARCHY_REQUEST_ERR); };
|
||||
exports.WrongDocumentError = function() { throw new DOMException(ERR.WRONG_DOCUMENT_ERR); };
|
||||
exports.InvalidCharacterError = function() { throw new DOMException(ERR.INVALID_CHARACTER_ERR); };
|
||||
exports.NoModificationAllowedError = function() { throw new DOMException(ERR.NO_MODIFICATION_ALLOWED_ERR); };
|
||||
exports.NotFoundError = function() { throw new DOMException(ERR.NOT_FOUND_ERR); };
|
||||
exports.NotSupportedError = function() { throw new DOMException(ERR.NOT_SUPPORTED_ERR); };
|
||||
exports.InvalidStateError = function() { throw new DOMException(ERR.INVALID_STATE_ERR); };
|
||||
exports.SyntaxError = function() { throw new DOMException(ERR.SYNTAX_ERR); };
|
||||
exports.InvalidModificationError = function() { throw new DOMException(ERR.INVALID_MODIFICATION_ERR); };
|
||||
exports.NamespaceError = function() { throw new DOMException(ERR.NAMESPACE_ERR); };
|
||||
exports.InvalidAccessError = function() { throw new DOMException(ERR.INVALID_ACCESS_ERR); };
|
||||
exports.TypeMismatchError = function() { throw new DOMException(ERR.TYPE_MISMATCH_ERR); };
|
||||
exports.SecurityError = function() { throw new DOMException(ERR.SECURITY_ERR); };
|
||||
exports.NetworkError = function() { throw new DOMException(ERR.NETWORK_ERR); };
|
||||
exports.AbortError = function() { throw new DOMException(ERR.ABORT_ERR); };
|
||||
exports.UrlMismatchError = function() { throw new DOMException(ERR.URL_MISMATCH_ERR); };
|
||||
exports.QuotaExceededError = function() { throw new DOMException(ERR.QUOTA_EXCEEDED_ERR); };
|
||||
exports.TimeoutError = function() { throw new DOMException(ERR.TIMEOUT_ERR); };
|
||||
exports.InvalidNodeTypeError = function() { throw new DOMException(ERR.INVALID_NODE_TYPE_ERR); };
|
||||
exports.DataCloneError = function() { throw new DOMException(ERR.DATA_CLONE_ERR); };
|
||||
|
||||
exports.nyi = function() {
|
||||
throw new Error("NotYetImplemented");
|
||||
};
|
||||
|
||||
exports.shouldOverride = function() {
|
||||
throw new Error("Abstract function; should be overriding in subclass.");
|
||||
};
|
||||
|
||||
exports.assert = function(expr, msg) {
|
||||
if (!expr) {
|
||||
throw new Error("Assertion failed: " + (msg || "") + "\n" + new Error().stack);
|
||||
}
|
||||
};
|
||||
|
||||
exports.expose = function(src, c) {
|
||||
for (var n in src) {
|
||||
Object.defineProperty(c.prototype, n, { value: src[n], writable: isApiWritable });
|
||||
}
|
||||
};
|
||||
|
||||
exports.merge = function(a, b) {
|
||||
for (var n in b) {
|
||||
a[n] = b[n];
|
||||
}
|
||||
};
|
||||
|
||||
// Compare two nodes based on their document order. This function is intended
|
||||
// to be passed to sort(). Assumes that the array being sorted does not
|
||||
// contain duplicates. And that all nodes are connected and comparable.
|
||||
// Clever code by ppk via jeresig.
|
||||
exports.documentOrder = function(n,m) {
|
||||
/* jshint bitwise: false */
|
||||
return 3 - (n.compareDocumentPosition(m) & 6);
|
||||
};
|
||||
|
||||
exports.toASCIILowerCase = function(s) {
|
||||
return s.replace(/[A-Z]+/g, function(c) {
|
||||
return c.toLowerCase();
|
||||
});
|
||||
};
|
||||
|
||||
exports.toASCIIUpperCase = function(s) {
|
||||
return s.replace(/[a-z]+/g, function(c) {
|
||||
return c.toUpperCase();
|
||||
});
|
||||
};
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
// This grammar is from the XML and XML Namespace specs. It specifies whether
|
||||
// a string (such as an element or attribute name) is a valid Name or QName.
|
||||
//
|
||||
// Name ::= NameStartChar (NameChar)*
|
||||
// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] |
|
||||
// [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] |
|
||||
// [#x370-#x37D] | [#x37F-#x1FFF] |
|
||||
// [#x200C-#x200D] | [#x2070-#x218F] |
|
||||
// [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
|
||||
// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] |
|
||||
// [#x10000-#xEFFFF]
|
||||
//
|
||||
// NameChar ::= NameStartChar | "-" | "." | [0-9] |
|
||||
// #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
||||
//
|
||||
// QName ::= PrefixedName| UnprefixedName
|
||||
// PrefixedName ::= Prefix ':' LocalPart
|
||||
// UnprefixedName ::= LocalPart
|
||||
// Prefix ::= NCName
|
||||
// LocalPart ::= NCName
|
||||
// NCName ::= Name - (Char* ':' Char*)
|
||||
// # An XML Name, minus the ":"
|
||||
//
|
||||
|
||||
exports.isValidName = isValidName;
|
||||
exports.isValidQName = isValidQName;
|
||||
|
||||
// Most names will be ASCII only. Try matching against simple regexps first
|
||||
var simplename = /^[_:A-Za-z][-.:\w]+$/;
|
||||
var simpleqname = /^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/;
|
||||
|
||||
// If the regular expressions above fail, try more complex ones that work
|
||||
// for any identifiers using codepoints from the Unicode BMP
|
||||
var ncnamestartchars = "_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
|
||||
var ncnamechars = "-._A-Za-z0-9\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203f\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
|
||||
|
||||
var ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*";
|
||||
var namestartchars = ncnamestartchars + ":";
|
||||
var namechars = ncnamechars + ":";
|
||||
var name = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$");
|
||||
var qname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$");
|
||||
|
||||
// XML says that these characters are also legal:
|
||||
// [#x10000-#xEFFFF]. So if the patterns above fail, and the
|
||||
// target string includes surrogates, then try the following
|
||||
// patterns that allow surrogates and then run an extra validation
|
||||
// step to make sure that the surrogates are in valid pairs and in
|
||||
// the right range. Note that since the characters \uf0000 to \u1f0000
|
||||
// are not allowed, it means that the high surrogate can only go up to
|
||||
// \uDB7f instead of \uDBFF.
|
||||
var hassurrogates = /[\uD800-\uDB7F\uDC00-\uDFFF]/;
|
||||
var surrogatechars = /[\uD800-\uDB7F\uDC00-\uDFFF]/g;
|
||||
var surrogatepairs = /[\uD800-\uDB7F][\uDC00-\uDFFF]/g;
|
||||
|
||||
// Modify the variables above to allow surrogates
|
||||
ncnamestartchars += "\uD800-\uDB7F\uDC00-\uDFFF";
|
||||
ncnamechars += "\uD800-\uDB7F\uDC00-\uDFFF";
|
||||
ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*";
|
||||
namestartchars = ncnamestartchars + ":";
|
||||
namechars = ncnamechars + ":";
|
||||
|
||||
// Build another set of regexps that include surrogates
|
||||
var surrogatename = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$");
|
||||
var surrogateqname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$");
|
||||
|
||||
function isValidName(s) {
|
||||
if (simplename.test(s)) return true; // Plain ASCII
|
||||
if (name.test(s)) return true; // Unicode BMP
|
||||
|
||||
// Maybe the tests above failed because s includes surrogate pairs
|
||||
// Most likely, though, they failed for some more basic syntax problem
|
||||
if (!hassurrogates.test(s)) return false;
|
||||
|
||||
// Is the string a valid name if we allow surrogates?
|
||||
if (!surrogatename.test(s)) return false;
|
||||
|
||||
// Finally, are the surrogates all correctly paired up?
|
||||
var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs);
|
||||
return pairs !== null && 2*pairs.length === chars.length;
|
||||
}
|
||||
|
||||
function isValidQName(s) {
|
||||
if (simpleqname.test(s)) return true; // Plain ASCII
|
||||
if (qname.test(s)) return true; // Unicode BMP
|
||||
|
||||
if (!hassurrogates.test(s)) return false;
|
||||
if (!surrogateqname.test(s)) return false;
|
||||
var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs);
|
||||
return pairs !== null && 2*pairs.length === chars.length;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@mixmark-io/domino",
|
||||
"version": "2.2.0",
|
||||
"license": "BSD-2-Clause",
|
||||
"author": "Felix Gnass <fgnass@gmail.com>",
|
||||
"description": "Server-side DOM implementation based on Mozilla's dom.js",
|
||||
"main": "./lib",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mixmark-io/domino.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"types": "lib/index.d.ts",
|
||||
"devDependencies": {
|
||||
"jquery": "^3.5.1",
|
||||
"mocha": "^6.2.3",
|
||||
"puppeteer": "^21.3.5",
|
||||
"should": "^13.2.3"
|
||||
}
|
||||
}
|
||||
+1500
File diff suppressed because it is too large.
Load diff
+13
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1 id="lorem">Lore Ipsum</h1>
|
||||
<p>
|
||||
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam quis risus eget urna mollis ornare vel eu leo. Donec <a href="https://github.com">git</a> ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.
|
||||
</p>
|
||||
<p class="foo">
|
||||
Cras mattis <tt class="foo">consectetur</tt> purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor <tt class="foo bar baz">ligula</tt>, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla. Donec ullamcorper nulla non metus auctor fringilla.
|
||||
</p>
|
||||
<div id="tw"><div id="hello">Hello <em id="world" title="World: The Title">World</em></div>ignore<div id="foo" title="Foo: The Title">Foo, <strong id="bar">bar</strong></div></div>
|
||||
</body>
|
||||
</html>
|
||||
+9597
File diff suppressed because it is too large.
Load diff
+9831
File diff suppressed because it is too large.
Load diff
+80692
File diff suppressed because it is too large.
Load diff
+2
@@ -0,0 +1,2 @@
|
||||
exports.w3c = require('./w3c');
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
var domino = require('../');
|
||||
var html5lib_tests = require('./html5lib-tests.json');
|
||||
|
||||
// These test cases are taken from the `html5lib/html5lib-tests` package
|
||||
// on github, in the directory `tree-construction`. The filename in that
|
||||
// directory is the name of each suite of tests.
|
||||
|
||||
function cases(filename, tc) {
|
||||
return tc.filter(function(test) {
|
||||
// We don't support some of these test cases...
|
||||
if (test.fragment && test.fragment.ns) { return false; }
|
||||
// Scripting is always enabled in domino.
|
||||
if (test.script === 'off') { return false; }
|
||||
return true;
|
||||
}).reduce(function(r, test) {
|
||||
var input = test.data, expected = test.document.html,
|
||||
fragment = test.fragment && test.fragment.name;
|
||||
// Come up with a helpful name for the testcase.
|
||||
var trimmed = input, n, candidate;
|
||||
if (trimmed==='') { trimmed = '{no input}'; }
|
||||
if (fragment) { trimmed = fragment + ':' + trimmed; }
|
||||
if (r[trimmed]) {
|
||||
//console.warn("Duplicate test in "+filename+": "+trimmed);
|
||||
}
|
||||
for (n = 40; n < trimmed.length; n += 5) {
|
||||
candidate = trimmed.slice(0, n) + '...';
|
||||
if (!r[candidate]) { trimmed = candidate; break; }
|
||||
}
|
||||
if (/\n/.test(trimmed)) {
|
||||
candidate = trimmed.split(/\n/)[0] + '...';
|
||||
if (!r[candidate]) { trimmed = candidate; }
|
||||
}
|
||||
r[trimmed] = makeOneTest(fragment, input, expected);
|
||||
return r;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function makeOneTest(fragment, input, expected) {
|
||||
return function() {
|
||||
var doc, context;
|
||||
if (fragment) {
|
||||
doc = domino.createDocument();
|
||||
context = (fragment==='body') ? doc.body : doc.createElement(fragment);
|
||||
context.innerHTML = input;
|
||||
context.innerHTML.should.equal(expected);
|
||||
} else {
|
||||
doc = domino.createDocument(input, true);
|
||||
doc.outerHTML.should.equal(expected);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.parseAlgorithm = Object.keys(html5lib_tests).reduce(function(r, file) {
|
||||
r[file] = cases(file, html5lib_tests[file]);
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
// Some extra tests.
|
||||
|
||||
// https://github.com/html5lib/html5lib-tests/issues/20
|
||||
exports.parseAlgorithm['github issue #20'] = {
|
||||
'test1': makeOneTest(
|
||||
'body', '<table><li><li></table>', '<li></li><li></li><table></table>'
|
||||
)
|
||||
};
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Process entities.json from the HTML5 spec into an array and regular
|
||||
* expression suitable for use in domino's HTMLParser.js implementation.
|
||||
*/
|
||||
var entities_json = process.argv[2];
|
||||
var entities = require(path.resolve(__dirname, entities_json));
|
||||
var keys = Object.keys(entities).map(function(s) {
|
||||
console.assert(s[0] === '&');
|
||||
return s.slice(1); // Don't include leading '&'
|
||||
}).sort();
|
||||
|
||||
var s = '';
|
||||
s += '/*\n';
|
||||
s += ' * This table is generated with test/tools/update-entities.js\n';
|
||||
s += ' */\n';
|
||||
s += 'var namedCharRefs = {\n __proto__: null,\n';
|
||||
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
if (i%2==0) { s+=' '; } else { s += ' '; }
|
||||
s += JSON.stringify(keys[i]);
|
||||
s += ':';
|
||||
var c = entities['&' + keys[i]].characters;
|
||||
if (c.length === 1) {
|
||||
s += '0x' + c.charCodeAt(0).toString(16);
|
||||
} else {
|
||||
s += '[';
|
||||
for (var j=0; j<c.length; j++) {
|
||||
if (j>0) { s+=','; }
|
||||
s += '0x' + c.charCodeAt(j).toString(16);
|
||||
}
|
||||
s += ']';
|
||||
}
|
||||
s += ',';
|
||||
if (i%2==1 || i===keys.length-1) { s+='\n'; }
|
||||
}
|
||||
s += '};\n';
|
||||
|
||||
// Construct a regular expression matching exactly the keys of this table.
|
||||
var esc = function(s) { return s.replace(/[\^\\$*+?.()|{}\[\]\/]/g, '\\$&'); };
|
||||
var prefix = function(keys) {
|
||||
console.assert(keys.length>0 && keys[0].length>0);
|
||||
var first = '', subkeys, accept;
|
||||
var result = [];
|
||||
var emit = function() {
|
||||
if (first==='') { return; }
|
||||
var sub = subkeys.length > 0 ? prefix(subkeys) : [];
|
||||
if (accept) { sub.push(''); }
|
||||
sub = sub.length>1 ? ('(?:' + sub.join('|') + ')') : sub[0];
|
||||
if (sub==='(?:;|)') { sub = ';?'; /* optimization */ }
|
||||
result.push(esc(first) + sub);
|
||||
};
|
||||
for (var i=0; i<keys.length; i++) {
|
||||
if (keys[i][0] !== first) {
|
||||
emit();
|
||||
first = keys[i][0];
|
||||
subkeys = [];
|
||||
accept = false;
|
||||
}
|
||||
if (keys[i].length>1) {
|
||||
subkeys.push(keys[i].slice(1));
|
||||
} else {
|
||||
accept = true;
|
||||
}
|
||||
}
|
||||
emit();
|
||||
return result;
|
||||
};
|
||||
var re = prefix(keys).join('|');
|
||||
s += '/*\n';
|
||||
s += ' * This regexp is generated with test/tools/update-entities.js\n';
|
||||
s += ' * It will always match at least one character -- but note that there\n';
|
||||
s += ' * are no entities whose names are a single character long.\n';
|
||||
s += ' */\n';
|
||||
s += 'var NAMEDCHARREF = /(' + re + ')|[\\s\\S]/g;\n';
|
||||
|
||||
// Verify the property mentioned in the comment above.
|
||||
var lens = keys.map(function(s) { return s.length; });
|
||||
var minlen = Math.min.apply(Math, lens);
|
||||
var maxlen = Math.max.apply(Math, lens);
|
||||
console.assert(minlen > 1);
|
||||
|
||||
s += '\nvar NAMEDCHARREF_MAXLEN = ' + maxlen + ';\n';
|
||||
|
||||
// Emit the result
|
||||
console.log(s);
|
||||
+355
@@ -0,0 +1,355 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var process = require('process');
|
||||
var domino = require('../../');
|
||||
|
||||
/** Rebuild test/html5lib-tests.json based on the test specifications in
|
||||
* the html5lib-tests submodule.
|
||||
*/
|
||||
|
||||
var NAMESPACE = {
|
||||
html: 'http://www.w3.org/1999/xhtml',
|
||||
xml: 'http://www.w3.org/XML/1998/namespace',
|
||||
xmlns: 'http://www.w3.org/2000/xmlns/',
|
||||
math: 'http://www.w3.org/1998/Math/MathML',
|
||||
svg: 'http://www.w3.org/2000/svg',
|
||||
xlink: 'http://www.w3.org/1999/xlink'
|
||||
};
|
||||
// menuitem is no longer EMPTY, see https://github.com/whatwg/html/pull/907
|
||||
// This list comes from https://html.spec.whatwg.org/multipage/syntax.html#serialising-html-fragments
|
||||
var EMPTY = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
bgsound: true,
|
||||
br: true,
|
||||
col: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
hr: true,
|
||||
img: true,
|
||||
input: true,
|
||||
keygen: true,
|
||||
link: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
source: true,
|
||||
track: true,
|
||||
wbr: true
|
||||
};
|
||||
var EXTRA_NL = {
|
||||
/* Removed in https://github.com/whatwg/html/issues/944
|
||||
pre: true,
|
||||
textarea: true,
|
||||
listing: true
|
||||
*/
|
||||
};
|
||||
var NO_ESCAPE = {
|
||||
style: true, script: true, xmp:true, iframe:true, noembed:true,
|
||||
noframes:true, plaintext:true,
|
||||
noscript: true // <- assumes that scripting is enabled.
|
||||
};
|
||||
|
||||
var localname = function(namestring) {
|
||||
return namestring.replace(/^(svg|math|xlink|xml|xmlns) /, '');
|
||||
};
|
||||
var namespace = function(namestring) {
|
||||
var m = /^(svg|math|xlink|xml|xmlns) /.exec(namestring);
|
||||
// Save some space by using 'undefined' to represent the html namespace.
|
||||
return m ? NAMESPACE[m[1]] : undefined/*NAMESPACE.html*/;
|
||||
};
|
||||
|
||||
var ParseError = function ParseError(desc, filename, input) {
|
||||
Error.call(this);
|
||||
this.name = this.constructor.name;
|
||||
this.message = desc + ' ['+filename+']: ' + JSON.stringify(input);
|
||||
};
|
||||
ParseError.prototype = Object.create(Error.prototype);
|
||||
ParseError.prototype.constructor = ParseError;
|
||||
|
||||
|
||||
var list_tests = function() {
|
||||
var base = path.join(__dirname, '..', 'html5lib-tests', 'tree-construction');
|
||||
var testfiles = fs.readdirSync(base).filter(function(filename) {
|
||||
return /\.dat$/.test(filename);
|
||||
}).map(function(f) { return path.normalize(path.join(base, f)); });
|
||||
testfiles.sort();
|
||||
return testfiles;
|
||||
};
|
||||
|
||||
var parse_test_file = function(filename) {
|
||||
var basename = path.basename(filename, '.dat');
|
||||
var cases = fs.readFileSync(filename, 'utf8').replace(/\n$/,'')
|
||||
.split(/\n\n(?=#data\n)/g);
|
||||
return cases.map(function(c) {
|
||||
return twiddle_test(basename, parse_one_test(basename, c));
|
||||
});
|
||||
};
|
||||
|
||||
var parse_one_test = function(filename, testcase) {
|
||||
var m = /^#data\n(?:([^]*?)\n)?(?:#script-(on|off)\n)?#errors\n((?:[^\n]*\n)*?)(?:#document-fragment\n([^\n]*)\n)?(?:#script-(on|off)\n)?#document\n([^]*?)$/.exec(testcase+'\n');
|
||||
if (!m) {
|
||||
throw new ParseError("Can't parse test case", filename, testcase);
|
||||
}
|
||||
// According to the README, there should always be at least two newlines
|
||||
// between #data and #errors, but some test cases have only one.
|
||||
// `data` will be null in that case.
|
||||
var fragment = m[4] ? { name: localname(m[4]), ns:namespace(m[4]) } :
|
||||
undefined;
|
||||
return {
|
||||
//file: filename,
|
||||
data: m[1] || '',
|
||||
errors: m[3].split(/\n/g).slice(0,-1),
|
||||
fragment: fragment,
|
||||
script: m[2] || m[5],
|
||||
document: serialize_doc(filename, fragment, m[6])
|
||||
};
|
||||
};
|
||||
|
||||
// Parse the node tree spec, emitting a serialized output string as well
|
||||
// as a JSON representation of the tree.
|
||||
var serialize_doc = function(filename, fragment, doc) {
|
||||
var result = "", stack = [], can_add_attr = false, props = {tags:{}};
|
||||
var root = { children: [] }, parent, obj;
|
||||
if (fragment) { root.tag = fragment.name; root.ns = fragment.ns; }
|
||||
var clear_add_attr = function() {
|
||||
if (can_add_attr) {
|
||||
result += '>';
|
||||
can_add_attr = false;
|
||||
}
|
||||
};
|
||||
var pop_stack = function() {
|
||||
clear_add_attr();
|
||||
var old = stack.pop();
|
||||
if (old.content !== true) {
|
||||
if (old.ns===namespace('html') && EMPTY[old.tag]) {
|
||||
if (old.children.length > 0) {
|
||||
throw new ParseError("Empty elements ("+old.tag+") can't have children",
|
||||
filename, doc);
|
||||
}
|
||||
} else {
|
||||
result += '</' + old.tag + '>';
|
||||
}
|
||||
}
|
||||
// save some space in the JSON output by omitting empty lists
|
||||
if (old.children.length===0) { old.children = undefined; }
|
||||
if (old.attrs && old.attrs.length===0) { old.attrs = undefined; }
|
||||
return old;
|
||||
};
|
||||
var stack_top = function() {
|
||||
if (stack.length === 0) { return root; }
|
||||
return stack[stack.length-1];
|
||||
};
|
||||
var escape = function(s) {
|
||||
return s.replace(/[&<>\u00A0]/g, function(c) {
|
||||
switch(c) {
|
||||
case '&': return '&';
|
||||
case '<': return '<';
|
||||
case '>': return '>';
|
||||
case '\u00A0': return ' ';
|
||||
}
|
||||
});
|
||||
};
|
||||
var escapeAttr = function(s) {
|
||||
return s.replace(/[&"\u00A0]/g, function(c) {
|
||||
switch(c) {
|
||||
case '&': return '&';
|
||||
case '"': return '"';
|
||||
case '\u00A0': return ' ';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
while (doc.length > 0) {
|
||||
var m = /^\| ((?: )*)(?:<([^!?>][^>]*)>|([^="\n][^=\n]*)="([^"]*)"|"((?:[^"]|"(?!\n))*)"|<!-- ((?:[^](?!-->))*) -->|<!DOCTYPE ([^>]*)>|<\?([^>]+)>|(content))\n/.exec(doc);
|
||||
if (!m) {
|
||||
throw new ParseError('Bad document line', filename, doc);
|
||||
}
|
||||
doc = doc.slice(m[0].length);
|
||||
var indent = m[1].length / 2;
|
||||
while (indent < stack.length) {
|
||||
pop_stack();
|
||||
}
|
||||
if (indent !== stack.length) {
|
||||
throw new ParseError('Indentation error', filename, doc);
|
||||
}
|
||||
var tagname = m[2], attrname = m[3], attrvalue = m[4];
|
||||
var text = m[5], comment = m[6], doctype = m[7], processing = m[8];
|
||||
var template_content = m[9];
|
||||
if (attrname !== undefined) {
|
||||
if (!can_add_attr)
|
||||
throw new ParseError('Late attribute', filename, m);
|
||||
obj = {
|
||||
name:localname(attrname),
|
||||
ns:namespace(attrname),
|
||||
value:attrvalue
|
||||
};
|
||||
if (attrvalue !== escapeAttr(attrvalue)) {
|
||||
obj.escaped = props.escaped = true;
|
||||
}
|
||||
var serializedName;
|
||||
if (obj.ns === namespace('html')) {
|
||||
serializedName = obj.name;
|
||||
} else if (obj.ns === NAMESPACE.xml) {
|
||||
serializedName = 'xml:' + obj.name;
|
||||
} else if (obj.ns == NAMESPACE.xmlns) {
|
||||
if (obj.name === 'xmlns') {
|
||||
serializedName = 'xmlns';
|
||||
} else {
|
||||
serializedName = 'xmlns:' + obj.name;
|
||||
}
|
||||
} else if (obj.ns === NAMESPACE.xlink) {
|
||||
serializedName = 'xlink:' + obj.name;
|
||||
} else {
|
||||
throw new Error("don't know what qualified name to use");
|
||||
}
|
||||
result += ' ' + serializedName + '="' + escapeAttr(obj.value) + '"';
|
||||
stack_top().attrs.push(obj);
|
||||
if (/[<"]/.test(serializedName)) {
|
||||
props.attrWithFunnyChar = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
clear_add_attr();
|
||||
if (tagname !== undefined) {
|
||||
result += '<' + localname(tagname);
|
||||
can_add_attr = true;
|
||||
props.tags[tagname] = true;
|
||||
if (/</.test(tagname)) {
|
||||
props.tagWithLt = true;
|
||||
}
|
||||
parent = stack_top();
|
||||
stack.push({
|
||||
tag: localname(tagname),
|
||||
ns: namespace(tagname),
|
||||
attrs: [],
|
||||
children: []
|
||||
});
|
||||
parent.children.push(stack_top());
|
||||
continue;
|
||||
}
|
||||
if (text !== undefined) {
|
||||
obj = { text: text };
|
||||
if (stack_top().ns === namespace('html') &&
|
||||
NO_ESCAPE[stack_top().tag]) {
|
||||
obj.no_escape = props.no_escape = true;
|
||||
}
|
||||
if (stack_top().ns === namespace('html') &&
|
||||
EXTRA_NL[stack_top().tag] &&
|
||||
stack_top().children.length === 0 &&
|
||||
/^\n/.test(text)) {
|
||||
result += '\n';
|
||||
obj.extraNL = props.extraNL = true;
|
||||
}
|
||||
if (text !== escape(text) && !obj.no_escape) {
|
||||
obj.escaped = props.escaped = true;
|
||||
}
|
||||
result += obj.no_escape ? text : escape(text);
|
||||
stack_top().children.push(obj);
|
||||
continue;
|
||||
}
|
||||
if (comment !== undefined) {
|
||||
result += '<!--' + comment + '-->';
|
||||
props.comment = true;
|
||||
stack_top().children.push({ comment: comment });
|
||||
continue;
|
||||
}
|
||||
if (doctype !== undefined) {
|
||||
// HTML serialization spec says just include the name, not the
|
||||
// public or system identifiers.
|
||||
result += '<!DOCTYPE ' + doctype.replace(/ .*$/, '') + '>';
|
||||
props.doctype = true;
|
||||
stack_top().children.push({ doctype: doctype });
|
||||
continue;
|
||||
}
|
||||
if (processing !== undefined) {
|
||||
result += '<?' + processing + '>';
|
||||
props.processing = true;
|
||||
stack_top().children.push({ processing: processing });
|
||||
continue;
|
||||
}
|
||||
if (template_content !== undefined) {
|
||||
parent = stack_top();
|
||||
stack.push({content:true, children:[]});
|
||||
parent.children.push(stack_top());
|
||||
can_add_attr = false;
|
||||
props.template = true;
|
||||
continue;
|
||||
}
|
||||
throw new ParseError("Unknown line type", filename, m);
|
||||
}
|
||||
while (stack.length > 0) {
|
||||
pop_stack();
|
||||
}
|
||||
return {
|
||||
props: props,
|
||||
tree: root.children,
|
||||
html: result
|
||||
};
|
||||
};
|
||||
|
||||
var twiddle_test = function(filename, tc) {
|
||||
// Adjust the expected HTML serialization for some tests so that
|
||||
// output attribute order always matches input attributes order.
|
||||
var expected = tc.document.html;
|
||||
|
||||
// Tweak the order of attributes:
|
||||
if (/^isindex$/.test(filename) &&
|
||||
/<isindex name="A" action="B" prompt="C" foo="D"/.test(tc.data) &&
|
||||
/<isindex action="B" foo="D" name="A" prompt="C"/.test(expected)) {
|
||||
expected = expected.replace(/<(isindex) (action="B") (foo="D") (name="A") (prompt="C")/,
|
||||
'<$1 $4 $2 $5 $3');
|
||||
}
|
||||
if (/^tests(9|10)$/.test(filename) &&
|
||||
/<(g|mi) xml:lang=en xlink:href=foo/.test(tc.data) &&
|
||||
/<(g|mi) xlink:href="foo" xml:lang="en"/.test(expected)) {
|
||||
expected = expected.replace(/<(g|mi) (xlink[^> ]+) (xml[^> ]+)/g,
|
||||
'<$1 $3 $2');
|
||||
}
|
||||
if (filename==='tests19' &&
|
||||
/<html c=d>.*<html a=b>/.test(tc.data) &&
|
||||
/<html a="b" c="d">/.test(expected)) {
|
||||
expected = expected.replace(/a="b" c="d"/, 'c="d" a="b"');
|
||||
}
|
||||
if (filename==='tests19' &&
|
||||
/http-equiv="content-type" content="[^\"]+"/.test(tc.data) &&
|
||||
/content="[^\"]+" http-equiv="content-type"/.test(expected)) {
|
||||
expected = expected.replace(/(content=[^> ]+) (http-equiv=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='tests23' &&
|
||||
/size=4 id=a/.test(tc.data) &&
|
||||
/id="a" size="4"/.test(expected)) {
|
||||
expected = expected.replace(/(id=[^> ]+) (size=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='tests26' &&
|
||||
/<code code="" x<="">/.test(expected)) {
|
||||
expected = expected.replace(/(code=[^> ]+) (x<=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
if (filename==='webkit01' &&
|
||||
/<rdar: 6869687="" problem="">/.test(expected)) {
|
||||
expected = expected.replace(/(6869687=[^> ]+) (problem=[^> ]+)/g, '$2 $1');
|
||||
}
|
||||
tc.document.html = expected;
|
||||
// Will this pass if parsed as a <body> fragment in no-quirks mode?
|
||||
// This property is used by some third-party consumers of the parsed
|
||||
// tests.
|
||||
var dd = domino.createDocument();
|
||||
dd.body.innerHTML = tc.data;
|
||||
tc.document.noQuirksBodyHtml = dd.body.innerHTML;
|
||||
|
||||
return tc;
|
||||
};
|
||||
|
||||
var result = list_tests().reduce(function(result, filename){
|
||||
result[path.basename(filename)] = parse_test_file(filename);
|
||||
return result;
|
||||
}, {});
|
||||
//console.log(JSON.stringify(result, null, 2));
|
||||
if (process.argv[2]) {
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(result, null, 2), 'utf8');
|
||||
console.warn('Wrote', process.argv[2]);
|
||||
} else {
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# Document Object Model (DOM) Conformance Test Suites
|
||||
|
||||
http://www.w3.org/DOM/Test/
|
||||
|
||||
Since domino doesn't implement deprecated DOM features some tests are no longer relevant. These tests have been moved to the `obsolete` directory so that they are excluded from the suite.
|
||||
|
||||
## Attributes vs. Nodes
|
||||
|
||||
The majority of the excluded level1/core tests expect Attributes to inherit from the Node interface which is no longer required in DOM level 4. Also `Element.attributes` no longer returns a NamedNodeMap but a read-only array.
|
||||
|
||||
## Obsolete Attributes
|
||||
|
||||
Another big hunk of excluded tests checks the support of reflected attributes that have become obsolete in HTML 5.
|
||||
+438
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
Copyright (c) 2001-2005 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, Institut National de
|
||||
Recherche en Informatique et en Automatique, Keio University). All
|
||||
Rights Reserved. This program is distributed under the W3C's Software
|
||||
Intellectual Property License. This program is distributed in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
See W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
*/
|
||||
|
||||
function assertSize(descr, expected, actual) {
|
||||
var actualSize;
|
||||
assertNotNull(descr, actual);
|
||||
actualSize = actual.length;
|
||||
assertEquals(descr, expected, actualSize);
|
||||
}
|
||||
|
||||
function assertEqualsAutoCase(context, descr, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if(context == "attribute") {
|
||||
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
|
||||
}
|
||||
else {
|
||||
assertEquals(descr, expected.toUpperCase(), actual);
|
||||
}
|
||||
}
|
||||
else {
|
||||
assertEquals(descr, expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (expectedValue.toUpperCase() == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(matches == 0) {
|
||||
assert(descr + ": No match found for " + expectedValue,false);
|
||||
}
|
||||
if(matches > 1) {
|
||||
assert(descr + ": Multiple matches found for " + expectedValue, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function assertEqualsCollection(descr, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
if(matches == 0) {
|
||||
assert(descr + ": No match found for " + expectedValue,false);
|
||||
}
|
||||
if(matches > 1) {
|
||||
assert(descr + ": Multiple matches found for " + expectedValue, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function assertEqualsListAutoCase(context, descr, expected, actual) {
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
|
||||
}
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
}
|
||||
|
||||
function assertEqualsList(descr, expected, actual) {
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
if(expected[i] != actual[i]) {
|
||||
assertEquals(descr, expected[i], actual[i]);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
}
|
||||
|
||||
function assertInstanceOf(descr, type, obj) {
|
||||
if(type == "Attr") {
|
||||
assertEquals(descr,2,obj.nodeType);
|
||||
var specd = obj.specified;
|
||||
}
|
||||
}
|
||||
|
||||
function assertSame(descr, expected, actual) {
|
||||
if(expected != actual) {
|
||||
assertEquals(descr, expected.nodeType, actual.nodeType);
|
||||
assertEquals(descr, expected.nodeValue, actual.nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
function assertURIEquals(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
|
||||
//
|
||||
// URI must be non-null
|
||||
assertNotNull(assertID, actual);
|
||||
|
||||
var uri = actual;
|
||||
|
||||
var lastPound = actual.lastIndexOf("#");
|
||||
var actualFragment = "";
|
||||
if(lastPound != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastPound);
|
||||
actualFragment = actual.substring(lastPound+1);
|
||||
}
|
||||
if(fragment != null) assertEquals(assertID,fragment, actualFragment);
|
||||
|
||||
var lastQuestion = uri.lastIndexOf("?");
|
||||
var actualQuery = "";
|
||||
if(lastQuestion != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastQuestion);
|
||||
actualQuery = actual.substring(lastQuestion+1);
|
||||
}
|
||||
if(query != null) assertEquals(assertID, query, actualQuery);
|
||||
|
||||
var firstColon = uri.indexOf(":");
|
||||
var firstSlash = uri.indexOf("/");
|
||||
var actualPath = uri;
|
||||
var actualScheme = "";
|
||||
if(firstColon != -1 && firstColon < firstSlash) {
|
||||
actualScheme = uri.substring(0,firstColon);
|
||||
actualPath = uri.substring(firstColon + 1);
|
||||
}
|
||||
|
||||
if(scheme != null) {
|
||||
assertEquals(assertID, scheme, actualScheme);
|
||||
}
|
||||
|
||||
if(path != null) {
|
||||
assertEquals(assertID, path, actualPath);
|
||||
}
|
||||
|
||||
if(host != null) {
|
||||
var actualHost = "";
|
||||
if(actualPath.substring(0,2) == "//") {
|
||||
var termSlash = actualPath.substring(2).indexOf("/") + 2;
|
||||
actualHost = actualPath.substring(0,termSlash);
|
||||
}
|
||||
assertEquals(assertID, host, actualHost);
|
||||
}
|
||||
|
||||
if(file != null || name != null) {
|
||||
var actualFile = actualPath;
|
||||
var finalSlash = actualPath.lastIndexOf("/");
|
||||
if(finalSlash != -1) {
|
||||
actualFile = actualPath.substring(finalSlash+1);
|
||||
}
|
||||
if (file != null) {
|
||||
assertEquals(assertID, file, actualFile);
|
||||
}
|
||||
if (name != null) {
|
||||
var actualName = actualFile;
|
||||
var finalDot = actualFile.lastIndexOf(".");
|
||||
if (finalDot != -1) {
|
||||
actualName = actualName.substring(0, finalDot);
|
||||
}
|
||||
assertEquals(assertID, name, actualName);
|
||||
}
|
||||
}
|
||||
|
||||
if(isAbsolute != null) {
|
||||
assertEquals(assertID + ' ' + actualPath, isAbsolute, actualPath.substring(0,1) == "/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// size() used by assertSize element
|
||||
function size(collection) {
|
||||
return collection.length;
|
||||
}
|
||||
|
||||
function same(expected, actual) {
|
||||
return expected === actual;
|
||||
}
|
||||
|
||||
function getSuffix(contentType) {
|
||||
switch(contentType) {
|
||||
case "text/html":
|
||||
return ".html";
|
||||
|
||||
case "text/xml":
|
||||
return ".xml";
|
||||
|
||||
case "application/xhtml+xml":
|
||||
return ".xhtml";
|
||||
|
||||
case "image/svg+xml":
|
||||
return ".svg";
|
||||
|
||||
case "text/mathml":
|
||||
return ".mml";
|
||||
}
|
||||
return ".html";
|
||||
}
|
||||
|
||||
function equalsAutoCase(context, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
return expected.toLowerCase() == actual;
|
||||
}
|
||||
return expected.toUpperCase() == actual;
|
||||
}
|
||||
return expected == actual;
|
||||
}
|
||||
|
||||
function catchInitializationError(blder, ex) {
|
||||
if (blder == null) {
|
||||
alert(ex);
|
||||
}
|
||||
else {
|
||||
blder.initializationError = ex;
|
||||
blder.initializationFatalError = ex;
|
||||
}
|
||||
}
|
||||
|
||||
function checkInitialization(blder, testname) {
|
||||
if (blder.initializationError != null) {
|
||||
if (blder.skipIncompatibleTests) {
|
||||
info(testname + " not run:" + blder.initializationError);
|
||||
return blder.initializationError;
|
||||
}
|
||||
else {
|
||||
//
|
||||
// if an exception was thrown
|
||||
// rethrow it and do not run the test
|
||||
if (blder.initializationFatalError != null) {
|
||||
throw blder.initializationFatalError;
|
||||
} else {
|
||||
//
|
||||
// might be recoverable, warn but continue the test
|
||||
warn(testname + ": " + blder.initializationError);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function createTempURI(scheme) {
|
||||
if (scheme == "http") {
|
||||
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
|
||||
}
|
||||
return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
|
||||
}
|
||||
|
||||
|
||||
function EventMonitor() {
|
||||
this.atEvents = new Array();
|
||||
this.bubbledEvents = new Array();
|
||||
this.capturedEvents = new Array();
|
||||
this.allEvents = new Array();
|
||||
}
|
||||
|
||||
EventMonitor.prototype.handleEvent = function(evt) {
|
||||
switch(evt.eventPhase) {
|
||||
case 1:
|
||||
monitor.capturedEvents[monitor.capturedEvents.length] = evt;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
monitor.atEvents[monitor.atEvents.length] = evt;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
|
||||
break;
|
||||
}
|
||||
monitor.allEvents[monitor.allEvents.length] = evt;
|
||||
}
|
||||
|
||||
function DOMErrorImpl(err) {
|
||||
this.severity = err.severity;
|
||||
this.message = err.message;
|
||||
this.type = err.type;
|
||||
this.relatedException = err.relatedException;
|
||||
this.relatedData = err.relatedData;
|
||||
this.location = err.location;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DOMErrorMonitor() {
|
||||
this.allErrors = new Array();
|
||||
}
|
||||
|
||||
DOMErrorMonitor.prototype.handleError = function(err) {
|
||||
errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err);
|
||||
}
|
||||
|
||||
DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
|
||||
var i;
|
||||
for (i = 0; i < errorMonitor.allErrors.length; i++) {
|
||||
if (errorMonitor.allErrors[i].severity >= severity) {
|
||||
assertEquals(id, severity - 1, errorMonitor.allErrors[i].severity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UserDataNotification(operation, key, data, src, dst) {
|
||||
this.operation = operation;
|
||||
this.key = key;
|
||||
this.data = data;
|
||||
this.src = src;
|
||||
this.dst = dst;
|
||||
}
|
||||
|
||||
function UserDataMonitor() {
|
||||
this.allNotifications = new Array();
|
||||
}
|
||||
|
||||
UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
|
||||
userDataMonitor.allNotifications[this.allNotifications.length] =
|
||||
new UserDataNotification(operation, key, data, src, dst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function checkFeature(feature, version)
|
||||
{
|
||||
if (!builder.hasFeature(feature, version))
|
||||
{
|
||||
//
|
||||
// don't throw exception so that users can select to ignore the precondition
|
||||
//
|
||||
builder.initializationError = "builder does not support feature " + feature + " version " + version;
|
||||
}
|
||||
}
|
||||
|
||||
function preload(frame, varname, url) {
|
||||
return builder.preload(frame, varname, url);
|
||||
}
|
||||
|
||||
function load(frame, varname, url) {
|
||||
return builder.load(frame, varname, url);
|
||||
}
|
||||
|
||||
function getImplementationAttribute(attr) {
|
||||
return builder.getImplementationAttribute(attr);
|
||||
}
|
||||
|
||||
|
||||
function setImplementationAttribute(attribute, value) {
|
||||
builder.setImplementationAttribute(attribute, value);
|
||||
}
|
||||
|
||||
function setAsynchronous(value) {
|
||||
if (builder.supportsAsyncChange) {
|
||||
builder.async = value;
|
||||
} else {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toLowerArray(src) {
|
||||
var newArray = new Array();
|
||||
var i;
|
||||
for (i = 0; i < src.length; i++) {
|
||||
newArray[i] = src[i].toLowerCase();
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
|
||||
function getImplementation() {
|
||||
return builder.getImplementation();
|
||||
}
|
||||
|
||||
function warn(msg) {
|
||||
//console.log(msg);
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
var fs = require('fs');
|
||||
var vm = require('vm');
|
||||
var assert = require('assert');
|
||||
var util = require('util');
|
||||
var Path = require('path');
|
||||
var domino = require('../../../lib');
|
||||
var impl = domino.createDOMImplementation();
|
||||
var Window = require('../../../lib/Window');
|
||||
|
||||
var globals = {
|
||||
assertEquals: function(message, expected, actual) {
|
||||
assert.equal(actual, expected, message + ': expected ' +
|
||||
util.inspect(expected, false, 0) + ' got ' +
|
||||
util.inspect(actual, false, 0)
|
||||
);
|
||||
},
|
||||
assertTrue: function(message, actual) {
|
||||
globals.assertEquals(message, true, actual);
|
||||
},
|
||||
assertFalse: function(message, actual) {
|
||||
assert.ok(!actual, message);
|
||||
},
|
||||
assertNull: function(message, actual) {
|
||||
globals.assertEquals(message, null, actual);
|
||||
},
|
||||
assertNotNull: function(message, actual) {
|
||||
assert.notEqual(actual, null, message);
|
||||
},
|
||||
console: console
|
||||
};
|
||||
|
||||
function list(dir, re, fn) {
|
||||
dir = Path.resolve(__dirname, '..', dir);
|
||||
fs.readdirSync(dir).forEach(function(file) {
|
||||
var path = Path.join(dir, file);
|
||||
var m = re.exec(path);
|
||||
if (m) fn.apply(null, m);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function(path) {
|
||||
|
||||
function run(ctx, file) {
|
||||
vm.runInContext(fs.readFileSync(file, 'utf8'), ctx, file);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
function makeContext() {
|
||||
var ctx = vm.createContext(); // create new independent context
|
||||
Object.keys(globals).forEach(function(k) {
|
||||
ctx[k] = globals[k]; // shallow clone
|
||||
});
|
||||
|
||||
ctx.createConfiguredBuilder = function() {
|
||||
return {
|
||||
contentType: 'text/html',
|
||||
hasFeature: function(feature, version) {
|
||||
return impl.hasFeature(feature, version);
|
||||
},
|
||||
getImplementation: function() {
|
||||
return impl;
|
||||
},
|
||||
setImplementationAttribute: function(attr, value) {
|
||||
// Ignore
|
||||
},
|
||||
preload: function(docRef, name, href) {
|
||||
return 1;
|
||||
},
|
||||
load: function(docRef, name, href) {
|
||||
var doc = Path.resolve(__dirname, '..', path, 'files', href) + '.html';
|
||||
var html = fs.readFileSync(doc, 'utf8');
|
||||
var url = 'http://example.com/'+Path.join(path,'files',href)+'.html';
|
||||
|
||||
var document = domino.createDocument(html);
|
||||
document.address = url;
|
||||
var win = new Window(document);
|
||||
return win.document;
|
||||
}
|
||||
};
|
||||
};
|
||||
run(ctx, __dirname + '/DomTestCase.js');
|
||||
return ctx;
|
||||
}
|
||||
|
||||
var tests = {};
|
||||
list(path, /(.*?)\.js$/, function(file, basename) {
|
||||
tests[basename] = function() {
|
||||
var ctx = makeContext();
|
||||
run(ctx, file);
|
||||
ctx.setUpPage();
|
||||
ctx.runTest();
|
||||
};
|
||||
});
|
||||
return tests;
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
var suite = require('./harness');
|
||||
|
||||
exports.level1 = {
|
||||
core: suite('level1/core/'),
|
||||
html: suite('level1/html/')
|
||||
};
|
||||
/*
|
||||
exports.level2 = {
|
||||
core: suite('level2/core/'),
|
||||
html: suite('level2/html/')
|
||||
};
|
||||
*/
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("validating", false);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_nodtdstaff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getDoctype()" method returns null for XML documents
|
||||
without a document type declaration.
|
||||
Retrieve the XML document without a DTD and invoke the
|
||||
"getDoctype()" method. It should return null.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31
|
||||
*/
|
||||
function documentgetdoctypenodtd() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentgetdoctypenodtd") != null) return;
|
||||
var doc;
|
||||
var docType;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_nodtdstaff");
|
||||
docType = doc.doctype;
|
||||
|
||||
assertNull("documentGetDocTypeNoDTDAssert",docType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentgetdoctypenodtd();
|
||||
}
|
||||
Generated
Vendored
+143
@@ -0,0 +1,143 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "createProcessingInstruction(target,data) method
|
||||
raises an INVALID_CHARACTER_ERR DOMException if the
|
||||
specified tagName contains an invalid character.
|
||||
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function documentinvalidcharacterexceptioncreatepi() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi") != null) return;
|
||||
var doc;
|
||||
var badPI;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html" && false /*CSA: allowed in DOM 4*/)
|
||||
|
||||
) {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("foo","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
|
||||
}
|
||||
assertTrue("throw_NOT_SUPPORTED_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("invalid^Name","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentinvalidcharacterexceptioncreatepi();
|
||||
}
|
||||
Generated
Vendored
+140
@@ -0,0 +1,140 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
checkFeature("XML", null);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
|
||||
*/
|
||||
function documentinvalidcharacterexceptioncreatepi1() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1") != null) return;
|
||||
var doc;
|
||||
var badPI;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
|
||||
if(
|
||||
|
||||
(builder.contentType == "text/html" && false /*CSA: allowed in DOM 4*/)
|
||||
|
||||
) {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("foo","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 9);
|
||||
}
|
||||
assertTrue("throw_NOT_SUPPORTED_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction("","data");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 5);
|
||||
}
|
||||
assertTrue("throw_INVALID_CHARACTER_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
documentinvalidcharacterexceptioncreatepi1();
|
||||
}
|
||||
Whitespace-only changes.
+10
@@ -0,0 +1,10 @@
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()">
|
||||
<p>
|
||||
<em>EMP0001</em>
|
||||
<strong>Margaret Martin</strong>
|
||||
<code>Accountant</code>
|
||||
<sup>56,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
|
||||
</p>
|
||||
</body></html>
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd" >
|
||||
<!-- This is comment number 1.-->
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hc_staff</title><script type="text/javascript" src="svgunit.js"></script><script charset="UTF-8" type="text/javascript" src="svgtest.js"></script><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
|
||||
<p>
|
||||
<em>EMP0001</em>
|
||||
<strong>Margaret Martin</strong>
|
||||
<code>Accountant</code>
|
||||
<sup>56,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0002</em>
|
||||
<strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2;
|
||||
This is an adjacent CDATASection with a reference to a tab &tab;</strong>
|
||||
<code>Secretary</code>
|
||||
<sup>35,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes" class="Yes">β Dallas, γ
|
||||
98554</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0003</em>
|
||||
<strong>Roger
|
||||
Jones</strong>
|
||||
<code>Department Manager</code>
|
||||
<sup>100,000</sup>
|
||||
<var>δ</var>
|
||||
<acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0004</em>
|
||||
<strong>Jeny Oconnor</strong>
|
||||
<code>Personnel Director</code>
|
||||
<sup>95,000</sup>
|
||||
<var>Female</var>
|
||||
<acronym title="Yes" class="Yα">27 South Road. Dallas, Texas 98556</acronym>
|
||||
</p>
|
||||
<p>
|
||||
<em>EMP0005</em>
|
||||
<strong>Robert Myers</strong>
|
||||
<code>Computer Specialist</code>
|
||||
<sup>90,000</sup>
|
||||
<var>male</var>
|
||||
<acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
|
||||
</p>
|
||||
</body></html>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<!ELEMENT employeeId (#PCDATA)>
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
<!ELEMENT position (#PCDATA)>
|
||||
<!ELEMENT salary (#PCDATA)>
|
||||
<!ELEMENT address (#PCDATA)>
|
||||
<!ELEMENT entElement ( #PCDATA ) >
|
||||
<!ELEMENT gender ( #PCDATA | entElement )* >
|
||||
<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
|
||||
<!ELEMENT staff (employee)+>
|
||||
<!ATTLIST entElement
|
||||
attr1 CDATA "Attr">
|
||||
<!ATTLIST address
|
||||
domestic CDATA #IMPLIED
|
||||
street CDATA "Yes">
|
||||
<!ATTLIST entElement
|
||||
domestic CDATA "MALE" >
|
||||
|
||||
Generated
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "appendData(arg)" method appends a string to the end
|
||||
of the character data of the node.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee. The appendData(arg) method is
|
||||
called with arg=", Esquire". The method should append
|
||||
the specified data to the already existing character
|
||||
data. The new value return by the "getLength()" method
|
||||
should be 24.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
|
||||
*/
|
||||
function hc_characterdataappenddata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataappenddata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childValue;
|
||||
var childLength;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.appendData(", Esquire");
|
||||
childValue = child.data;
|
||||
|
||||
childLength = childValue.length;
|
||||
assertEquals("characterdataAppendDataAssert",24,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataappenddata();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataappenddatagetdata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
On successful invocation of the "appendData(arg)"
|
||||
method the "getData()" method provides access to the
|
||||
concatentation of data and the specified string.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
of the first employee. The appendData(arg) method is
|
||||
called with arg=", Esquire". The method should append
|
||||
the specified data to the already existing character
|
||||
data. The new value return by the "getData()" method
|
||||
should be "Margaret Martin, Esquire".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F
|
||||
*/
|
||||
function hc_characterdataappenddatagetdata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataappenddatagetdata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.appendData(", Esquire");
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataAppendDataGetDataAssert","Margaret Martin, Esquire",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataappenddatagetdata();
|
||||
}
|
||||
Generated
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatabegining";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data at the beginning
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=0 and count=16.
|
||||
The method should delete the characters from position
|
||||
0 thru position 16. The new value of the character data
|
||||
should be "Dallas, Texas 98551".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatabegining() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatabegining") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(0,16);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("data","Dallas, Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatabegining();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataend";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data at the end
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=30 and count=5.
|
||||
The method should delete the characters from position
|
||||
30 thru position 35. The new value of the character data
|
||||
should be "1230 North Ave. Dallas, Texas".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedataend() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedataend") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(30,5);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataEndAssert","1230 North Ave. Dallas, Texas ",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedataend();
|
||||
}
|
||||
Generated
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedataexceedslength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
If the sum of the offset and count used in the
|
||||
"deleteData(offset,count) method is greater than the
|
||||
length of the character data then all the characters
|
||||
from the offset to the end of the data are deleted.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=4 and count=50.
|
||||
The method should delete the characters from position 4
|
||||
to the end of the data since the offset+count(50+4)
|
||||
is greater than the length of the character data(35).
|
||||
The new value of the character data should be "1230".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedataexceedslength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedataexceedslength") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(4,50);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataExceedsLengthAssert","1230",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedataexceedslength();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatagetlengthanddata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
On successful invocation of the "deleteData(offset,count)"
|
||||
method, the "getData()" and "getLength()" methods reflect
|
||||
the changes.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=30 and count=5.
|
||||
The method should delete the characters from position
|
||||
30 thru position 35. The new value of the character data
|
||||
should be "1230 North Ave. Dallas, Texas" which is
|
||||
returned by the "getData()" method and "getLength()"
|
||||
method should return 30".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatagetlengthanddata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatagetlengthanddata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
var childLength;
|
||||
var result = new Array();
|
||||
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(30,5);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("data","1230 North Ave. Dallas, Texas ",childData);
|
||||
childLength = child.length;
|
||||
|
||||
assertEquals("length",30,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatagetlengthanddata();
|
||||
}
|
||||
Generated
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatadeletedatamiddle";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method removes a range of
|
||||
characters from the node. Delete data in the middle
|
||||
of the character data.
|
||||
|
||||
Retrieve the character data from the last child of the
|
||||
first employee. The "deleteData(offset,count)"
|
||||
method is then called with offset=16 and count=8.
|
||||
The method should delete the characters from position
|
||||
16 thru position 24. The new value of the character data
|
||||
should be "1230 North Ave. Texas 98551".
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdatadeletedatamiddle() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatadeletedatamiddle") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
child.deleteData(16,8);
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataDeleteDataMiddleAssert","1230 North Ave. Texas 98551",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatadeletedatamiddle();
|
||||
}
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetdata";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
The "getData()" method retrieves the character data
|
||||
|
||||
currently stored in the node.
|
||||
|
||||
Retrieve the character data from the second child
|
||||
|
||||
of the first employee and invoke the "getData()"
|
||||
|
||||
method. The method returns the character data
|
||||
|
||||
string.
|
||||
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
*/
|
||||
function hc_characterdatagetdata() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatagetdata") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childData;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
childData = child.data;
|
||||
|
||||
assertEquals("characterdataGetDataAssert","Margaret Martin",childData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatagetdata();
|
||||
}
|
||||
Generated
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdatagetlength";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "getLength()" method returns the number of characters
|
||||
stored in this nodes data.
|
||||
Retrieve the character data from the second
|
||||
child of the first employee and examine the
|
||||
value returned by the getLength() method.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C
|
||||
*/
|
||||
function hc_characterdatagetlength() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdatagetlength") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childValue;
|
||||
var childLength;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("strong");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
childValue = child.data;
|
||||
|
||||
childLength = childValue.length;
|
||||
assertEquals("characterdataGetLengthAssert",15,childLength);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdatagetlength();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedatacountnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified count
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=10 and count=-3. It should raise the
|
||||
desired exception since the count is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedatacountnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedatacountnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var childSubstring;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
childSubstring = child.substringData(10,-3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: latest DOM spec doesn't throw for negative count
|
||||
hc_characterdataindexsizeerrdeletedatacountnegative();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater that the number of characters in the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=40 and count=3. It should raise the
|
||||
desired exception since the offset is greater than the
|
||||
number of characters in the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrdeletedataoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrdeletedataoffsetnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "deleteData(offset,count)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its "deleteData(offset,count)"
|
||||
method with offset=-5 and count=3. It should raise the
|
||||
desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
*/
|
||||
function hc_characterdataindexsizeerrdeletedataoffsetnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrdeletedataoffsetnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(-5,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrdeletedataoffsetnegative();
|
||||
}
|
||||
Generated
Vendored
+130
@@ -0,0 +1,130 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater than the number of characters in the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its insertData"(offset,arg)"
|
||||
method with offset=40 and arg="ABC". It should raise
|
||||
the desired exception since the offset is greater than
|
||||
the number of characters in the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249
|
||||
*/
|
||||
function hc_characterdataindexsizeerrinsertdataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrinsertdataoffsetgreater();
|
||||
}
|
||||
Generated
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrinsertdataoffsetnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "insertData(offset,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its insertData"(offset,arg)"
|
||||
method with offset=-5 and arg="ABC". It should raise
|
||||
the desired exception since the offset is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrinsertdataoffsetnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrinsertdataoffsetnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.replaceData(-5,3,"ABC");
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrinsertdataoffsetnegative();
|
||||
}
|
||||
Generated
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedatacountnegative";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
setImplementationAttribute("signed", true);
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified count
|
||||
is negative.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its
|
||||
"replaceData(offset,count,arg) method with offset=10
|
||||
and count=-3 and arg="ABC". It should raise the
|
||||
desired exception since the count is negative.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
*/
|
||||
function hc_characterdataindexsizeerrreplacedatacountnegative() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedatacountnegative") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
var badString;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
badString = child.substringData(10,-3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throws_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
return; // CSA: latest DOM spec doesn't throw for negative count
|
||||
hc_characterdataindexsizeerrreplacedatacountnegative();
|
||||
}
|
||||
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
/*
|
||||
Copyright © 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, European Research Consortium
|
||||
for Informatics and Mathematics, Keio University). All
|
||||
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets URI that identifies the test.
|
||||
* @return uri identifier of test
|
||||
*/
|
||||
function getTargetURI() {
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_characterdataindexsizeerrreplacedataoffsetgreater";
|
||||
}
|
||||
|
||||
var docsLoaded = -1000000;
|
||||
var builder = null;
|
||||
|
||||
//
|
||||
// This function is called by the testing framework before
|
||||
// running the test suite.
|
||||
//
|
||||
// If there are no configuration exceptions, asynchronous
|
||||
// document loading is started. Otherwise, the status
|
||||
// is set to complete and the exception is immediately
|
||||
// raised when entering the body of the test.
|
||||
//
|
||||
function setUpPage() {
|
||||
setUpPageStatus = 'running';
|
||||
try {
|
||||
//
|
||||
// creates test document builder, may throw exception
|
||||
//
|
||||
builder = createConfiguredBuilder();
|
||||
|
||||
docsLoaded = 0;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
docsLoaded += preload(docRef, "doc", "hc_staff");
|
||||
|
||||
if (docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
} catch(ex) {
|
||||
catchInitializationError(builder, ex);
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// This method is called on the completion of
|
||||
// each asychronous load started in setUpTests.
|
||||
//
|
||||
// When every synchronous loaded document has completed,
|
||||
// the page status is changed which allows the
|
||||
// body of the test to be executed.
|
||||
function loadComplete() {
|
||||
if (++docsLoaded == 1) {
|
||||
setUpPageStatus = 'complete';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
The "replaceData(offset,count,arg)" method raises an
|
||||
INDEX_SIZE_ERR DOMException if the specified offset
|
||||
is greater than the length of the string.
|
||||
|
||||
Retrieve the character data of the last child of the
|
||||
first employee and invoke its
|
||||
"replaceData(offset,count,arg) method with offset=40
|
||||
and count=3 and arg="ABC". It should raise the
|
||||
desired exception since the offset is greater than the
|
||||
length of the string.
|
||||
|
||||
* @author Curt Arnold
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781
|
||||
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])
|
||||
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=242
|
||||
*/
|
||||
function hc_characterdataindexsizeerrreplacedataoffsetgreater() {
|
||||
var success;
|
||||
if(checkInitialization(builder, "hc_characterdataindexsizeerrreplacedataoffsetgreater") != null) return;
|
||||
var doc;
|
||||
var elementList;
|
||||
var nameNode;
|
||||
var child;
|
||||
|
||||
var docRef = null;
|
||||
if (typeof(this.doc) != 'undefined') {
|
||||
docRef = this.doc;
|
||||
}
|
||||
doc = load(docRef, "doc", "hc_staff");
|
||||
elementList = doc.getElementsByTagName("acronym");
|
||||
nameNode = elementList.item(0);
|
||||
child = nameNode.firstChild;
|
||||
|
||||
|
||||
{
|
||||
success = false;
|
||||
try {
|
||||
child.deleteData(40,3);
|
||||
}
|
||||
catch(ex) {
|
||||
success = (typeof(ex.code) != 'undefined' && ex.code == 1);
|
||||
}
|
||||
assertTrue("throw_INDEX_SIZE_ERR",success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function runTest() {
|
||||
hc_characterdataindexsizeerrreplacedataoffsetgreater();
|
||||
}
|
||||
Loaded 100 of 13454 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user