You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by bb...@apache.org on 2007/09/13 02:48:19 UTC

svn commit: r575149 - in /incubator/xap/site/javascript/xmodify: xmodify-jquery-compressed.js xmodify-jquery.js

Author: bbuffone
Date: Wed Sep 12 19:48:19 2007
New Revision: 575149

URL: http://svn.apache.org/viewvc?rev=575149&view=rev
Log:
fixed error with xModify in jQuery 1.2

Modified:
    incubator/xap/site/javascript/xmodify/xmodify-jquery-compressed.js
    incubator/xap/site/javascript/xmodify/xmodify-jquery.js

Modified: incubator/xap/site/javascript/xmodify/xmodify-jquery-compressed.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-jquery-compressed.js?rev=575149&r1=575148&r2=575149&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-jquery-compressed.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-jquery-compressed.js Wed Sep 12 19:48:19 2007
@@ -1 +1 @@
-$.extend({xmodifyVersion:"0.3.0",xmodify:function(_1){var _2=_1.complete;_1.complete=function(_3,_4){if(_3.responseXML==null){_1.error.call(this,_3,_4);}else{jQuery.xProc(_3.responseXML);if(_2){_2.call(this,_3,_4);}}};return jQuery.ajax(_1);},xProc:function(_5){var _6={};jQuery.each(_5.documentElement.childNodes,function(){if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="modifications"){jQuery.each(this.childNodes,function(){if(this.nodeType==1){jQuery.xProcElem(this,_6);}});}});},xProcElem:function(_7,_8){var _9=jQuery.xNodeName(_7.nodeName);var _a=_7.getAttribute("select");if(_9=="append"){jQuery.xProcIn(_7.childNodes,function(_b){$(_a).append(_b);},_8);}else{if(_9=="set-attribute"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){$(_a).attr(this.getAttribute("name"),this.getAttribute("value"));}});}else{if(_9=="set-style"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){$(_a).css(this.getAttribute("name"),this.getAttribute("value"));}});}else{if(_
 9=="insert-before"){jQuery.xProcIn(_7.childNodes,function(_c){$(_a).before(_c);},_8);}else{if(_9=="insert-after"){jQuery.xProcIn(_7.childNodes,function(_d){$(_a).after(_d);},_8);}else{if(_9=="replace-children"||_9=="set-innerhtml"){$(_a).empty();jQuery.xProcIn(_7.childNodes,function(_e){$(_a).append(_e);},_8);}else{if(_9=="remove-element"){$(_a).remove();}else{if(_9=="remove-attribute"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){$(_a).removeAttr(this.getAttribute("name"));}});}else{if(_9=="replace"){$(_a).each(function(){if(this.nextSibling){var _f=this.nextSibling;$(this).remove();jQuery.xProcIn(_7.childNodes,function(_10){$(_f).before(_10);},_8);}else{var _11=this.parentNode;$(this).remove();jQuery.xProcIn(_7.childNodes,function(_12){$(_11).append(_12);},_8);}});}else{if(_9=="insert-at"){var _13=_7.getAttribute("index");$(_a).each(function(){var _14=null;var _15=this;if(this.childNodes.length>_13){_14=this.childNodes[_13];}jQuery.xProcIn(_7.childNodes,functi
 on(_16){if(_14){$(_14).before(_16);}else{$(_15).append(_16);}},_8);});}else{if(_9=="variable"){var _17=_7.getAttribute("name");var _18=_7.getAttribute("deep");_8[_17]=$(_a).clone(_18);}}}}}}}}}}}},xProcIn:function(_19,_1a,_1b){$(_19).each(function(){if((this.nodeType==3||this.nodeType==4)&&jQuery.trim(this.nodeValue)!=""){_1a.call(this,this.nodeValue);}else{if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="value-of"){_1a.call(this,_1b[this.getAttribute("name")]);}else{if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="clone"){var _1c=this.getAttribute("select");var _1d=this.getAttribute("deep");_1a.call(this,$(_1c).clone(_1d));}else{if(this.nodeType==1){_1a.call(this,jQuery.xConvertToString(this));}}}}});},xConvertToString:function(_1e){var _1f="<"+_1e.nodeName;if(_1e.attributes){for(var i=0;i<_1e.attributes.length;i++){_1f+=" "+_1e.attributes[i].name+"=\""+_1e.attributes[i].value+"\"";}}_1f+=">";for(var i=0;i<_1e.childNodes.length;i++){if(_1e.childNodes[i].nodeType
 ==1){_1f+=jQuery.xConvertToString(_1e.childNodes[i]);}else{_1f+=_1e.childNodes[i].nodeValue;}}_1f+="</"+_1e.nodeName+">";return _1f;},xNodeName:function(_22){var i=_22.indexOf(":");if(i!=-1){_22=_22.substring(i+1);}return _22;}});
