You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by an...@apache.org on 2007/06/15 01:06:40 UTC

svn commit: r547439 - in /tapestry/tapestry4/trunk/tapestry-framework/src/js: tapestry/core.js tests/test_html.js

Author: andyhot
Date: Thu Jun 14 16:06:39 2007
New Revision: 547439

URL: http://svn.apache.org/viewvc?view=rev&rev=547439
Log:
refine regexp

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?view=diff&rev=547439&r1=547438&r2=547439
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Thu Jun 14 16:06:39 2007
@@ -446,8 +446,8 @@
  */
 tapestry.html={
 
-    TextareaRegexp:new RegExp('<([a-zA-Z]?)\\s(.*?)/>'), // regexp for compact textarea elements
-    TextareaReplacer:'<$1 $2></$1>', // replace pattern for compact textareas
+    CompactElementRegexp:new RegExp('<([a-zA-Z]*)(.*?)/>'), // regexp for compact html elements
+    CompactElementReplacer:'<$1$2></$1>', // replace pattern for compact html elements
 	
     /**
 	 * Function: getContentAsString
@@ -531,7 +531,7 @@
 		        return this._getContentAsStringGeneric(node);
         }
 
-        return this._processTextareas(s);
+        return this._processCompactElements(s);
 	},
 	
 	_getContentAsStringGeneric:function(node){
@@ -555,10 +555,10 @@
 		return s;	
 	},
 
-	_processTextareas:function(htmlData)
+	_processCompactElements:function(htmlData)
  	{
-        while (htmlData.match(this.TextareaRegexp)){
-            htmlData = htmlData.replace(this.TextareaRegexp, this.TextareaReplacer);
+            while (htmlData.match(this.CompactElementRegexp)){                
+                htmlData = htmlData.replace(this.CompactElementRegexp, this.CompactElementReplacer);
         }
         return htmlData;
  	}

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js?view=diff&rev=547439&r1=547438&r2=547439
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js Thu Jun 14 16:06:39 2007
@@ -35,9 +35,9 @@
     var initial = "start<textarea id='2' rows=4/>";
     var expected = "start<textarea id='2' rows=4></textarea>";
     
-    jum.assertEquals(expected, tapestry.html._processTextareas(initial));
+    jum.assertEquals(expected, tapestry.html._processCompactElements(initial));
     jum.assertEquals(expected + expected, 
-        tapestry.html._processTextareas(initial+initial));
+        tapestry.html._processCompactElements(initial+initial));
 }
 
 function _createTestNode(element, empty){