Yea, i had done similar research when this was first reported for tacos.

Look who 2 are talking about this :)
http://www.mail-archive.com/[email protected]/msg00213.html

Anyway, I had hoped for XMLSerializer's
( http://xulplanet.com/references/objref/XMLSerializer.html )
serializeToString to also accept a parameter that would allow us
to define how we want empty tags handled...

Didn't find anything though...

So, i can't change how serialization works and also cannot change how
parsing
and rendering works (try viewing in FF an html file containing only:
"<textarea/>Am i inside the textarea?" )
... doesn't leave us too many options...

Jesse Kuhnert wrote:
> Hmm ok. Of course I understand the reasons behind it, and it is a good
> bug
> fix. Maybe I'm being too anal lately and obsessing over every little
> feature. I may try and waste another day or so again soon by looking at
> these :
>
> http://developer.mozilla.org/en/docs/XML_in_Mozilla
>
> http://xulplanet.com/tutorials/mozsdk/xmlparse.php
>
> http://developer.mozilla.org/en/docs/XML_in_Mozilla
>
> http://developer.mozilla.org/en/docs/XMLHttpRequest
>
> There ~has~ to be some way to make it be able to parse what it serializes
> right? grr
>
> On 11/20/06, andyhot <[EMAIL PROTECTED]> wrote:
>>
>> Jesse Kuhnert wrote:
>> > Not that I'm sure it would handle all use cases, but wouldn't it be
>> > better
>> > to just make the TextArea component not create empty <textarea />
>> > tags, or
>> > at the very worst re-work the template parser TextToken's to handle it
>> > right
>> > there if it's not a tapestry managed block of text?
>> >
>> > (just because I know from recent experience that regexp matching on
>> the
>> > client side is fairly expensive, and anything involving regexp + ~all~
>> > core
>> > IO operations is something deserving of more scrutiny ;) )
>>
>> we aren't actually creating empty <textarea/> tags
>> our server side code creates <textarea></textarea> code.
>>
>> But ... when an ajax response with xml type is returned,
>> mozilla's dom/xml parser transparently stores this as <textarea/>
>> So, when we eventually insert that back at the document, TAPESTRY-1129
>> arises...
>>
>> If the ajax response type wasn't xml (i.e. simple text) we wouldn't be
>> having this
>> issue (but of course, we wouldn't be able to do all the other stuff)
>>
>> >
>> > On 11/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Author: andyhot
>> >> Date: Mon Nov 20 15:37:40 2006
>> >> New Revision: 477408
>> >>
>> >> URL: http://svn.apache.org/viewvc?view=rev&rev=477408
>> >> Log:
>> >> TAPESTRY-1129: Unpack emptry textareas for mozilla derivative
>> browsers
>> >>
>> >> Modified:
>> >>    
>> tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js
>> >>
>> >> tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js
>> >>
>> >> Modified:
>> >> tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js
>> >> URL:
>> >>
>> http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js?view=diff&rev=477408&r1=477407&r2=477408
>>
>> >>
>> >>
>> >>
>> ==============================================================================
>>
>> >>
>> >> ---
>> tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js
>> >> (original)
>> >> +++
>> tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/html.js
>> >> Mon Nov 20 15:37:40 2006
>> >> @@ -5,6 +5,9 @@
>> >>   * Provides functionality related to parsing and rendering dom
>> nodes.
>> >>   */
>> >> tapestry.html={
>> >> +
>> >> +        TextareaMatcher:'<textarea(.*?)/>', // regexp for compact
>> >> textarea elements
>> >> +        TextareaReplacer:'<textarea$1></textarea>', // replace
>> pattern
>> >> for compact textareas
>> >>
>> >>          /**
>> >>          * Function: getContentAsString
>> >> @@ -12,12 +15,12 @@
>> >>          * Takes a dom node and returns its contents rendered in a
>> >> string.
>> >>           *
>> >>           * The resulting string does NOT contain any markup (or
>> >> attributes) of
>> >> -         * the given node - only child nodes are rendered and
>> returned.
>> >> +         * the given node - only child nodes are rendered and
>> >> returned.Content
>> >>           *
>> >>           * Implementation Note: This function tries to make use of
>> >> browser
>> >>           * specific features (the xml attribute of nodes in IE
>> and the
>> >> XMLSerializer
>> >>           * object in Mozilla derivatives) - if those fails, a
>> generic
>> >> implementation
>> >> -         * is guaranteed to work in all platforms.
>> >> +         * is used that is guaranteed to work in all platforms.
>> >>          *
>> >>          * Parameters:
>> >>          *
>> >> @@ -84,6 +87,7 @@
>> >>                 if (s == "undefined")
>> >>                         return this._getContentAsStringGeneric(node);
>> >>             }
>> >> +            s = this._processTextareas(s);
>> >>             return s;
>> >>         },
>> >>
>> >> @@ -106,5 +110,14 @@
>> >>                         }
>> >>                 }
>> >>                 return s;
>> >> -       }
>> >> +       },
>> >> +
>> >> +        _processTextareas:function(htmlData)
>> >> +       {
>> >> +               var match = new
>> RegExp(tapestry.html.TextareaMatcher);
>> >> +                while (htmlData.match(match)){
>> >> +                    htmlData = htmlData.replace(match,
>> >> tapestry.html.TextareaReplacer);
>> >> +                }
>> >> +               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=477408&r1=477407&r2=477408
>>
>> >>
>> >>
>> >>
>> ==============================================================================
>>
>> >>
>> >> ---
>> >> tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js
>> >> (original)
>> >> +++
>> >> tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/test_html.js
>> >> Mon Nov 20 15:37:40 2006
>> >> @@ -23,6 +23,23 @@
>> >>          // only browser based tests will show if this is working
>> >> }
>> >>
>> >> +function test_html_getElementAsString(){
>> >> +
>> >> +        var node = _createTestNode();
>> >> +
>> >> +        var data =
>> >> tapestry.html.getElementAsString(node).toLowerCase();
>> >> +        jum.assertEquals("<div id=\"testid\"><div
>> >> id=\"testid2\">content</div></div>", data);
>> >> +}
>> >> +
>> >> +function test_html_processTextareas(){
>> >> +    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 + expected,
>> >> +        tapestry.html._processTextareas(initial+initial));
>> >> +}
>> >> +
>> >> function _createTestNode(element, empty){
>> >>         var node = document.createElement("div");
>> >>         node.setAttribute("id", "testid");
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>> -- 
>> Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
>> Tapestry / Tacos developer
>> Open Source / J2EE Consulting
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>


-- 
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to