You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Ganesh <ga...@j4fry.org> on 2009/04/21 10:12:41 UTC
MyFaces 2.0 AJAX html stripper regexps
Hi Werner,
After some testing with <\s*html[^>]*>(.*)<\/\s*html[^>]*> I couldn't
get it to work properly. Instead I used
var htmlStartEx = /<\s*html[^>]*>/gi;
var htmlEndEx = /<\/\s*html[^>]*>/gi;
and substring similar to Mojarra (same for head and body). Your approach
would be a lot cooler, but, as I said, it doesn't work for me. Maybe you
can get it to run?
The jsdocs and Mojarra want only the body CONTENTS replaced, omitting
the body tag's attributes. I see this as a bug and used replaceHtmlItem
to replace the entire body including the body tag for the patch. If you
can get your strippers to run, they will probably need some adjustment
to include the the tags, not only their contents.
Here is how I tested it: I renamed scriptTest.html to scriptTest.xhtml
and made it a JSF page. Then I modified index.xhtml to contain a button
that navigates to scriptTest.xhtml and ajaxified it. The server now
responds with a javax.faces.ViewRoot and replaces the complete contents
of index.xhtml with the contents of scriptTest.xhtml - works great :-)
Best Regards,
Ganesh
Re: MyFaces 2.0 AJAX html stripper regexps
Posted by Werner Punz <we...@gmail.com>.
I will rework it on thursday, I wonder why your tests failed it worked
for me , anyway I will rework it...
I rather prefer to do it in one regexp instead of finding startEx and endEx
Ganesh schrieb:
> Hi Werner,
>
> After some testing with <\s*html[^>]*>(.*)<\/\s*html[^>]*> I couldn't
> get it to work properly. Instead I used
>
> var htmlStartEx = /<\s*html[^>]*>/gi;
> var htmlEndEx = /<\/\s*html[^>]*>/gi;
>
> and substring similar to Mojarra (same for head and body). Your approach
> would be a lot cooler, but, as I said, it doesn't work for me. Maybe you
> can get it to run?
>
> The jsdocs and Mojarra want only the body CONTENTS replaced, omitting
> the body tag's attributes. I see this as a bug and used replaceHtmlItem
> to replace the entire body including the body tag for the patch. If you
> can get your strippers to run, they will probably need some adjustment
> to include the the tags, not only their contents.
>
> Here is how I tested it: I renamed scriptTest.html to scriptTest.xhtml
> and made it a JSF page. Then I modified index.xhtml to contain a button
> that navigates to scriptTest.xhtml and ajaxified it. The server now
> responds with a javax.faces.ViewRoot and replaces the complete contents
> of index.xhtml with the contents of scriptTest.xhtml - works great :-)
>
> Best Regards,
> Ganesh
>