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 19:49:28 UTC
svn commit: r575414 - in /incubator/xap/site/javascript/xmodify:
xmodify-jquery.js xmodify-mootools-compressed.js xmodify-mootools.js
xmodify-prototype-compressed.js xmodify-prototype.js
Author: bbuffone
Date: Thu Sep 13 12:49:27 2007
New Revision: 575414
URL: http://svn.apache.org/viewvc?rev=575414&view=rev
Log:
fixed errors with IE
Modified:
incubator/xap/site/javascript/xmodify/xmodify-jquery.js
incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js
incubator/xap/site/javascript/xmodify/xmodify-mootools.js
incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js
incubator/xap/site/javascript/xmodify/xmodify-prototype.js
Modified: incubator/xap/site/javascript/xmodify/xmodify-jquery.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-jquery.js?rev=575414&r1=575413&r2=575414&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-jquery.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-jquery.js Thu Sep 13 12:49:27 2007
@@ -47,21 +47,22 @@
* current html application. Check the jQuery documentation
* specifics on the format and functionality of jQuery's selectors
*
+ *
* Mode can be any of the following append, replace, replace-children
* insert-after, insert-before
*
* @param {Object} ajaxProperties
* @param {Object} select
- * @param {Object} mode
+ * @param {Object} blendMode
*/
- blend: function(ajaxProperties, select, mode){
+ blend: function(ajaxProperties, select, blendMode){
var complete = ajaxProperties.complete;
var variables = {};
ajaxProperties.complete = function(result, request){
if (result.responseText == null){
ajaxProperties.error.call(this, result, request);
}else{
- var node = document.createElement(mode);
+ var node = document.createElement(blendMode);
node.setAttribute("select", select);
node.appendChild(document.createTextNode(result.responseText));
jQuery.xProcElem(node, variables);
@@ -87,7 +88,7 @@
var variables = {};
jQuery.each(
modificationDocument.documentElement.childNodes, function(){
- //look up all the modification elements
+ //look up all the modification elements
if ( this.nodeType == 1 && jQuery.xNodeName(this.nodeName) == "modifications"){
//process all the modification elements
jQuery.each(this.childNodes, function(){
@@ -138,10 +139,10 @@
xProcElem: function(modElement, variables){
var nodeName = jQuery.xNodeName(modElement.nodeName);
var select = modElement.getAttribute("select");
- if (nodeName == "append"){
+ if (nodeName == "append"){
jQuery.xProcIn(modElement.childNodes, function(nodeValue){
jQuery.xSelect(select).append(nodeValue);
- }, variables);
+ }, variables);
}else if (nodeName == "set-attribute"){
jQuery.each(modElement.childNodes, function(){
if (this.nodeType == 1){
Modified: incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js?rev=575414&r1=575413&r2=575414&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-mootools-compressed.js Thu Sep 13 12:49:27 2007
@@ -1 +1 @@
-XHR.xmodifyVersion="0.3.0";XHR.prototype.xmodify=function(_1,_2){var _3=this.onSuccess;var _4=this;this.onSuccess=function(){if(_4.transport.responseXML==null){_4.onFailure.call(this);}else{_4.xProc(_4.transport.responseXML);if(_3){_3.call(this);}}};return this.send(_1,_2);};XHR.prototype.blend=function(_5,_6,_7,_8){var _9=this.onSuccess;var _a=this;var _b={};this.onSuccess=function(){if(_a.transport.responseText==null){_a.onFailure.call(this);}else{var _c=document.createElement(_7);_c.setAttribute("select",_6);_c.appendChild(document.createTextNode(_a.transport.responseText));XHR.xProcElem(_c,_b);if(_9){_9.call(this);}}};return this.send(_5,_8);};XHR.prototype.xProc=function(_d){var _e={};$each(_d.documentElement.childNodes,function(_f){if(_f.nodeType==1&&XHR.xNodeName(_f.nodeName)=="modifications"){$each(_f.childNodes,function(_10){if(_10.nodeType==1){XHR.xProcElem(_10,_e);}});}});};XHR.xProcElem=function(_11,_12){var _13=XHR.xNodeName(_11.nodeName);var _14=_11.getAttribut
e("select");if(_13=="append"){XHR.xProcIn(_11.childNodes,function(_15){$A(_15).each(function(_16){$$(_14).each(function(_17){XHR.appendTableElement(_17,_16);});});},_12);}else{if(_13=="set-attribute"){$each(_11.childNodes,function(_18){if(_18.nodeType==1){$$(_14).setProperty(_18.getAttribute("name"),_18.getAttribute("value"));}});}else{if(_13=="set-style"){$each(_11.childNodes,function(_19){if(_19.nodeType==1){$$(_14).setStyle(_19.getAttribute("name"),_19.getAttribute("value"));}});}else{if(_13=="insert-before"){XHR.xProcIn(_11.childNodes,function(_1a){$A(_1a).each(function(_1b){$$(_14).each(function(_1c){_1c.parentNode.insertBefore(_1b,_1c);});});},_12);}else{if(_13=="insert-after"){XHR.xProcIn(_11.childNodes,function(_1d){$A(_1d).each(function(_1e){$$(_14).each(function(_1f){if(_1f.nextSibling){_1f.parentNode.insertBefore(_1e,_1f.nextSibling);}else{XHR.appendTableElement(_1f.parentNode,_1e);}});});},_12);}else{if(_13=="replace-children"||_13=="set-innerhtml"){XHR.xProcIn(_
11.childNodes,function(_20){$$(_14).each(function(_21){_21.empty();$A(_20).each(function(_22){XHR.appendTableElement(_21,_22);});});},_12);}else{if(_13=="remove-element"){$each($$(_14),function(_23){_23.remove();});}else{if(_13=="remove-attribute"){$each(_11.childNodes,function(_24){if(_24.nodeType==1){$$(_14).removeProperty(_24.getAttribute("name"));}});}else{if(_13=="replace"){XHR.xProcIn(_11.childNodes,function(_25){$A(_25).each(function(_26){$$(_14).each(function(_27){_27.replaceWith(_26);});});});}else{if(_13=="insert-at"){var _28=_11.getAttribute("index");XHR.xProcIn(_11.childNodes,function(_29){$A(_29).each(function(_2a){$$(_14).each(function(_2b){var _2c=null;var _2d=_2b;if(_2b.childNodes.length>_28){_2c=_2b.childNodes[_28];}if(_2c){_2b.insertBefore(_2a,_2c);}else{XHR.appendTableElement(_2b,_2a);}});});},_12);}else{if(_13=="variable"){var _2e=_11.getAttribute("name");var _2f=_11.getAttribute("deep");var arr=new Array();$$(_14).each(function(_31){arr.push(_31);});_12[
_2e]=arr;}}}}}}}}}}}};XHR.xProcIn=function(_32,_33,_34){$each(_32,function(_35){if((_35.nodeType==3||_35.nodeType==4)&&_35.nodeValue.trim()!=""){_33.call(_35,XHR.convertStringToHTML(_35.nodeValue));}else{if(_35.nodeType==1&&XHR.xNodeName(_35.nodeName)=="value-of"){_33.call(_35,_34[_35.getAttribute("name")]);}else{if(_35.nodeType==1&&XHR.xNodeName(_35.nodeName)=="clone"){var _36=_35.getAttribute("select");var _37=_35.getAttribute("deep");$$(_36).each(function(_38){_33.call(_35,[_38.cloneNode(_37)]);});}else{if(this.nodeType==1){_33.call(this,XHR.convertStringToHTML(XHR.xConvertToString(this)));}}}}});};XHR.xConvertToString=function(_39){var _3a="<"+_39.nodeName;if(_39.attributes){for(var i=0;i<_39.attributes.length;i++){_3a+=" "+_39.attributes[i].name+"=\""+_39.attributes[i].value+"\"";}}_3a+=">";for(var i=0;i<_39.childNodes.length;i++){if(_39.childNodes[i].nodeType==1){_3a+=XHR.xConvertToString(_39.childNodes[i]);}else{_3a+=_39.childNodes[i].nodeValue;}}_3a+="</"+_39.nodeNam
e+">";return _3a;};XHR.xNodeName=function(_3d){var i=_3d.indexOf(":");if(i!=-1){_3d=_3d.substring(i+1);}return _3d.toLowerCase();};XHR.appendTableElement=function(_3f,_40){if(XHR.xNodeName(_3f.nodeName)=="TABLE"&&XHR.xNodeName(_40.nodeName)=="TR"){obj=_3f.getElementsByTagName("tbody")[0]||_3f.appendChild(document.createElement("tbody"));obj.appendChild(_40);}else{_3f.appendChild(_40);}};XHR.convertStringToHTML=function(_41){var s=_41.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _45=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_45[1]+s+_45[2];while(_45[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childN
odes;}else{if(_45[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return arg;};
\ No newline at end of file
+XHR.xmodifyVersion="0.3.0";XHR.prototype.xmodify=function(_1,_2){var _3=this.onSuccess;var _4=this;this.onSuccess=function(){if(_4.transport.responseXML==null){_4.onFailure.call(this);}else{_4.xProc(_4.transport.responseXML);if(_3){_3.call(this);}}};return this.send(_1,_2);};XHR.prototype.blend=function(_5,_6,_7,_8){var _9=this.onSuccess;var _a=this;var _b={};this.onSuccess=function(){if(_a.transport.responseText==null){_a.onFailure.call(this);}else{var _c=document.createElement(_7);_c.setAttribute("select",_6);_c.appendChild(document.createTextNode(_a.transport.responseText));XHR.xProcElem(_c,_b);if(_9){_9.call(this);}}};return this.send(_5,_8);};XHR.prototype.xProc=function(_d){var _e={};Array.forEach(_d.documentElement.childNodes,function(_f){if(_f.nodeType==1&&XHR.xNodeName(_f.nodeName)=="modifications"){Array.forEach(_f.childNodes,function(_10){if(_10.nodeType==1){XHR.xProcElem(_10,_e);}});}});};XHR.xProcElem=function(_11,_12){var _13=XHR.xNodeName(_11.nodeName);var _14
=_11.getAttribute("select");if(_13=="append"){XHR.xProcIn(_11.childNodes,function(_15){$A(_15).each(function(_16){$$(_14).each(function(_17){XHR.appendTableElement(_17,_16);});});},_12);}else{if(_13=="set-attribute"){Array.forEach(_11.childNodes,function(_18){if(_18.nodeType==1){$$(_14).setProperty(_18.getAttribute("name"),_18.getAttribute("value"));}});}else{if(_13=="set-style"){Array.forEach(_11.childNodes,function(_19){if(_19.nodeType==1){$$(_14).setStyle(_19.getAttribute("name"),_19.getAttribute("value"));}});}else{if(_13=="insert-before"){XHR.xProcIn(_11.childNodes,function(_1a){$A(_1a).each(function(_1b){$$(_14).each(function(_1c){_1c.parentNode.insertBefore(_1b,_1c);});});},_12);}else{if(_13=="insert-after"){XHR.xProcIn(_11.childNodes,function(_1d){$A(_1d).each(function(_1e){$$(_14).each(function(_1f){if(_1f.nextSibling){_1f.parentNode.insertBefore(_1e,_1f.nextSibling);}else{XHR.appendTableElement(_1f.parentNode,_1e);}});});},_12);}else{if(_13=="replace-children"||_13
=="set-innerhtml"){XHR.xProcIn(_11.childNodes,function(_20){$$(_14).each(function(_21){while(_21.firstChild){_21.removeChild(_21.firstChild);}$A(_20).each(function(_22){XHR.appendTableElement(_21,_22);});});},_12);}else{if(_13=="remove-element"){Array.forEach($$(_14),function(_23){_23.remove();});}else{if(_13=="remove-attribute"){Array.forEach(_11.childNodes,function(_24){if(_24.nodeType==1){$$(_14).removeProperty(_24.getAttribute("name"));}});}else{if(_13=="replace"){XHR.xProcIn(_11.childNodes,function(_25){$A(_25).each(function(_26){$$(_14).each(function(_27){_27.replaceWith(_26);});});});}else{if(_13=="insert-at"){var _28=_11.getAttribute("index");XHR.xProcIn(_11.childNodes,function(_29){$A(_29).each(function(_2a){$$(_14).each(function(_2b){var _2c=null;var _2d=_2b;if(_2b.childNodes.length>_28){_2c=_2b.childNodes[_28];}if(_2c){_2b.insertBefore(_2a,_2c);}else{XHR.appendTableElement(_2b,_2a);}});});},_12);}else{if(_13=="variable"){var _2e=_11.getAttribute("name");var _2f=_1
1.getAttribute("deep");var arr=new Array();$$(_14).each(function(_31){arr.push(_31);});_12[_2e]=arr;}}}}}}}}}}}};XHR.xProcIn=function(_32,_33,_34){Array.forEach(_32,function(_35){if((_35.nodeType==3||_35.nodeType==4)&&_35.nodeValue.trim()!=""){_33.call(_35,XHR.convertStringToHTML(_35.nodeValue));}else{if(_35.nodeType==1&&XHR.xNodeName(_35.nodeName)=="value-of"){_33.call(_35,_34[_35.getAttribute("name")]);}else{if(_35.nodeType==1&&XHR.xNodeName(_35.nodeName)=="clone"){var _36=_35.getAttribute("select");var _37=_35.getAttribute("deep");$$(_36).each(function(_38){_33.call(_35,[_38.cloneNode(_37)]);});}else{if(this.nodeType==1){_33.call(this,XHR.convertStringToHTML(XHR.xConvertToString(this)));}}}}});};XHR.xConvertToString=function(_39){var _3a="<"+_39.nodeName;if(_39.attributes){for(var i=0;i<_39.attributes.length;i++){_3a+=" "+_39.attributes[i].name+"=\""+_39.attributes[i].value+"\"";}}_3a+=">";for(var i=0;i<_39.childNodes.length;i++){if(_39.childNodes[i].nodeType==1){_3a+=XHR
.xConvertToString(_39.childNodes[i]);}else{_3a+=_39.childNodes[i].nodeValue;}}_3a+="</"+_39.nodeName+">";return _3a;};XHR.xNodeName=function(_3d){var i=_3d.indexOf(":");if(i!=-1){_3d=_3d.substring(i+1);}return _3d.toLowerCase();};XHR.appendTableElement=function(_3f,_40){if(XHR.xNodeName(_3f.nodeName)=="table"&&XHR.xNodeName(_40.nodeName)=="tr"){obj=_3f.getElementsByTagName("tbody")[0]||_3f.appendChild(document.createElement("tbody"));obj.appendChild(_40);}else{_3f.appendChild(_40);}};XHR.convertStringToHTML=function(_41){var s=_41.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _45=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_45[1]+s+_45[2];while(_45[0]--){div=div.firstChild;}if(
window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_45[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return arg;};
\ No newline at end of file
Modified: incubator/xap/site/javascript/xmodify/xmodify-mootools.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-mootools.js?rev=575414&r1=575413&r2=575414&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-mootools.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-mootools.js Thu Sep 13 12:49:27 2007
@@ -88,12 +88,12 @@
*/
XHR.prototype.xProc = function(modificationDocument){
var variables = {};
- $each(
+ Array.forEach(
modificationDocument.documentElement.childNodes, function(item){
//look up all the modification elements
if ( item.nodeType == 1 && XHR.xNodeName(item.nodeName) == "modifications"){
//process all the modification elements
- $each(item.childNodes, function(item){
+ Array.forEach(item.childNodes, function(item){
if (item.nodeType == 1){
XHR.xProcElem(item, variables);
}
@@ -151,13 +151,13 @@
});
}, variables);
}else if (nodeName == "set-attribute"){
- $each(modElement.childNodes, function(item){
+ Array.forEach(modElement.childNodes, function(item){
if (item.nodeType == 1){
$$(select).setProperty(item.getAttribute("name"), item.getAttribute("value"));
}
});
}else if (nodeName == "set-style"){
- $each(modElement.childNodes, function(item){
+ Array.forEach(modElement.childNodes, function(item){
if (item.nodeType == 1){
$$(select).setStyle(item.getAttribute("name"), item.getAttribute("value"));
}
@@ -186,18 +186,19 @@
nodeName == "set-innerhtml"){
XHR.xProcIn(modElement.childNodes, function(nodes){
$$(select).each(function(item){
- item.empty();
+ while ( item.firstChild )
+ item.removeChild( item.firstChild );
$A(nodes).each(function(newNode){
XHR.appendTableElement(item, newNode);
});
});
}, variables);
}else if (nodeName == "remove-element"){
- $each($$(select), function(item){
+ Array.forEach($$(select), function(item){
item.remove();
});
}else if (nodeName == "remove-attribute"){
- $each(modElement.childNodes, function(item){
+ Array.forEach(modElement.childNodes, function(item){
if (item.nodeType == 1){
$$(select).removeProperty(item.getAttribute("name"));
}
@@ -249,7 +250,7 @@
* instruction's children and fire a callback
*/
XHR.xProcIn = function(nodes, callback, variables){
- $each(nodes, function(item){
+ Array.forEach(nodes, function(item){
//make sure there is a nodeValue and this isn't an empty string
if ((item.nodeType == 3 || item.nodeType == 4) && item.nodeValue.trim() != ""){
callback.call(item, XHR.convertStringToHTML(item.nodeValue));
@@ -292,9 +293,8 @@
XHR.xNodeName = function(name){
var i = name.indexOf(":");
- if (i != -1){
+ if (i != -1)
name = name.substring(i + 1);
- }
return name.toLowerCase();
}
@@ -306,7 +306,7 @@
*/
XHR.appendTableElement = function(item, newNode){
//need to check for a table and tr. we want the tbodyitem.nodeName
- if (XHR.xNodeName(item.nodeName) == "TABLE" && XHR.xNodeName(newNode.nodeName) == "TR"){
+ if (XHR.xNodeName(item.nodeName) == "table" && XHR.xNodeName(newNode.nodeName) == "tr"){
obj = item.getElementsByTagName("tbody")[0] || item.appendChild(document.createElement("tbody"));
obj.appendChild(newNode);
}else{
Modified: incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js?rev=575414&r1=575413&r2=575414&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-prototype-compressed.js Thu Sep 13 12:49:27 2007
@@ -1 +1 @@
-Prototype.xmodifyVersion="0.3.0";Ajax.xmodify=function(_1,_2){var _3=this.onSuccess;if(_2==null){_2={method:"get"};}else{if(_2.method==null){_2.method="get";}}var _4=this;_2.onSuccess=function(_5){if(_5.responseXML==null){_2.onFailure.call(this);}else{Ajax.xProc(_5.responseXML);if(_3){_3.call(this);}}};return new Ajax.Request(_1,_2);};Ajax.blend=function(_6,_7,_8,_9){var _a=this.onSuccess;var _b={};if(_9==null){_9={method:"get"};}else{if(_9.method==null){_9.method="get";}}var _c=this;_9.onSuccess=function(_d){if(_d.responseText==null){_9.onFailure.call(this);}else{var _e=document.createElement(_8);_e.setAttribute("select",_7);_e.appendChild(document.createTextNode(_d.responseText));Ajax.xProcElem(_e,_b);if(_a){_a.call(this);}}};return new Ajax.Request(_6,_9);};Ajax.xProc=function(_f){var _10={};$A(_f.documentElement.childNodes).each(function(_11){if(_11.nodeType==1&&Ajax.xNodeName(_11.nodeName)=="modifications"){$A(_11.childNodes).each(function(_12){if(_12.nodeType==1){Ajax.
xProcElem(_12,_10);}});}});};Ajax.xProcElem=function(_13,_14){var _15=Ajax.xNodeName(_13.nodeName);var _16=_13.getAttribute("select");if(_15=="append"){Ajax.xProcIn(_13.childNodes,function(_17){$$(_16).each(function(_18){$A(_17).each(function(_19){Ajax.appendTableElement(_18,_19);});});},_14);}else{if(_15=="set-attribute"){$A(_13.childNodes).each(function(_1a){if(_1a.nodeType==1){$$(_16).each(function(_1b){_1b.setAttribute(_1a.getAttribute("name"),_1a.getAttribute("value"));});}var _1c;});}else{if(_15=="set-style"){$A(_13.childNodes).each(function(_1d){if(_1d.nodeType==1){$$(_16).each(function(_1e){var _1f=new Array();_1f[_1d.getAttribute("name")]=_1d.getAttribute("value");$(_1e).setStyle(_1f);});}var _20;});}else{if(_15=="insert-before"){Ajax.xProcIn(_13.childNodes,function(_21){$$(_16).each(function(_22){$A(_21).each(function(_23){_22.parentNode.insertBefore(_23,_22);});});},_14);}else{if(_15=="insert-after"){Ajax.xProcIn(_13.childNodes,function(_24){$$(_16).each(function(
_25){$A(_24).each(function(_26){if(_25.nextSibling){_25.parentNode.insertBefore(_26,_25.nextSibling);}else{Ajax.appendTableElement(_25.parentNode,_26);}});});},_14);}else{if(_15=="set-innerhtml"||_15=="replace-children"){Ajax.xProcIn(_13.childNodes,function(_27){$$(_16).each(function(_28){_28.innerHTML="";$A(_27).each(function(_29){Ajax.appendTableElement(_28,_29);});});},_14);}else{if(_15=="remove-element"){$$(_16).each(function(_2a){_2a.remove();});}else{if(_15=="remove-attribute"){$A(_13.childNodes).each(function(_2b){if(_2b.nodeType==1){$$(_16).each(function(_2c){_2c.removeAttribute(_2b.getAttribute("name"));});}});}else{if(_15=="replace"){Ajax.xProcIn(_13.childNodes,function(_2d){$$(_16).each(function(_2e){$A(_2d).each(function(_2f){_2e.replace(_2f,_2e);});});});}else{if(_15=="insert-at"){var _30=_13.getAttribute("index");Ajax.xProcIn(_13.childNodes,function(_31){$$(_16).each(function(_32){$A(_31).each(function(_33){var _34=null;var _35=_32;if(_32.childNodes.length>_30)
{_34=_32.childNodes[_30];}if(_34){_32.insertBefore(_33,_34);}else{Ajax.appendTableElement(_32,_33);}});});},_14);}else{if(_15=="variable"){var _36=_13.getAttribute("name");var _37=_13.getAttribute("deep");var arr=new Array();$$(_16).each(function(_39){arr.push(_39);});_14[_36]=arr;}}}}}}}}}}}};Ajax.xProcIn=function(_3a,_3b,_3c){$A(_3a).each(function(_3d){if((_3d.nodeType==3||_3d.nodeType==4)&&_3d.nodeValue.replace(/^\s+|\s+$/g,"")!=""){_3b.call(_3d,Ajax.convertStringToHTML(_3d.nodeValue));}else{if(_3d.nodeType==1&&Ajax.xNodeName(_3d.nodeName)=="value-of"){_3b.call(_3d,_3c[_3d.getAttribute("name")]);}else{if(_3d.nodeType==1&&Ajax.xNodeName(_3d.nodeName)=="clone"){var _3e=_3d.getAttribute("select");var _3f=_3d.getAttribute("deep");$$(_3e).each(function(_40){_3b.call(_3d,[_40.cloneNode(_3f)]);});}else{if(this.nodeType==1){_3b.call(this,Ajax.convertStringToHTML(Ajax.xConvertToString(this)));}}}}});};Ajax.xConvertToString=function(_41){var _42="<"+_41.nodeName;if(_41.attributes){
for(var i=0;i<_41.attributes.length;i++){_42+=" "+_41.attributes[i].name+"=\""+_41.attributes[i].value+"\"";}}_42+=">";for(var i=0;i<_41.childNodes.length;i++){if(_41.childNodes[i].nodeType==1){_42+=Ajax.xConvertToString(_41.childNodes[i]);}else{_42+=_41.childNodes[i].nodeValue;}}_42+="</"+_41.nodeName+">";return _42;};Ajax.xNodeName=function(_45){var i=_45.indexOf(":");if(i!=-1){_45=_45.substring(i+1);}return _45.toLowerCase();};Ajax.appendTableElement=function(_47,_48){if(Ajax.xNodeName(_47.nodeName)=="TABLE"&&Ajax.xNodeName(_48.nodeName)=="TR"){obj=_47.getElementsByTagName("tbody")[0]||_47.appendChild(document.createElement("tbody"));obj.appendChild(_48);}else{_47.appendChild(_48);}};Ajax.convertStringToHTML=function(_49){var s=_49.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _4d=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2
,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_4d[1]+s+_4d[2];while(_4d[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_4d[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return arg;};
\ No newline at end of file
+Prototype.xmodifyVersion="0.3.0";Ajax.xmodify=function(_1,_2){var _3=this.onSuccess;if(_2==null){_2={method:"get"};}else{if(_2.method==null){_2.method="get";}}var _4=this;_2.onSuccess=function(_5){if(_5.responseXML==null){_2.onFailure.call(this);}else{Ajax.xProc(_5.responseXML);if(_3){_3.call(this);}}};return new Ajax.Request(_1,_2);};Ajax.blend=function(_6,_7,_8,_9){var _a=this.onSuccess;var _b={};if(_9==null){_9={method:"get"};}else{if(_9.method==null){_9.method="get";}}var _c=this;_9.onSuccess=function(_d){if(_d.responseText==null){_9.onFailure.call(this);}else{var _e=document.createElement(_8);_e.setAttribute("select",_7);_e.appendChild(document.createTextNode(_d.responseText));Ajax.xProcElem(_e,_b);if(_a){_a.call(this);}}};return new Ajax.Request(_6,_9);};Ajax.xProc=function(_f){var _10={};$A(_f.documentElement.childNodes).each(function(_11){if(_11.nodeType==1&&Ajax.xNodeName(_11.nodeName)=="modifications"){$A(_11.childNodes).each(function(_12){if(_12.nodeType==1){Ajax.
xProcElem(_12,_10);}});}});};Ajax.xProcElem=function(_13,_14){var _15=Ajax.xNodeName(_13.nodeName);var _16=_13.getAttribute("select");if(_15=="append"){Ajax.xProcIn(_13.childNodes,function(_17){$$(_16).each(function(_18){$A(_17).each(function(_19){Ajax.appendTableElement(_18,_19);});});},_14);}else{if(_15=="set-attribute"){$A(_13.childNodes).each(function(_1a){if(_1a.nodeType==1){$$(_16).each(function(_1b){_1b.setAttribute(_1a.getAttribute("name"),_1a.getAttribute("value"));});}var _1c;});}else{if(_15=="set-style"){$A(_13.childNodes).each(function(_1d){if(_1d.nodeType==1){$$(_16).each(function(_1e){var _1f=new Array();_1f[_1d.getAttribute("name")]=_1d.getAttribute("value");Element.setStyle(element,_1f);});}var _20;});}else{if(_15=="insert-before"){Ajax.xProcIn(_13.childNodes,function(_21){$$(_16).each(function(_22){$A(_21).each(function(_23){_22.parentNode.insertBefore(_23,_22);});});},_14);}else{if(_15=="insert-after"){Ajax.xProcIn(_13.childNodes,function(_24){$$(_16).each(
function(_25){$A(_24).each(function(_26){if(_25.nextSibling){_25.parentNode.insertBefore(_26,_25.nextSibling);}else{Ajax.appendTableElement(_25.parentNode,_26);}});});},_14);}else{if(_15=="set-innerhtml"||_15=="replace-children"){Ajax.xProcIn(_13.childNodes,function(_27){$$(_16).each(function(_28){while(_28.firstChild){_28.removeChild(_28.firstChild);}$A(_27).each(function(_29){Ajax.appendTableElement(_28,_29);});});},_14);}else{if(_15=="remove-element"){$$(_16).each(function(_2a){_2a.remove();});}else{if(_15=="remove-attribute"){$A(_13.childNodes).each(function(_2b){if(_2b.nodeType==1){$$(_16).each(function(_2c){_2c.removeAttribute(_2b.getAttribute("name"));});}});}else{if(_15=="replace"){Ajax.xProcIn(_13.childNodes,function(_2d){$$(_16).each(function(_2e){$A(_2d).each(function(_2f){_2e.replace(_2f,_2e);});});});}else{if(_15=="insert-at"){var _30=_13.getAttribute("index");Ajax.xProcIn(_13.childNodes,function(_31){$$(_16).each(function(_32){$A(_31).each(function(_33){var _34
=null;var _35=_32;if(_32.childNodes.length>_30){_34=_32.childNodes[_30];}if(_34){_32.insertBefore(_33,_34);}else{Ajax.appendTableElement(_32,_33);}});});},_14);}else{if(_15=="variable"){var _36=_13.getAttribute("name");var _37=_13.getAttribute("deep");var arr=new Array();$$(_16).each(function(_39){arr.push(_39);});_14[_36]=arr;}}}}}}}}}}}};Ajax.xProcIn=function(_3a,_3b,_3c){$A(_3a).each(function(_3d){if((_3d.nodeType==3||_3d.nodeType==4)&&_3d.nodeValue.replace(/^\s+|\s+$/g,"")!=""){_3b.call(_3d,Ajax.convertStringToHTML(_3d.nodeValue));}else{if(_3d.nodeType==1&&Ajax.xNodeName(_3d.nodeName)=="value-of"){_3b.call(_3d,_3c[_3d.getAttribute("name")]);}else{if(_3d.nodeType==1&&Ajax.xNodeName(_3d.nodeName)=="clone"){var _3e=_3d.getAttribute("select");var _3f=_3d.getAttribute("deep");$$(_3e).each(function(_40){_3b.call(_3d,[_40.cloneNode(_3f)]);});}else{if(this.nodeType==1){_3b.call(this,Ajax.convertStringToHTML(Ajax.xConvertToString(this)));}}}}});};Ajax.xConvertToString=function(_4
1){var _42="<"+_41.nodeName;if(_41.attributes){for(var i=0;i<_41.attributes.length;i++){_42+=" "+_41.attributes[i].name+"=\""+_41.attributes[i].value+"\"";}}_42+=">";for(var i=0;i<_41.childNodes.length;i++){if(_41.childNodes[i].nodeType==1){_42+=Ajax.xConvertToString(_41.childNodes[i]);}else{_42+=_41.childNodes[i].nodeValue;}}_42+="</"+_41.nodeName+">";return _42;};Ajax.xNodeName=function(_45){var i=_45.indexOf(":");if(i!=-1){_45=_45.substring(i+1);}return _45.toLowerCase();};Ajax.appendTableElement=function(_47,_48){if(Ajax.xNodeName(_47.nodeName)=="table"&&Ajax.xNodeName(_48.nodeName)=="tr"){obj=_47.getElementsByTagName("tbody")[0]||_47.appendChild(document.createElement("tbody"));obj.appendChild(_48);}else{_47.appendChild(_48);}};Ajax.convertStringToHTML=function(_49){var s=_49.replace(/^\s+|\s+$/g,"");var div=document.createElement("div");var tb=[];var _4d=!s.indexOf("<opt")&&[1,"<select>","</select>"]||(!s.indexOf("<thead")||!s.indexOf("<tbody")||!s.indexOf("<tfoot"))&&
[1,"<table>","</table>"]||!s.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!s.indexOf("<td")||!s.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];div.innerHTML=_4d[1]+s+_4d[2];while(_4d[0]--){div=div.firstChild;}if(window.ie){if(!s.indexOf("<table")&&s.indexOf("<tbody")<0){tb=div.firstChild&&div.firstChild.childNodes;}else{if(_4d[1]=="<table>"&&s.indexOf("<tbody")<0){tb=div.childNodes;}}for(var n=tb.length-1;n>=0;--n){if(tb[n].nodeName.toUpperCase()=="TBODY"&&!tb[n].childNodes.length){tb[n].parentNode.removeChild(tb[n]);}}}arg=new Array();for(var i=0,l=div.childNodes.length;i<l;i++){arg.push(div.childNodes[i]);}return arg;};
\ No newline at end of file
Modified: incubator/xap/site/javascript/xmodify/xmodify-prototype.js
URL: http://svn.apache.org/viewvc/incubator/xap/site/javascript/xmodify/xmodify-prototype.js?rev=575414&r1=575413&r2=575414&view=diff
==============================================================================
--- incubator/xap/site/javascript/xmodify/xmodify-prototype.js (original)
+++ incubator/xap/site/javascript/xmodify/xmodify-prototype.js Thu Sep 13 12:49:27 2007
@@ -170,7 +170,7 @@
$$(select).each(function(node){
var styles = new Array();
styles[item.getAttribute("name")] = item.getAttribute("value");
- $(node).setStyle(styles);
+ Element.setStyle(element, styles);
});
}
var item;
@@ -199,7 +199,8 @@
nodeName == "replace-children"){
Ajax.xProcIn(modElement.childNodes, function(nodes){
$$(select).each(function(item){
- item.innerHTML = '';
+ while ( item.firstChild )
+ item.removeChild( item.firstChild );
$A(nodes).each(function(newNode){
Ajax.appendTableElement(item, newNode);
});
@@ -308,9 +309,8 @@
Ajax.xNodeName = function(name){
var i = name.indexOf(":");
- if (i != -1){
+ if (i != -1)
name = name.substring(i + 1);
- }
return name.toLowerCase();
}
@@ -322,7 +322,7 @@
*/
Ajax.appendTableElement = function(item, newNode){
//need to check for a table and tr. we want the tbodyitem.nodeName
- if (Ajax.xNodeName(item.nodeName) == "TABLE" && Ajax.xNodeName(newNode.nodeName) == "TR"){
+ if (Ajax.xNodeName(item.nodeName) == "table" && Ajax.xNodeName(newNode.nodeName) == "tr"){
obj = item.getElementsByTagName("tbody")[0] || item.appendChild(document.createElement("tbody"));
obj.appendChild(newNode);
}else{