~free.ekanayaka/lazr-js/update-gallery-form

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/node/node-base-min.js

  • Committer: Sidnei da Silva
  • Date: 2010-05-07 16:54:12 UTC
  • mfrom: (166.8.16 3.1.1)
  • Revision ID: sidnei.da.silva@canonical.com-20100507165412-odo3abigpalv0419
- Merge yui-3.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.1.0
6
 
build: 2026
 
5
version: 3.1.1
 
6
build: 47
7
7
*/
8
8
YUI.add("node-base",function(C){var G=".",E="nodeName",J="nodeType",B="ownerDocument",I="tagName",D="_yuid",F=C.DOM,H=function(M){var L=M[D];if(L&&H._instances[L]&&H._instances[L]._node!==M){M[D]=null;}L=C.stamp(M);if(!L){L=C.guid();}this[D]=L;this._node=M;H._instances[L]=this;this._stateProxy=M;if(this._initPlugins){this._initPlugins();}},K=function(M){var L=null;if(M){L=(typeof M==="string")?function(N){return C.Selector.test(N,M);}:function(N){return M(C.one(N));};}return L;};H.NAME="node";H.re_aria=/^(?:role$|aria-)/;H.DOM_EVENTS={abort:1,beforeunload:1,blur:1,change:1,changedTouches:1,click:1,close:1,command:1,contextmenu:1,dblclick:1,DOMMouseScroll:1,drag:1,dragstart:1,dragenter:1,dragover:1,dragleave:1,dragend:1,drop:1,error:1,focus:1,identifier:1,key:1,keydown:1,keypress:1,keyup:1,load:1,message:1,mousedown:1,mouseenter:1,mouseleave:1,mousemove:1,mousemultiwheel:1,mouseout:1,mouseover:1,mouseup:1,mousewheel:1,reset:1,resize:1,rotation:1,scale:1,select:1,submit:1,scroll:1,targetTouches:1,textInput:1,touches:1,unload:1};C.mix(H.DOM_EVENTS,C.Env.evt.plugins);H._instances={};H.getDOMNode=function(L){if(L){return(L.nodeType)?L:L._node||null;}return null;};H.scrubVal=function(M,L){if(L&&M){if(typeof M==="object"||typeof M==="function"){if(J in M||F.isWindow(M)){M=C.one(M);}else{if((M.item&&!M._nodes)||(M[0]&&M[0][J])){M=C.all(M);}}}}else{if(M===undefined){M=L;}}return M;};H.addMethod=function(L,N,M){if(L&&N&&typeof N==="function"){H.prototype[L]=function(){M=M||this;var P=C.Array(arguments,0,true),O;if(P[0]&&P[0] instanceof H){P[0]=P[0]._node;}if(P[1]&&P[1] instanceof H){P[1]=P[1]._node;}P.unshift(this._node);O=H.scrubVal(N.apply(M,P),this);return O;};}else{}};H.importMethod=function(N,L,M){if(typeof L==="string"){M=M||L;H.addMethod(M,N[L],N);}else{C.Array.each(L,function(O){H.importMethod(N,O);});}};H.one=function(O){var L=null,N,M;if(O){if(typeof O==="string"){if(O.indexOf("doc")===0){O=C.config.doc;}else{if(O.indexOf("win")===0){O=C.config.win;}else{O=C.Selector.query(O,null,true);}}if(!O){return null;}}else{if(O instanceof H){return O;}}M=O._yuid;L=H._instances[M];N=L?L._node:null;if(!L||(N&&O!==N)){L=new H(O);}}return L;};H.get=function(){return H.one.apply(H,arguments);};H.create=function(){return C.one(F.create.apply(F,arguments));};H.ATTRS={text:{getter:function(){return F.getText(this._node);},setter:function(L){F.setText(this._node,L);return L;}},"options":{getter:function(){return this._node.getElementsByTagName("option");}},"elements":{getter:function(){return C.all(this._node.elements);}},"children":{getter:function(){var O=this._node,N=O.children,P,M,L;if(!N){P=O.childNodes;N=[];for(M=0,L=P.length;M<L;++M){if(P[M][I]){N[N.length]=P[M];}}}return C.all(N);}},value:{getter:function(){return F.getValue(this._node);},setter:function(L){F.setValue(this._node,L);return L;}},data:{getter:function(){return this._dataVal;},setter:function(L){this._dataVal=L;return L;},value:null}};H.DEFAULT_SETTER=function(L,N){var M=this._stateProxy,O;if(L.indexOf(G)>-1){O=L;L=L.split(G);C.Object.setValue(M,L,N);}else{if(M[L]!==undefined){M[L]=N;}}return N;};H.DEFAULT_GETTER=function(L){var M=this._stateProxy,N;if(L.indexOf&&L.indexOf(G)>-1){N=C.Object.getValue(M,L.split(G));}else{if(M[L]!==undefined){N=M[L];}}return N;};C.augment(H,C.Event.Target);C.mix(H.prototype,{toString:function(){var N="",M=this[D]+": not bound to a node",L=this._node,O=L.getAttribute("id");if(L){N+=L[E];if(O){N+="#"+O;}if(L.className){N+="."+L.className.replace(" ",".");}N+=" "+this[D];}return N||M;},get:function(L){var M;if(this._getAttr){M=this._getAttr(L);}else{M=this._get(L);}if(M){M=H.scrubVal(M,this);}return M;},_get:function(L){var M=H.ATTRS[L],N;if(M&&M.getter){N=M.getter.call(this);}else{if(H.re_aria.test(L)){N=this._node.getAttribute(L,2);}else{N=H.DEFAULT_GETTER.apply(this,arguments);}}return N;},set:function(L,N){var M=H.ATTRS[L];if(this._setAttr){this._setAttr.apply(this,arguments);}else{if(M&&M.setter){M.setter.call(this,N);}else{if(H.re_aria.test(L)){this._node.setAttribute(L,N);}else{H.DEFAULT_SETTER.apply(this,arguments);}}}return this;},setAttrs:function(L){if(this._setAttrs){this._setAttrs(L);}else{C.Object.each(L,function(M,N){this.set(N,M);},this);}return this;},getAttrs:function(M){var L={};if(this._getAttrs){this._getAttrs(M);}else{C.Array.each(M,function(N,O){L[N]=this.get(N);},this);}return L;},create:H.create,compareTo:function(L){var M=this._node;if(L instanceof H){L=L._node;}return M===L;},inDoc:function(M){var L=this._node;M=(M)?M._node||M:L[B];if(M.documentElement){return F.contains(M.documentElement,L);}},getById:function(N){var M=this._node,L=F.byId(N,M[B]);if(L&&F.contains(M,L)){L=C.one(L);}else{L=null;}return L;},ancestor:function(L,M){return C.one(F.ancestor(this._node,K(L),M));},previous:function(M,L){return C.one(F.elementByAxis(this._node,"previousSibling",K(M),L));},next:function(M,L){return C.one(F.elementByAxis(this._node,"nextSibling",K(M),L));},siblings:function(L){return C.all(F.siblings(this._node,K(L)));},one:function(L){return C.one(C.Selector.query(L,this._node,true));},query:function(L){return this.one(L);},all:function(L){var M=C.all(C.Selector.query(L,this._node));M._query=L;M._queryRoot=this._node;return M;},queryAll:function(L){return this.all(L);},test:function(L){return C.Selector.test(this._node,L);},remove:function(M){var N=this._node,L=N.parentNode;if(L){L.removeChild(N);}if(M){this.destroy(true);}return this;},replace:function(L){var M=this._node;M.parentNode.replaceChild(H.getDOMNode(L),M);return this;},purge:function(M,L){C.Event.purgeElement(this._node,M,L);return this;},destroy:function(L){delete H._instances[this[D]];this.purge(L);if(this.unplug){this.unplug();}this._node._yuid=null;this._node=null;this._stateProxy=null;},invoke:function(S,M,L,R,Q,P){var O=this._node,N;if(M&&M instanceof H){M=M._node;}if(L&&L instanceof H){L=L._node;}N=O[S](M,L,R,Q,P);return H.scrubVal(N,this);},each:function(M,L){L=L||this;return M.call(L,this);},item:function(L){return this;},size:function(){return this._node?1:0;
9
 
},insert:function(N,L){var M=this._node;if(N){if(typeof L==="number"){L=this._node.childNodes[L];}else{if(L&&L._node){L=L._node;}}if(typeof N!=="string"){if(N._node){N=N._node;}else{if(N._nodes||(!N.nodeType&&N.length)){N=C.all(N);C.each(N._nodes,function(O){F.addHTML(M,O,L);});return this;}}}F.addHTML(M,N,L);}else{}return this;},prepend:function(L){return this.insert(L,0);},append:function(L){return this.insert(L,null);},setContent:function(L){if(L){if(L._node){L=L._node;}else{if(L._nodes){L=F._nl2Frag(L._nodes);}}}F.addHTML(this._node,L,"replace");return this;},swap:document.documentElement.swapNode?function(L){this._node.swapNode(H.getDOMNode(L));}:function(L){L=H.getDOMNode(L);var N=this._node,M=L.parentNode,O=L.nextSibling;if(O===N){M.insertBefore(N,L);}else{if(L===N.nextSibling){M.insertBefore(L,N);}else{N.parentNode.replaceChild(L,N);F.addHTML(M,N,O);}}return this;},getData:function(M){var L;this._data=this._data||{};if(arguments.length){L=this._data[M];}else{L=this._data;}return L;},setData:function(L,M){this._data=this._data||{};if(arguments.length>1){this._data[L]=M;}else{this._data=L;}return this;},clearData:function(L){if(arguments.length){delete this._data[L];}else{this._data={};}return this;},hasMethod:function(M){var L=this._node;return(L&&L[M]&&(typeof L[M]==="function"));}},true);C.Node=H;C.get=C.Node.get;C.one=C.Node.one;var A=function(L){var M=[];if(typeof L==="string"){this._query=L;L=C.Selector.query(L);}else{if(L.nodeType){L=[L];}else{if(L instanceof C.Node){L=[L._node];}else{if(L[0] instanceof C.Node){C.Array.each(L,function(N){if(N._node){M.push(N._node);}});L=M;}else{L=C.Array(L,0,true);}}}}A._instances[C.stamp(this)]=this;this._nodes=L;};A.NAME="NodeList";A.getDOMNodes=function(L){return L._nodes;};A._instances=[];A.each=function(L,O,N){var M=L._nodes;if(M&&M.length){C.Array.each(M,O,N||L);}else{}};A.addMethod=function(L,N,M){if(L&&N){A.prototype[L]=function(){var P=[],O=arguments;C.Array.each(this._nodes,function(U){var T="_yuid",R=C.Node._instances[U[T]],S,Q;if(!R){R=A._getTempNode(U);}S=M||R;Q=N.apply(S,O);if(Q!==undefined&&Q!==R){P[P.length]=Q;}});return P.length?P:this;};}else{}};A.importMethod=function(N,L,M){if(typeof L==="string"){M=M||L;A.addMethod(L,N[L]);}else{C.Array.each(L,function(O){A.importMethod(N,O);});}};A._getTempNode=function(M){var L=A._tempNode;if(!L){L=C.Node.create("<div></div>");A._tempNode=L;}L._node=M;L._stateProxy=M;return L;};C.mix(A.prototype,{item:function(L){return C.one((this._nodes||[])[L]);},each:function(N,M){var L=this;C.Array.each(this._nodes,function(P,O){P=C.one(P);return N.call(M||P,P,O,L);});return L;},batch:function(M,L){var N=this;C.Array.each(this._nodes,function(Q,P){var O=C.Node._instances[Q[D]];if(!O){O=A._getTempNode(Q);}return M.call(L||O,O,P,N);});return N;},some:function(N,M){var L=this;return C.Array.some(this._nodes,function(P,O){P=C.one(P);M=M||P;return N.call(M,P,O,L);});},toFrag:function(){return C.one(C.DOM._nl2frag(this._nodes));},indexOf:function(L){return C.Array.indexOf(this._nodes,C.Node.getDOMNode(L));},filter:function(L){return C.all(C.Selector.filter(this._nodes,L));},modulus:function(N,M){M=M||0;var L=[];A.each(this,function(P,O){if(O%N===M){L.push(P);}});return C.all(L);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[D]];},refresh:function(){var O,M=this._nodes,N=this._query,L=this._queryRoot;if(N){if(!L){if(M&&M[0]&&M[0].ownerDocument){L=M[0].ownerDocument;}}this._nodes=C.Selector.query(N,L);}return this;},on:function(O,N,M){var L=C.Array(arguments,0,true);L.splice(2,0,this._nodes);L[3]=M||this;return C.on.apply(C,L);},after:function(O,N,M){var L=C.Array(arguments,0,true);L.splice(2,0,this._nodes);L[3]=M||this;return C.after.apply(C,L);},size:function(){return this._nodes.length;},isEmpty:function(){return this._nodes.length<1;},toString:function(){var O="",N=this[D]+": not bound to any nodes",L=this._nodes,M;if(L&&L[0]){M=L[0];O+=M[E];if(M.id){O+="#"+M.id;}if(M.className){O+="."+M.className.replace(" ",".");}if(L.length>1){O+="...["+L.length+" items]";}}return O||N;}},true);A.importMethod(C.Node.prototype,["append","detach","detachAll","insert","prepend","remove","removeAttribute","set","setContent"]);A.prototype.get=function(M){var P=[],O=this._nodes,N=false,Q=A._getTempNode,L,R;if(O[0]){L=C.Node._instances[O[0]._yuid]||Q(O[0]);R=L._get(M);if(R&&R.nodeType){N=true;}}C.Array.each(O,function(S){L=C.Node._instances[S._yuid];if(!L){L=Q(S);}R=L._get(M);if(!N){R=C.Node.scrubVal(R,L);}P.push(R);});return(N)?C.all(P):P;};C.NodeList=A;C.all=function(L){return new A(L);};C.Node.all=C.all;C.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(L){C.Node.prototype[L]=function(P,N,M){var O=this.invoke(L,P,N,M);return O;};});C.Node.importMethod(C.DOM,["contains","setAttribute","getAttribute"]);C.NodeList.importMethod(C.Node.prototype,["getAttribute","setAttribute","removeAttribute"]);(function(M){var L=["hasClass","addClass","removeClass","replaceClass","toggleClass"];M.Node.importMethod(M.DOM,L);M.NodeList.importMethod(M.Node.prototype,L);})(C);if(!document.documentElement.hasAttribute){C.Node.prototype.hasAttribute=function(L){return !!(this._node.attributes[L]&&this._node.attributes[L].specified);};}C.Node.ATTRS.type={setter:function(M){if(M==="hidden"){try{this._node.type="hidden";}catch(L){this.setStyle("display","none");this._inputType="hidden";}}else{try{this._node.type=M;}catch(L){}}return M;},getter:function(){return this._inputType||this._node.type;},_bypassProxy:true};},"3.1.0",{requires:["dom-base","selector-css2","event-base"]});
 
 
b'\\ No newline at end of file'
 
