1/* 2 SpryDOMUtils.js - version 0.14 - Spry Pre-Release 1.7 3 4 Copyright (c) 2007. Adobe Systems Incorporated. 5 All rights reserved. 6 7 Redistribution and use in source and binary forms, with or without 8 modification, are permitted provided that the following conditions are met: 9 10 Redistributions of source code must retain the above copyright notice, 11 this list of conditions and the following disclaimer. 12 Redistributions in binary form must reproduce the above copyright notice, 13 this list of conditions and the following disclaimer in the documentation 14 and/or other materials provided with the distribution. 15 Neither the name of Adobe Systems Incorporated nor the names of its 16 contributors may be used to endorse or promote products derived from this 17 software without specific prior written permission. 18 19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 POSSIBILITY OF SUCH DAMAGE. 30*/ 31(function(){if(typeof Spry=="undefined")window.Spry={};if(!Spry.Utils)Spry.Utils={};Spry.$=function(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push(Spry.$(arguments[b]));return c}typeof a=="string"&&(a=document.getElementById(a));return a};Spry.Utils.getAttribute=function(a,b){a=Spry.$(a);if(!a||!b)return null;try{var c=a.getAttribute(b)}catch(d){}if(c==void 0&&b.search(/:/)!=-1)try{c=a.getAttribute(b.replace(/:/,""))}catch(e){}return c};Spry.Utils.setAttribute=function(a, 32b,c){if((a=Spry.$(a))&&b)if(b=="class")a.className=c;else{try{a.setAttribute(b,c)}catch(d){}b.search(/:/)!=-1&&a.getAttribute(b)==void 0&&a.setAttribute(b.replace(/:/,""),c)}};Spry.Utils.removeAttribute=function(a,b){if((a=Spry.$(a))&&b){try{a.removeAttribute(b)}catch(c){}b.search(/:/)!=-1&&a.removeAttribute(b.replace(/:/,""));b=="class"&&a.removeAttribute("className")}};Spry.Utils.addClassName=function(a,b){(a=Spry.$(a))&&b&&!(a.className&&a.className.search(RegExp("\\b"+b+"\\b"))!=-1)&&(a.className+= 33(a.className?" ":"")+b)};Spry.Utils.removeClassName=function(a,b){a=Spry.$(a);if(Spry.Utils.hasClassName(a,b))a.className=a.className.replace(RegExp("\\s*\\b"+b+"\\b","g"),"")};Spry.Utils.toggleClassName=function(a,b){Spry.Utils.hasClassName(a,b)?Spry.Utils.removeClassName(a,b):Spry.Utils.addClassName(a,b)};Spry.Utils.hasClassName=function(a,b){a=Spry.$(a);if(!a||!b||!a.className||a.className.search(RegExp("\\b"+b+"\\b"))==-1)return!1;return!0};Spry.Utils.camelizeString=function(a){for(var b="",a= 34a.split("-"),c=0;c<a.length;c++){var d=a[c];d&&(b=b?b+d.charAt(0).toUpperCase()+d.substring(1):d)}return b};Spry.Utils.styleStringToObject=function(a){var b={};if(a)for(var a=a.split(";"),c=0;c<a.length;c++){var d=a[c];if(d&&d.indexOf(":")!=-1){var e=d.split(":"),d=e[0].replace(/^\s*|\s*$/g,""),e=e[1].replace(/^\s*|\s*$/g,"");d&&e&&(b[Spry.Utils.camelizeString(d)]=e)}}return b};Spry.Utils.addEventListener=function(a,b,c,d){try{Spry.Utils.eventListenerIsBoundToElement(a,b,c,d)||(a=Spry.$(a),c=Spry.Utils.bindEventListenerToElement(a, 35b,c,d),a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c))}catch(e){}};Spry.Utils.removeEventListener=function(a,b,c,d){try{a=Spry.$(a),c=Spry.Utils.unbindEventListenerFromElement(a,b,c,d),a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)}catch(e){}};Spry.Utils.eventListenerHash={};Spry.Utils.nextEventListenerID=1;Spry.Utils.getHashForElementAndHandler=function(a,b,c,d){var e=null;if(a=Spry.$(a)){if(typeof a.spryEventListenerID== 36"undefined")a.spryEventListenerID="e"+Spry.Utils.nextEventListenerID++;if(typeof c.spryEventHandlerID=="undefined")c.spryEventHandlerID="h"+Spry.Utils.nextEventListenerID++;e=a.spryEventListenerID+"-"+c.spryEventHandlerID+"-"+b+(d?"-capture":"")}return e};Spry.Utils.eventListenerIsBoundToElement=function(a,b,c,d){a=Spry.$(a);a=Spry.Utils.getHashForElementAndHandler(a,b,c,d);return Spry.Utils.eventListenerHash[a]!=void 0};Spry.Utils.bindEventListenerToElement=function(a,b,c,d){a=Spry.$(a);b=Spry.Utils.getHashForElementAndHandler(a, 37b,c,d);if(Spry.Utils.eventListenerHash[b])return Spry.Utils.eventListenerHash[b];return Spry.Utils.eventListenerHash[b]=function(b){b=b||window.event;if(!b.preventDefault)b.preventDefault=function(){this.returnValue=!1};if(!b.stopPropagation)b.stopPropagation=function(){this.cancelBubble=!0};var d=c.call(a,b);d==!1&&(b.preventDefault(),b.stopPropagation());return d}};Spry.Utils.unbindEventListenerFromElement=function(a,b,c,d){a=Spry.$(a);a=Spry.Utils.getHashForElementAndHandler(a,b,c,d);Spry.Utils.eventListenerHash[a]&& 38(c=Spry.Utils.eventListenerHash[a],Spry.Utils.eventListenerHash[a]=void 0);return c};Spry.Utils.cancelEvent=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;return!1};Spry.Utils.addLoadListener=function(a){typeof window.addEventListener!="undefined"?window.addEventListener("load",a,!1):typeof document.addEventListener!="undefined"?document.addEventListener("load",a,!1):typeof window.attachEvent!="undefined"&&window.attachEvent("onload", 39a)};Spry.Utils.isDescendant=function(a,b){if(a&&b)for(b=b.parentNode;b;){if(a==b)return!0;b=b.parentNode}return!1};Spry.Utils.getAncestor=function(a,b){if(a=Spry.$(a)){var c=Spry.$$.tokenizeSequence(b?b:"*")[0];if(c=c?c[0]:null)for(var d=a.parentNode;d;){if(c.match(d))return d;d=d.parentNode}}return null};Spry.Utils.preorderTraversal=function(a,b){var c=!1;
39if(a&&(c=b(a),a.hasChildNodes()))for(var d=a.firstChild;!c&&d;){c=Spry.Utils.preorderTraversal(d,b);try{d=d.nextSibling}catch(e){d=null}}return c}; 40Spry.$$=function(a,b){var c=[];Spry.$$.addExtensions(c);if(typeof arguments[0]=="object"){for(var d=0;d<arguments.length;d++)arguments[d].constructor==Array?c.push.apply(c,arguments[d]):c.push(arguments[d]);return c}var b=b?Spry.$(b):document,e=Spry.$$.tokenizeSequence(a);++Spry.$$.queryID;for(var f=0,g=e.length,d=0;d<g;d++)for(var h=Spry.$$.processTokens(e[d],b),i=h.length,j=0;j<i;j++){var k=h[j];if(!k.spry$$ID)k.spry$$ID=++f,c.push(k)}i=c.length;for(d=0;d<i;d++)c[d].spry$$ID=void 0;return c};Spry.$$.cache= 41{};Spry.$$.queryID=0;Spry.$$.Token=function(){this.type=Spry.$$.Token.SELECTOR;this.name="*";this.id="";this.classes=[];this.attrs=[];this.pseudos=[]};Spry.$$.Token.Attr=function(a,b){this.name=a;this.value=b?RegExp(b):void 0};Spry.$$.Token.PseudoClass=function(a){this.name=a.replace(/\(.*/,"");this.arg=a.replace(/^[^\(\)]*\(?\s*|\)\s*$/g,"");this.func=Spry.$$.pseudoFuncs[this.name]};Spry.$$.Token.SELECTOR=0;Spry.$$.Token.COMBINATOR=1;Spry.$$.Token.prototype.match=function(a,b){if(this.type==Spry.$$.Token.COMBINATOR)return!1; 42if(!b&&this.name!="*"&&this.name!=a.nodeName.toLowerCase())return!1;if(this.id&&this.id!=a.id)return!1;for(var c=this.classes,d=c.length,e=0;e<d;e++)if(!a.className||!c[e].value.test(a.className))return!1;c=this.attrs;d=c.length;for(e=0;e<d;e++){var f=c[e],g=a.attributes.getNamedItem(f.name);if(!g||!f.value&&g.nodeValue==void 0||f.value&&!f.value.test(g.nodeValue))return!1}c=this.pseudos;d=c.length;for(e=0;e<d;e++)if((f=c[e])&&f.func&&!f.func(f.arg,a,this))return!1;return!0};Spry.$$.Token.prototype.getNodeNameIfTypeMatches= 43function(a){a=a.nodeName.toLowerCase();if(this.name!="*"){if(this.name!=a)return null;return this.name}return a};Spry.$$.escapeRegExpCharsRE=/\/|\.|\*|\+|\(|\)|\[|\]|\{|\}|\\|\|/g;Spry.$$.tokenizeSequence=function(a){var b=Spry.$$.cache[a];if(b)return b;var b=/(\[[^\"'~\^\$\*\|\]=]+([~\^\$\*\|]?=\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\])|((:[^\.#:\s,>~\+\[\]]+\(([^\(\)]+|\([^\(\)]*\))*\))|[\.#:]?[^\.#:\s,>~\+\[\]]+)|(\s*[\s,>~\+]\s*)/g,c=new Spry.$$.Token,d=[];d.push(c);var e=[];e.push(d);for(var a=a.replace(/^\s*|\s*$/, 44""),f=b.exec(a);f;){f=f[0];switch(f.charAt(0)){case ".":c.classes.push(new Spry.$$.Token.Attr("class","\\b"+f.substr(1)+"\\b"));break;case "#":c.id=f.substr(1);break;case ":":c.pseudos.push(new Spry.$$.Token.PseudoClass(f));break;case "[":var g=f.match(/\[([^\"'~\^\$\*\|\]=]+)(([~\^\$\*\|]?=)\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\]/),f=g[1],h=g[3];if(g=g[4])g=g.replace(/^['"]|['"]$/g,""),g=g.replace(Spry.$$.escapeRegExpCharsRE,"\\$&");var i=void 0;switch(h){case "=":i="^"+g+"$";break;case "^=":i="^"+ 45g;break;case "$=":i=g+"$";break;case "~=":case "|=":i="\\b"+g+"\\b";break;case "*=":i=g}c.attrs.push(new Spry.$$.Token.Attr(f,i));break;default:(h=f.match(/^\s*([\s,~>\+])\s*$/))?(h[1]==","?(d=[],e.push(d)):(c=new Spry.$$.Token,c.type=Spry.$$.Token.COMBINATOR,c.name=h[1],d.push(c)),c=new Spry.$$.Token,d.push(c)):c.name=f.toLowerCase()}f=b.exec(a)}return Spry.$$.cache[a]=e};Spry.$$.combinatorFuncs={" ":function(a,b){for(var c=++Spry.$$.uniqueID,d=[],e=a.length,f=0;f<e;f++)if(c!=a[f].spry$$uid)for(var g= 46a[f].getElementsByTagName(b.name),h=g.length,i=0;i<h;i++){var j=g[i];j.nodeType==1&&b.match(j,!0)&&d.push(j);j.spry$$uid=c}return d},">":function(a,b){for(var c=[],d=a.length,e=0;e<d;e++)for(var f=a[e].firstChild;f;
46)f.nodeType==1&&b.match(f)&&c.push(f),f=f.nextSibling;return c},"+":function(a,b){for(var c=[],d=a.length,e=0;e<d;e++){for(var f=a[e].nextSibling;f&&f.nodeType!=1;)f=f.nextSibling;f&&b.match(f)&&c.push(f)}return c},"~":function(a,b){for(var c=++Spry.$$.uniqueID,d=[],e=a.length,f=0;f<e;f++)for(var g= 47a[f].nextSibling;g;){if(g.nodeType==1){if(c==g.spry$$uid)break;if(b.match(g))d.push(g),g.spry$$uid=c}g=g.nextSibling}return d}};Spry.$$.uniqueID=0;Spry.$$.pseudoFuncs={":first-child":function(a,b){for(var c=b.previousSibling;c;){if(c.nodeType==1)return!1;c=c.previousSibling}return!0},":last-child":function(a,b){for(var c=b.nextSibling;c;){if(c.nodeType==1)return!1;c=c.nextSibling}return!0},":empty":function(a,b){for(var c=b.firstChild;c;){switch(c.nodeType){case 1:case 3:case 4:case 5:return!1}c= 48c.nextSibling}return!0},":nth-child":function(a,b,c){return Spry.$$.nthChild(a,b,c)},":nth-last-child":function(a,b,c){return Spry.$$.nthChild(a,b,c,!0)},":nth-of-type":function(a,b,c){return Spry.$$.nthChild(a,b,c,!1,!0)},":nth-last-of-type":function(a,b,c){return Spry.$$.nthChild(a,b,c,!0,!0)},":first-of-type":function(a,b,c){a=c.getNodeNameIfTypeMatches(b);if(!a)return!1;for(b=b.previousSibling;b;){if(b.nodeType==1&&a==b.nodeName.toLowerCase())return!1;b=b.previousSibling}return!0},":last-of-type":function(a, 49b,c){a=c.getNodeNameIfTypeMatches(b);if(!a)return!1;for(b=b.nextSibling;b;){if(b.nodeType==1&&a==b.nodeName.toLowerCase())return!1;b=b.nextSibling}return!0},":only-child":function(a,b,c){var d=Spry.$$.pseudoFuncs;return d[":first-child"](a,b,c)&&d[":last-child"](a,b,c)},":only-of-type":function(a,b,c){var d=Spry.$$.pseudoFuncs;return d[":first-of-type"](a,b,c)&&d[":last-of-type"](a,b,c)},":not":function(a,b){var c=Spry.$$.tokenizeSequence(a)[0],c=c?c[0]:null;return!c||!c.match(b)},":enabled":function(a, 50b){return!b.disabled},":disabled":function(a,b){return b.disabled},":checked":function(a,b){return b.checked},":root":function(a,b){return b.parentNode&&b.ownerDocument&&b.parentNode==b.ownerDocument}};Spry.$$.nthRegExp=/((-|[0-9]+)?n)?([+-]?[0-9]*)/;Spry.$$.nthCache={even:{a:2,b:0,mode:1,invalid:!1},odd:{a:2,b:1,mode:1,invalid:!1},"2n":{a:2,b:0,mode:1,invalid:!1},"2n+1":{a:2,b:1,mode:1,invalid:!1}};Spry.$$.parseNthChildString=function(a){var b=Spry.$$.nthCache[a];if(!b){var c=a.match(Spry.$$.nthRegExp), 51b=c[1],d=c[2],c=c[3],d=d?d=="-"?-1:parseInt(d,10):b?1:0,c=c?parseInt(c,10):0,e=d==0?0:d>0?1:-1,f=!1;d>0&&c<0?(c%=d,c=(c%=d)<0?d+c:c):d<0&&(c<0?f=!0:d=Math.abs(d));b={};b.a=d;b.b=c;b.mode=e;b.invalid=f;Spry.$$.nthCache[a]=b}return b};Spry.$$.nthChild=function(a,b,c,d,e){if(e){var f=c.getNodeNameIfTypeMatches(b);if(!f)return!1}a=Spry.$$.parseNthChildString(a);if(a.invalid)return!1;var g="spry$$ncQueryID",c="spry$$ncPos",h="spry$$ncCount";e&&(g+=f,c+=f,h+=f);var i=b.parentNode;if(i[g]!=Spry.$$.queryID){var j= 520;i[g]=Spry.$$.queryID;for(g=i.firstChild;g;){if(g.nodeType==1&&(!e||f==g.nodeName.toLowerCase()))g[c]=++j;g=g.nextSibling}i[h]=j}j=b[c];d&&(j=i[h]-j+1);if(a.mode==0)return j==a.b;if(a.mode>0)return j<a.b?!1:!((j-a.b)%a.a);return j>a.b?!1:!((a.b-j)%a.a)};Spry.$$.processTokens=function(a,b){for(var c=a.length,d=[b],e=null,f=0;f<c&&d.length>0;f++){var g=a[f];g.type==Spry.$$.Token.SELECTOR?e?(d=e(d,g),e=null):d=Spry.$$.getMatchingElements(d,g):e=Spry.$$.combinatorFuncs[g.name]}return d};Spry.$$.getMatchingElements= 53function(a,b){var c=[];if(b.id&&(f=a[0])&&f.ownerDocument)return(f=f.ownerDocument.getElementById(b.id))&&b.match(f)&&
53c.push(f),c;for(var d=a.length,e=0;e<d;e++)for(var f=a[e],g=f.getElementsByTagName(b.name),h=g.length,i=0;i<h;i++)f=g[i],f.nodeType==1&&b.match(f,!0)&&c.push(f);return c};Spry.$$.addExtensions=function(a){for(var b in Spry.$$.Results)a[b]=Spry.$$.Results[b]};Spry.$$.Results={};Spry.$$.Results.forEach=function(a){for(var b=this.length,c=0;c<b;c++)a(this[c]);return this};Spry.$$.Results.setAttribute= 54function(a,b){return this.forEach(function(c){Spry.Utils.setAttribute(c,a,b)})};Spry.$$.Results.removeAttribute=function(a){return this.forEach(function(b){Spry.Utils.removeAttribute(b,a)})};Spry.$$.Results.addClassName=function(a){return this.forEach(function(b){Spry.Utils.addClassName(b,a)})};Spry.$$.Results.removeClassName=function(a){return this.forEach(function(b){Spry.Utils.removeClassName(b,a)})};Spry.$$.Results.toggleClassName=function(a){return this.forEach(function(b){Spry.Utils.toggleClassName(b, 55a)})};Spry.$$.Results.addEventListener=function(a,b,c,d){return this.forEach(function(e){Spry.Utils.addEventListener(e,a,b,c,d)})};Spry.$$.Results.removeEventListener=function(a,b,c){return this.forEach(function(d){Spry.Utils.removeEventListener(d,a,b,c)})};Spry.$$.Results.setStyle=function(a){a&&(a=Spry.Utils.styleStringToObject(a),this.forEach(function(b){for(var c in a)try{b.style[c]=a[c]}catch(d){}}));return this};Spry.$$.Results.setProperty=function(a,b){if(a){if(typeof a=="string"){var c={}; 56c[a]=b;a=c}this.forEach(function(b){for(var c in a)try{b[c]=a[c]}catch(f){}})}return this}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.