All Downloads are FREE. Search and download functionalities are using the official Maven repository.

atoms.xpaths_ios.js Maven / Gradle / Ivy

The newest version!
function(){return function(){function g(a){throw a;}var h=void 0,l=!0,m=null,n=!1;function p(a){return function(){return this[a]}}function q(a){return function(){return a}}var r=this;function s(a){return"string"==typeof a}Math.floor(2147483648*Math.random()).toString(36);function t(a,b){function c(){}c.prototype=b.prototype;a.ca=b.prototype;a.prototype=new c};function u(a,b){this.code=a;this.message=b||"";this.name=aa[a]||aa[13];var c=Error(this.message);c.name=this.name;this.stack=c.stack||""}t(u,Error);
var aa={7:"NoSuchElementError",8:"NoSuchFrameError",9:"UnknownCommandError",10:"StaleElementReferenceError",11:"ElementNotVisibleError",12:"InvalidElementStateError",13:"UnknownError",15:"ElementNotSelectableError",19:"XPathLookupError",23:"NoSuchWindowError",24:"InvalidCookieDomainError",25:"UnableToSetCookieError",26:"ModalDialogOpenedError",27:"NoModalDialogOpenError",28:"ScriptTimeoutError",32:"InvalidSelectorError",35:"SqlDatabaseError",34:"MoveTargetOutOfBoundsError"};
u.prototype.toString=function(){return this.name+": "+this.message};function w(a){Error.captureStackTrace?Error.captureStackTrace(this,w):this.stack=Error().stack||"";a&&(this.message=String(a))}t(w,Error);w.prototype.name="CustomError";function ba(a,b){for(var c=1;c=arguments.length?ea.slice.call(a,b):ea.slice.call(a,b,c)};function ja(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}
function ka(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=1==a.nodeType,d=1==b.nodeType;if(c&&d)return a.sourceIndex-b.sourceIndex;var e=a.parentNode,f=b.parentNode;return e==f?la(a,b):!c&&ja(e,b)?-1*ma(a,b):!d&&ja(f,a)?ma(b,a):(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:f.sourceIndex)}d=na(a);c=d.createRange();c.selectNode(a);c.collapse(l);d=d.createRange();d.selectNode(b);
d.collapse(l);return c.compareBoundaryPoints(r.Range.START_TO_END,d)}function ma(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return la(d,a)}function la(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1}function na(a){return 9==a.nodeType?a:a.ownerDocument||a.document};var oa;oa=n;var y=r.navigator?r.navigator.userAgent:m;y&&(-1!=y.indexOf("Firefox")||-1!=y.indexOf("Camino")||-1!=y.indexOf("iPhone")||-1!=y.indexOf("iPod")||-1!=y.indexOf("iPad")||-1!=y.indexOf("Android")&&(oa=l));var pa=oa;function z(a,b,c){this.i=a;this.$=b||1;this.h=c||1};function qa(a){this.I=a;this.z=0}function ra(a){a=a.match(sa);for(var b=0;b]=|\\s+|.","g"),ta=/^\s/;function A(a,b){return a.I[a.z+(b||0)]}qa.prototype.next=function(){return this.I[this.z++]};qa.prototype.back=function(){this.z--};qa.prototype.empty=function(){return this.I.length<=this.z};function B(a){var b=m,c=a.nodeType;1==c&&(b=a.textContent,b=b==h||b==m?a.innerText:b,b=b==h||b==m?"":b);if("string"!=typeof b)if(9==c||1==c){a=9==c?a.documentElement:a.firstChild;for(var c=0,d=[],b="";a;){do 1!=a.nodeType&&(b+=a.nodeValue),d[c++]=a;while(a=a.firstChild);for(;c&&!(a=d[--c].nextSibling););}}else b=a.nodeValue;return""+b}function C(a,b,c){if(b===m)return l;try{if(!a.getAttribute)return n}catch(d){return n}return c==m?!!a.getAttribute(b):a.getAttribute(b,2)==c}
function D(a,b,c,d,e){return ua.call(m,a,b,s(c)?c:m,s(d)?d:m,e||new E)}function ua(a,b,c,d,e){b.getElementsByName&&d&&"name"==c?(b=b.getElementsByName(d),x(b,function(b){a.matches(b)&&e.add(b)})):b.getElementsByClassName&&d&&"class"==c?(b=b.getElementsByClassName(d),x(b,function(b){b.className==d&&a.matches(b)&&e.add(b)})):a instanceof F?va(a,b,c,d,e):b.getElementsByTagName&&(b=b.getElementsByTagName(a.getName()),x(b,function(a){C(a,c,d)&&e.add(a)}));return e}
function wa(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)C(b,c,d)&&a.matches(b)&&e.add(b);return e}function va(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)C(b,c,d)&&a.matches(b)&&e.add(b),va(a,b,c,d,e)};function E(){this.h=this.e=m;this.t=0}function xa(a){this.p=a;this.next=this.o=m}function ya(a,b){if(a.e){if(!b.e)return a}else return b;for(var c=a.e,d=b.e,e=m,f=m,k=0;c&&d;)c.p==d.p?(f=c,c=c.next,d=d.next):0",4,2,function(a,b,c){return O(function(a,b){return a>b},a,b,c)});P("<=",4,2,function(a,b,c){return O(function(a,b){return a<=b},a,b,c)});P(">=",4,2,function(a,b,c){return O(function(a,b){return a>=b},a,b,c)});var Ea=P("=",3,2,function(a,b,c){return O(function(a,b){return a==b},a,b,c,l)});P("!=",3,2,function(a,b,c){return O(function(a,b){return a!=b},a,b,c,l)});P("and",2,2,function(a,b,c){return M(a,c)&&M(b,c)});P("or",1,2,function(a,b,c){return M(a,c)||M(b,c)});function Ha(a,b){b.j()&&4!=a.d&&g(Error("Primary expression must evaluate to nodeset if filter has predicate(s)."));J.call(this,a.d);this.Q=a;this.b=b;this.k=a.c();this.f=a.f}t(Ha,J);Ha.prototype.evaluate=function(a){a=this.Q.evaluate(a);return Ia(this.b,a)};Ha.prototype.toString=function(a){a=a||"";var b=a+"Filter: \n";a+="  ";b+=this.Q.toString(a);return b+=this.b.toString(a)};function Ja(a,b){b.lengtha.G&&g(Error("Function "+a.g+" expects at most "+a.G+" arguments, "+b.length+" given"));a.Y&&x(b,function(b,d){4!=b.d&&g(Error("Argument "+d+" to function "+a.g+" is not of type Nodeset: "+b))});J.call(this,a.d);this.w=a;this.C=b;Ca(this,a.k||ga(b,function(a){return a.c()}));Da(this,a.W&&!b.length||a.V&&!!b.length||ga(b,function(a){return a.f}))}t(Ja,J);
Ja.prototype.evaluate=function(a){return this.w.n.apply(m,ha(a,this.C))};Ja.prototype.toString=function(a){var b=a||"";a=b+"Function: "+this.w+"\n";b+="  ";this.C.length&&(a+=b+"Arguments:",b+="  ",a=fa(this.C,function(a,d){return a+"\n"+d.toString(b)},a));return a};function Ka(a,b,c,d,e,f,k,v,H){this.g=a;this.d=b;this.k=c;this.W=d;this.V=e;this.n=f;this.O=k;this.G=v!==h?v:k;this.Y=!!H}Ka.prototype.toString=p("g");var La={};
function Q(a,b,c,d,e,f,k,v){a in La&&g(Error("Function already created: "+a+"."));La[a]=new Ka(a,b,c,d,n,e,f,k,v)}Q("boolean",2,n,n,function(a,b){return M(b,a)},1);Q("ceiling",1,n,n,function(a,b){return Math.ceil(K(b,a))},1);Q("concat",3,n,n,function(a,b){var c=ia(arguments,1);return fa(c,function(b,c){return b+L(c,a)},"")},2,m);Q("contains",2,n,n,function(a,b,c){b=L(b,a);a=L(c,a);return-1!=b.indexOf(a)},2);Q("count",1,n,n,function(a,b){return b.evaluate(a).j()},1,1,l);Q("false",2,n,n,q(n),0);
Q("floor",1,n,n,function(a,b){return Math.floor(K(b,a))},1);Q("id",4,n,n,function(a,b){var c=a.i,d=9==c.nodeType?c:c.ownerDocument,c=L(b,a).split(/\s+/),e=[];x(c,function(a){a=d.getElementById(a);var b;if(b=a){a:if(s(e))b=!s(a)||1!=a.length?-1:e.indexOf(a,0);else{for(b=0;ba.length&&g(Error("Unclosed literal string"));return new Na(a)}function hb(a){return"*"!=A(a.a)&&":"==A(a.a,1)&&"*"==A(a.a,2)?new R(a.a.next()+a.a.next()+a.a.next()):new R(a.a.next())}
function ib(a){var b,c=[],d;if("/"==A(a.a)||"//"==A(a.a)){b=a.a.next();d=A(a.a);if("/"==b&&(a.a.empty()||"."!=d&&".."!=d&&"@"!=d&&"*"!=d&&!/(?![0-9])[\w]/.test(d)))return new S;d=new S;W(a,"Missing next location step.");b=jb(a,b);c.push(b)}else{a:{b=A(a.a);d=b.charAt(0);switch(d){case "$":g(Error("Variable reference not allowed in HTML XPath"));case "(":a.a.next();b=cb(a);W(a,'unclosed "("');eb(a,")");break;case '"':case "'":b=gb(a);break;default:if(isNaN(+b))if(!Ma(b)&&/(?![0-9])[\w]/.test(d)&&"("==
A(a.a,1)){b=a.a.next();b=La[b]||m;a.a.next();for(d=[];")"!=A(a.a);){W(a,"Missing function argument list.");d.push(cb(a));if(","!=A(a.a))break;a.a.next()}W(a,"Unclosed function argument list.");fb(a);b=new Ja(b,d)}else{b=m;break a}else b=new Oa(+a.a.next())}"["==A(a.a)&&(d=new T(kb(a)),b=new Ha(b,d))}if(b)if("/"==A(a.a)||"//"==A(a.a))d=b;else return b;else b=jb(a,"/"),d=new Ra,c.push(b)}for(;"/"==A(a.a)||"//"==A(a.a);)b=a.a.next(),W(a,"Missing next location step."),b=jb(a,b),c.push(b);return new Pa(d,
c)}
function jb(a,b){var c,d,e;"/"!=b&&"//"!=b&&g(Error('Step op should be "/" or "//"'));if("."==A(a.a))return d=new U(Za,new F("node")),a.a.next(),d;if(".."==A(a.a))return d=new U(Ya,new F("node")),a.a.next(),d;var f;"@"==A(a.a)?(f=Qa,a.a.next(),W(a,"Missing attribute name")):"::"==A(a.a,1)?(/(?![0-9])[\w]/.test(A(a.a).charAt(0))||g(Error("Bad token: "+a.a.next())),e=a.a.next(),(f=Xa[e]||m)||g(Error("No axis with name: "+e)),a.a.next(),W(a,"Missing node name")):f=Ua;e=A(a.a);if(/(?![0-9])[\w]/.test(e.charAt(0)))if("("==A(a.a,
1)){Ma(e)||g(Error("Invalid node type: "+e));c=a.a.next();Ma(c)||g(Error("Invalid type name: "+c));eb(a,"(");W(a,"Bad nodetype");e=A(a.a).charAt(0);var k=m;if('"'==e||"'"==e)k=gb(a);W(a,"Bad nodetype");fb(a);c=new F(c,k)}else c=hb(a);else"*"==e?c=hb(a):g(Error("Bad token: "+a.a.next()));e=new T(kb(a),f.q);return d||new U(f,c,e,"//"==b)}
function kb(a){for(var b=[];"["==A(a.a);){a.a.next();W(a,"Missing predicate expression.");var c=cb(a);b.push(c);W(a,"Unclosed predicate expression.");eb(a,"]")}return b}function db(a){if("-"==A(a.a))return a.a.next(),new $a(db(a));var b=ib(a);if("|"!=A(a.a))a=b;else{for(b=[b];"|"==a.a.next();)W(a,"Missing next union location path."),b.push(ib(a));a.a.back();a=new ab(b)}return a};function mb(a){a.length||g(Error("Empty XPath expression."));a=ra(a);a.empty()&&g(Error("Invalid XPath expression."));var b=cb(new bb(a));a.empty()||g(Error("Bad token: "+a.next()));this.evaluate=function(a,d){var e=b.evaluate(new z(a));return new X(e,d)}}
function X(a,b){0==b&&(a instanceof E?b=4:"string"==typeof a?b=2:"number"==typeof a?b=1:"boolean"==typeof a?b=3:g(Error("Unexpected evaluation result.")));2!=b&&(1!=b&&3!=b&&!(a instanceof E))&&g(Error("document.evaluate called with wrong result type."));this.resultType=b;var c;switch(b){case 2:this.stringValue=a instanceof E?Aa(a):""+a;break;case 1:this.numberValue=a instanceof E?+Aa(a):+a;break;case 3:this.booleanValue=a instanceof E?0=c.length?m:c[f++]};this.snapshotItem=function(a){6!=b&&7!=b&&g(Error("snapshotItem called with wrong result type."));return a>=c.length||0>a?m:c[a]}}X.ANY_TYPE=0;X.NUMBER_TYPE=1;X.STRING_TYPE=2;
X.BOOLEAN_TYPE=3;X.UNORDERED_NODE_ITERATOR_TYPE=4;X.ORDERED_NODE_ITERATOR_TYPE=5;X.UNORDERED_NODE_SNAPSHOT_TYPE=6;X.ORDERED_NODE_SNAPSHOT_TYPE=7;X.ANY_UNORDERED_NODE_TYPE=8;X.FIRST_ORDERED_NODE_TYPE=9;function nb(a){a=a||r;var b=a.document;b.evaluate||(a.XPathResult=X,b.evaluate=function(a,b,e,f){return(new mb(a)).evaluate(b,f)},b.createExpression=function(a){return new mb(a)})};var ob=function(){var a={da:"http://www.w3.org/2000/svg"};return function(b){return a[b]||m}}();function pb(a,b){var c=function(){var c;var e=na(b);pa&&nb(e?e.parentWindow||e.defaultView:window);try{var f=e.createNSResolver?e.createNSResolver(e.documentElement):ob;c=e.evaluate(a,b,f,7,m)}catch(k){g(new u(32,"Unable to locate an element with the xpath expression "+a+" because of the following error:\n"+k))}if(c){for(var e=c.snapshotLength,f=[],v=0;v




© 2015 - 2024 Weber Informatics LLC | Privacy Policy