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



Reply via email to