You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Werner Punz <we...@gmail.com> on 2009/06/25 17:44:36 UTC
Re: Myfaces 2.0 javascript javax.faces.viewRoot response need some
feedback from others
Curtiss Howard schrieb:
> Forgive me if I'm missing some important details, but why even use
> innerHTML in the first place? It should be possible to parse the
> incoming text into a DOM node (there's some JS function for it, I
> can't remember which), then import that node as a sibling of the
> <body> element (for example) and delete the first <body> element.
> Wouldn't that work?
It was one of my testcases to do that since I shun innerHTML (we dont do
it anyway normally)
Does not work either on safari...
You can do dom manipulation on the contents of the body element but you
cannot delete the body element in most browsers under xhtml conditions
as it seems!
Re: Myfaces 2.0 javascript javax.faces.viewRoot response need some
feedback from others
Posted by Werner Punz <we...@gmail.com>.
Werner Punz schrieb:
> Curtiss Howard schrieb:
>
>> Forgive me if I'm missing some important details, but why even use
>> innerHTML in the first place? It should be possible to parse the
>> incoming text into a DOM node (there's some JS function for it, I
>> can't remember which), then import that node as a sibling of the
>> <body> element (for example) and delete the first <body> element.
>> Wouldn't that work?
> It was one of my testcases to do that since I shun innerHTML (we dont do
> it anyway normally)
> Does not work either on safari...
> You can do dom manipulation on the contents of the body element but you
> cannot delete the body element in most browsers under xhtml conditions
> as it seems!
>
>
Ok it seems I overlooked something as it seems it is possible to replace
the body element, after all, which means I only have to parse that one
and replace it in case of getting a viewRoot.
The problem still persists that we cannot properly deal with the head.
As it seems we have to change our code simply to replace only the body
in any case...
Werner
Re: Myfaces 2.0 javascript javax.faces.viewRoot response need some
feedback from others
Posted by Werner Punz <we...@gmail.com>.
Werner Punz schrieb:
> Werner Punz schrieb:
>> Curtiss Howard schrieb:
>>
>>> Forgive me if I'm missing some important details, but why even use
>>> innerHTML in the first place? It should be possible to parse the
>>> incoming text into a DOM node (there's some JS function for it, I
>>> can't remember which), then import that node as a sibling of the
>>> <body> element (for example) and delete the first <body> element.
>>> Wouldn't that work?
>> It was one of my testcases to do that since I shun innerHTML (we dont
>> do it anyway normally)
>> Does not work either on safari...
>> You can do dom manipulation on the contents of the body element but
>> you cannot delete the body element in most browsers under xhtml
>> conditions as it seems!
>>
>>
> Ah ok mea culpa, again a message.
> What does work is document createElement("body") and then set that one
> one way or the other.
>
> What is problematic as it seems is to use the range functionality to
> achieve the same by a contextual fragment which should replace the body,
> this does not work in some cases, but would be the cleaner solution for
> non ie cases!
> (having the browser parse the entire tag including its attributes)
>
>
> I will do some final testing regarding this, but as it seems, I have to
> parse the body tag attributes from the string coming from the server and
> have it assigned programatically in any case.
>
> It was probably a little bit to early to send first mail regarding this
> problem ;-)
>
> Anyway one way or the other I want to have embedded body tag attributes
> assigned if they come from the server!
>
> Btw. the last time which has been months ago mojarra had in this part
> absolutely broken code. They used regular expressions which failed in
> many cases (like tags embedded into comments etc...)
> and they simply ignored any tag attributes, they just created a body tag
> and then pushed the content in via innerHTML also ignoring embedded
> scripts (which they seem to ignore entirely)
>
> not sure if they have changed that! Hazem pointed them I think towards
> not doing anything about embedded scripts I am not sure if they have
> fixed it already. This might become a problem for ajax libraries unless
> they add the script parsing needed via listeners!
>
>
ok just in case if someone reads this.
head element does not work out on some browsers, it probably is better
to skip this entirely,
body replacement this works out somewhat differently we cannot
use our replacement code directly on the body, this does not work in any
browser (firefox drops the body element directly while others fail with
an error in this case), instead we have to work around that by
a) creating a body element via document.createElement
b) adding a placeHolder div as dummy child
c) assign the defakto empty body via replaceElement
d) then use our replacement code as is on the dummy child and the new
body content
e) then assign all pending attributes from the old body to our new one
to preserver styleClasses and styles!
I have this one now working via a new parsing code which also parses the
attributes from the tag which has to be parsed and will commit it the
next days!
I am not sure if we have to deal in similar manners with the special
cases of head and body being sent as
own entities in javax.faces.head and javax.faces.body,I have to what
data we get in those cases from the server, but I assume the head or
body tags...
Werner
Re: Myfaces 2.0 javascript javax.faces.viewRoot response need some
feedback from others
Posted by Werner Punz <we...@gmail.com>.
Werner Punz schrieb:
> Curtiss Howard schrieb:
>
>> Forgive me if I'm missing some important details, but why even use
>> innerHTML in the first place? It should be possible to parse the
>> incoming text into a DOM node (there's some JS function for it, I
>> can't remember which), then import that node as a sibling of the
>> <body> element (for example) and delete the first <body> element.
>> Wouldn't that work?
> It was one of my testcases to do that since I shun innerHTML (we dont do
> it anyway normally)
> Does not work either on safari...
> You can do dom manipulation on the contents of the body element but you
> cannot delete the body element in most browsers under xhtml conditions
> as it seems!
>
>
Ah ok mea culpa, again a message.
What does work is document createElement("body") and then set that one
one way or the other.
What is problematic as it seems is to use the range functionality to
achieve the same by a contextual fragment which should replace the body,
this does not work in some cases, but would be the cleaner solution for
non ie cases!
(having the browser parse the entire tag including its attributes)
I will do some final testing regarding this, but as it seems, I have to
parse the body tag attributes from the string coming from the server and
have it assigned programatically in any case.
It was probably a little bit to early to send first mail regarding this
problem ;-)
Anyway one way or the other I want to have embedded body tag attributes
assigned if they come from the server!
Btw. the last time which has been months ago mojarra had in this part
absolutely broken code. They used regular expressions which failed in
many cases (like tags embedded into comments etc...)
and they simply ignored any tag attributes, they just created a body tag
and then pushed the content in via innerHTML also ignoring embedded
scripts (which they seem to ignore entirely)
not sure if they have changed that! Hazem pointed them I think towards
not doing anything about embedded scripts I am not sure if they have
fixed it already. This might become a problem for ajax libraries unless
they add the script parsing needed via listeners!
Werner