\ No newline at end of file
+$.extend({xmodifyVersion:"0.3.0",xmodify:function(_1){var _2=_1.complete;_1.complete=function(_3,_4){if(_3.responseXML==null){_1.error.call(this,_3,_4);}else{jQuery.xProc(_3.responseXML);if(_2){_2.call(this,_3,_4);}}};return jQuery.ajax(_1);},xProc:function(_5){var _6={};jQuery.each(_5.documentElement.childNodes,function(){if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="modifications"){jQuery.each(this.childNodes,function(){if(this.nodeType==1){jQuery.xProcElem(this,_6);}});}});},xProcElem:function(_7,_8){var _9=jQuery.xNodeName(_7.nodeName);var _a=_7.getAttribute("select");if(_9=="append"){jQuery.xProcIn(_7.childNodes,function(_b){jQuery.xSelect(_a).append(_b);},_8);}else{if(_9=="set-attribute"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){jQuery.xSelect(_a).attr(this.getAttribute("name"),this.getAttribute("value"));}});}else{if(_9=="set-style"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){jQuery.xSelect(_a).css(this.getAttribute("name"),thi
 s.getAttribute("value"));}});}else{if(_9=="insert-before"){jQuery.xProcIn(_7.childNodes,function(_c){jQuery.xSelect(_a).before(_c);},_8);}else{if(_9=="insert-after"){jQuery.xProcIn(_7.childNodes,function(_d){jQuery.xSelect(_a).after(_d);},_8);}else{if(_9=="replace-children"||_9=="set-innerhtml"){jQuery.xSelect(_a).empty();jQuery.xProcIn(_7.childNodes,function(_e){jQuery.xSelect(_a).append(_e);},_8);}else{if(_9=="remove-element"){jQuery.xSelect(_a).remove();}else{if(_9=="remove-attribute"){jQuery.each(_7.childNodes,function(){if(this.nodeType==1){jQuery.xSelect(_a).removeAttr(this.getAttribute("name"));}});}else{if(_9=="replace"){jQuery.xSelect(_a).each(function(){if(this.nextSibling){var _f=this.nextSibling;$(this).remove();jQuery.xProcIn(_7.childNodes,function(_10){$(_f).before(_10);},_8);}else{var _11=this.parentNode;$(this).remove();jQuery.xProcIn(_7.childNodes,function(_12){$(_11).append(_12);},_8);}});}else{if(_9=="insert-at"){var _13=_7.getAttribute("index");jQuery.xSe
 lect(_a).each(function(){var _14=null;var _15=this;if(this.childNodes.length>_13){_14=this.childNodes[_13];}jQuery.xProcIn(_7.childNodes,function(_16){if(_14){$(_14).before(_16);}else{$(_15).append(_16);}},_8);});}else{if(_9=="variable"){var _17=_7.getAttribute("name");var _18=_7.getAttribute("deep");_8[_17]=jQuery.xSelect(_a).clone(_18);}}}}}}}}}}}},xProcIn:function(_19,_1a,_1b){$(_19).each(function(){if((this.nodeType==3||this.nodeType==4)&&jQuery.trim(this.nodeValue)!=""){_1a.call(this,this.nodeValue);}else{if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="value-of"){_1a.call(this,_1b[this.getAttribute("name")]);}else{if(this.nodeType==1&&jQuery.xNodeName(this.nodeName)=="clone"){var _1c=this.getAttribute("select");var _1d=this.getAttribute("deep");_1a.call(this,jQuery.xSelect(_1c).clone(_1d));}else{if(this.nodeType==1){_1a.call(this,jQuery.xConvertToString(this));}}}}});},xConvertToString:function(_1e){var _1f="<"+_1e.nodeName;if(_1e.attributes){for(var i=0;i<_1e.at
 tributes.length;i++){_1f+=" "+_1e.attributes[i].name+"=\""+_1e.attributes[i].value+"\"";}}_1f+=">";for(var i=0;i<_1e.childNodes.length;i++){if(_1e.childNodes[i].nodeType==1){_1f+=jQuery.xConvertToString(_1e.childNodes[i]);}else{_1f+=_1e.childNodes[i].nodeValue;}}_1f+="</"+_1e.nodeName+">";return _1f;},xNodeName:function(_22){var i=_22.indexOf(":");if(i!=-1){_22=_22.substring(i+1);}return _22;},xSelect:function(_24){var obj=$(_24);return $(jQuery.makeArray(obj));}});
\ No newline at end of file

Modified: incubator/xap/site/javascript/xmodify/xmodify-jquery.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-jquery.js?rev=575149&r1=575148&r2=575149&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-jquery.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-jquery.js Wed Sep 12 19:48:19 2007
@@ -41,6 +41,10 @@
         }
         return jQuery.ajax(ajaxProperties);
     },