9
},insert:function(N,L){var M=this._node;if(N){if(typeof L==="number"){L=this._node.childNodes[L];}else{if(L&&L._node){L=L._node;}}if(typeof N!=="string"){if(N._node){N=N._node;}else{if(N._nodes||(!N.nodeType&&N.length)){N=C.all(N);C.each(N._nodes,function(O){F.addHTML(M,O,L);});return this;}}}F.addHTML(M,N,L);}else{}return this;},prepend:function(L){return this.insert(L,0);},append:function(L){return this.insert(L,null);},setContent:function(L){if(L){if(L._node){L=L._node;}else{if(L._nodes){L=F._nl2Frag(L._nodes);}}}F.addHTML(this._node,L,"replace");return this;},swap:document.documentElement.swapNode?function(L){this._node.swapNode(H.getDOMNode(L));}:function(L){L=H.getDOMNode(L);var N=this._node,M=L.parentNode,O=L.nextSibling;if(O===N){M.insertBefore(N,L);}else{if(L===N.nextSibling){M.insertBefore(L,N);}else{N.parentNode.replaceChild(L,N);F.addHTML(M,N,O);}}return this;},getData:function(M){var L;this._data=this._data||{};if(arguments.length){L=this._data[M];}else{L=this._data;}return L;},setData:function(L,M){this._data=this._data||{};if(arguments.length>1){this._data[L]=M;}else{this._data=L;}return this;},clearData:function(L){if(arguments.length){delete this._data[L];}else{this._data={};}return this;},hasMethod:function(M){var L=this._node;return(L&&L[M]&&(typeof L[M]==="function"));}},true);C.Node=H;C.get=C.Node.get;C.one=C.Node.one;var A=function(L){var M=[];if(typeof L==="string"){this._query=L;L=C.Selector.query(L);}else{if(L.nodeType){L=[L];}else{if(L instanceof C.Node){L=[L._node];}else{if(L[0] instanceof C.Node){C.Array.each(L,function(N){if(N._node){M.push(N._node);}});L=M;}else{L=C.Array(L,0,true);}}}}A._instances[C.stamp(this)]=this;this._nodes=L;};A.NAME="NodeList";A.getDOMNodes=function(L){return L._nodes;};A._instances=[];A.each=function(L,O,N){var M=L._nodes;if(M&&M.length){C.Array.each(M,O,N||L);}else{}};A.addMethod=function(L,N,M){if(L&&N){A.prototype[L]=function(){var P=[],O=arguments;C.Array.each(this._nodes,function(U){var T="_yuid",R=C.Node._instances[U[T]],S,Q;if(!R){R=A._getTempNode(U);}S=M||R;Q=N.apply(S,O);if(Q!==undefined&&Q!==R){P[P.length]=Q;}});return P.length?P:this;};}else{}};A.importMethod=function(N,L,M){if(typeof L==="string"){M=M||L;A.addMethod(L,N[L]);}else{C.Array.each(L,function(O){A.importMethod(N,O);});}};A._getTempNode=function(M){var L=A._tempNode;if(!L){L=C.Node.create("<div></div>");A._tempNode=L;}L._node=M;L._stateProxy=M;return L;};C.mix(A.prototype,{item:function(L){return C.one((this._nodes||[])[L]);},each:function(N,M){var L=this;C.Array.each(this._nodes,function(P,O){P=C.one(P);return N.call(M||P,P,O,L);});return L;},batch:function(M,L){var N=this;C.Array.each(this._nodes,function(Q,P){var O=C.Node._instances[Q[D]];if(!O){O=A._getTempNode(Q);}return M.call(L||O,O,P,N);});return N;},some:function(N,M){var L=this;return C.Array.some(this._nodes,function(P,O){P=C.one(P);M=M||P;return N.call(M,P,O,L);});},toFrag:function(){return C.one(C.DOM._nl2frag(this._nodes));},indexOf:function(L){return C.Array.indexOf(this._nodes,C.Node.getDOMNode(L));},filter:function(L){return C.all(C.Selector.filter(this._nodes,L));},modulus:function(N,M){M=M||0;var L=[];A.each(this,function(P,O){if(O%N===M){L.push(P);}});return C.all(L);},odd:function(){return this.modulus(2,1);},even:function(){return this.modulus(2);},destructor:function(){delete A._instances[this[D]];},refresh:function(){var O,M=this._nodes,N=this._query,L=this._queryRoot;if(N){if(!L){if(M&&M[0]&&M[0].ownerDocument){L=M[0].ownerDocument;}}this._nodes=C.Selector.query(N,L);}return this;},on:function(O,N,M){var L=C.Array(arguments,0,true);L.splice(2,0,this._nodes);L[3]=M||this;return C.on.apply(C,L);},after:function(O,N,M){var L=C.Array(arguments,0,true);L.splice(2,0,this._nodes);L[3]=M||this;return C.after.apply(C,L);},size:function(){return this._nodes.length;},isEmpty:function(){return this._nodes.length<1;},toString:function(){var O="",N=this[D]+": not bound to any nodes",L=this._nodes,M;if(L&&L[0]){M=L[0];O+=M[E];if(M.id){O+="#"+M.id;}if(M.className){O+="."+M.className.replace(" ",".");}if(L.length>1){O+="...["+L.length+" items]";}}return O||N;}},true);A.importMethod(C.Node.prototype,["append","detach","detachAll","insert","prepend","remove","removeAttribute","set","setContent"]);A.prototype.get=function(M){var P=[],O=this._nodes,N=false,Q=A._getTempNode,L,R;if(O[0]){L=C.Node._instances[O[0]._yuid]||Q(O[0]);R=L._get(M);if(R&&R.nodeType){N=true;}}C.Array.each(O,function(S){L=C.Node._instances[S._yuid];if(!L){L=Q(S);}R=L._get(M);if(!N){R=C.Node.scrubVal(R,L);}P.push(R);});return(N)?C.all(P):P;};C.NodeList=A;C.all=function(L){return new A(L);};C.Node.all=C.all;C.Array.each(["replaceChild","appendChild","insertBefore","removeChild","hasChildNodes","cloneNode","hasAttribute","removeAttribute","scrollIntoView","getElementsByTagName","focus","blur","submit","reset","select"],function(L){C.Node.prototype[L]=function(P,N,M){var O=this.invoke(L,P,N,M);return O;};});C.Node.importMethod(C.DOM,["contains","setAttribute","getAttribute"]);C.NodeList.importMethod(C.Node.prototype,["getAttribute","setAttribute","removeAttribute"]);(function(M){var L=["hasClass","addClass","removeClass","replaceClass","toggleClass"];M.Node.importMethod(M.DOM,L);M.NodeList.importMethod(M.Node.prototype,L);})(C);if(!document.documentElement.hasAttribute){C.Node.prototype.hasAttribute=function(L){return !!(this._node.attributes[L]&&this._node.attributes[L].specified);};}C.Node.ATTRS.type={setter:function(M){if(M==="hidden"){try{this._node.type="hidden";}catch(L){this.setStyle("display","none");this._inputType="hidden";}}else{try{this._node.type=M;}catch(L){}}return M;},getter:function(){return this._inputType||this._node.type;},_bypassProxy:true};},"3.1.1",{requires:["dom-base","selector-css2","event-base"]});
 
 
b'\\ No newline at end of file'