You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/12/11 10:54:44 UTC
svn commit: r1044617 -
/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Author: mgrigorov
Date: Sat Dec 11 09:54:44 2010
New Revision: 1044617
URL: http://svn.apache.org/viewvc?rev=1044617&view=rev
Log:
WICKET-3244 libxml2 splits large CData section. This breaks the processEvaluate js
Read text/cdata by iterating over all child nodes
Uses a "static" Wicket._readTextNode() because Wicket.Ajax.Call and Wicket.Head.Contributor don't have common parent.
merge r1044616 from 1.5
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js?rev=1044617&r1=1044616&r2=1044617&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js Sat Dec 11 09:54:44 2010
@@ -1350,14 +1350,7 @@ Wicket.Ajax.Call.prototype = {
steps.push(function(notify) {
// get the component id
var compId = node.getAttribute("id");
- var text="";
-
- // get the new component body
- if (node.hasChildNodes()) {
- for( i=0 ; i < node.childNodes.length; i++ ) {
- text = text + node.childNodes[i].nodeValue;
- }
- }
+ var text= Wicket._readTextNode(node);
// if the text was escaped, unascape it
// (escaping is done when the component body contains a CDATA section)
@@ -1384,7 +1377,7 @@ Wicket.Ajax.Call.prototype = {
processEvaluation: function(steps, node) {
steps.push(function(notify) {
// get the javascript body
- var text = node.firstChild.nodeValue;
+ var text = Wicket._readTextNode(node);
// unescape it if necessary
var encoding = node.getAttribute("encoding");
@@ -1431,7 +1424,7 @@ Wicket.Ajax.Call.prototype = {
// Adds a closure that processes a redirect
processRedirect: function(steps, node) {
- var text = node.firstChild.nodeValue;
+ var text = Wicket._readTextNode(node);
Wicket.Log.info("Redirecting to: "+text);
window.location=text;
},
@@ -1489,7 +1482,7 @@ Wicket.Head.Contributor.prototype = {
// need to replace that first
// get the header contribution text and unescape it if necessary
- var text = headerNode.firstChild.nodeValue;
+ var text = Wicket._readTextNode(headerNode);
var encoding = headerNode.getAttribute("encoding");
if (encoding != null && encoding != "") {
@@ -2412,3 +2405,15 @@ function wicketHide(id) {
e.style.display = "none";
}
}
+
+// reads large text/cdata nodes. WICKET-2759/3244
+Wicket._readTextNode = function(node) {
+ var text = "";
+ // get the new component body
+ if (node.hasChildNodes()) {
+ for( i=0 ; i < node.childNodes.length; i++ ) {
+ text = text + node.childNodes[i].nodeValue;
+ }
+ }
+ return text;
+}