+	
+	blend: function(ajaxProperties, select, blendMode){
+		
+	},
     
     /**
      * Will return the modification element.
@@ -61,7 +65,9 @@
 				    //process all the modification elements
                     jQuery.each(this.childNodes, function(){
             				if (this.nodeType == 1){
-                                jQuery.xProcElem(this, variables);
+						        var nodeName = jQuery.xNodeName(modElement.nodeName);
+						        var select = modElement.getAttribute("select");        
+                                jQuery.xProcElem(nodeName, select, variables, this);
                             }
                         }
             		);
@@ -104,50 +110,47 @@
      * Need to add the must exist attribute
      * Need to add events.
      */
-    xProcElem: function(modElement, variables){
-        var nodeName = jQuery.xNodeName(modElement.nodeName);
-        var select = modElement.getAttribute("select");
-        
+    xProcElem: function(nodeName, select, variables, modElement){
         if (nodeName == "append"){
-            jQuery.xProcIn(modElement.childNodes, function(nodeValue){                
-                $(select).append(nodeValue);        
+            jQuery.xProcIn(modElement.childNodes, function(nodeValue){    
+                jQuery.xSelect(select).append(nodeValue);        
             }, variables);
         }else if (nodeName == "set-attribute"){
             jQuery.each(modElement.childNodes, function(){
             	if (this.nodeType == 1){
-                    $(select).attr(this.getAttribute("name"), this.getAttribute("value"));
+                    jQuery.xSelect(select).attr(this.getAttribute("name"), this.getAttribute("value"));
     			}
             });
         }else if (nodeName == "set-style"){
             jQuery.each(modElement.childNodes, function(){
             	if (this.nodeType == 1){
-                    $(select).css(this.getAttribute("name"), this.getAttribute("value"));
+                    jQuery.xSelect(select).css(this.getAttribute("name"), this.getAttribute("value"));
     			}
             });
         }else if (nodeName == "insert-before"){
             jQuery.xProcIn(modElement.childNodes, function(nodeValue){
-                $(select).before(nodeValue);        
+                jQuery.xSelect(select).before(nodeValue);        
             }, variables);
         }else if (nodeName == "insert-after"){
             jQuery.xProcIn(modElement.childNodes, function(nodeValue){
-                $(select).after(nodeValue);        
+                jQuery.xSelect(select).after(nodeValue);        
             }, variables);
         }else if (nodeName == "replace-children" ||
             nodeName == "set-innerhtml"){
-            $(select).empty();        
+            jQuery.xSelect(select).empty();        
             jQuery.xProcIn(modElement.childNodes, function(nodeValue){
-                $(select).append(nodeValue);        
+                jQuery.xSelect(select).append(nodeValue);        
             }, variables);
         }else if (nodeName == "remove-element"){
-            $(select).remove();        
+            jQuery.xSelect(select).remove();        
         }else if (nodeName == "remove-attribute"){
             jQuery.each(modElement.childNodes, function(){
             		if (this.nodeType == 1){
-    				    $(select).removeAttr(this.getAttribute("name"));
+    				    jQuery.xSelect(select).removeAttr(this.getAttribute("name"));
     				}
                 });
         }else if (nodeName == "replace"){
-            $(select).each(function(){
+            jQuery.xSelect(select).each(function(){
                     //if the next sibling doesn't exist then place it at the end
                     //other wise place it before the next sibling.
                     if (this.nextSibling){
@@ -166,7 +169,7 @@
                 });       
         }else if (nodeName == "insert-at"){
             var index = modElement.getAttribute("index");
-            $(select).each(function(){
+            jQuery.xSelect(select).each(function(){
                     var beforeNode = null;
                     var node = this;
                     
@@ -187,7 +190,7 @@
         }else if (nodeName == "variable"){
             var name = modElement.getAttribute("name");
             var deep = modElement.getAttribute("deep");
-            variables[name] = $(select).clone(deep);
+            variables[name] = jQuery.xSelect(select).clone(deep);
         }
     },     
     
@@ -205,7 +208,7 @@
             }else if (this.nodeType == 1 && jQuery.xNodeName(this.nodeName) == "clone"){
                 var select = this.getAttribute("select");
                 var deep = this.getAttribute("deep");
-                callback.call(this, $(select).clone(deep));
+                callback.call(this, jQuery.xSelect(select).clone(deep));
     		}else if (this.nodeType == 1){
     		    //got an XML node need to convert it into an HTML node
                 callback.call(this, jQuery.xConvertToString(this));
@@ -241,6 +244,11 @@
 			name = name.substring(i + 1);
 		}
 		return name;
-    }
+    },
+	
+	xSelect: function(select){
+		var obj = $(select);
+		return $(jQuery.makeArray(obj));
+	}
 
 });