To weave a new dom fragment from an ajax response into a page dom, the
tacos.loadElement method performs this call:
localElement.innerHTML = tacos.getContentAsString(contents);
This causes the serialization and then re-serialization of the dom. However
the serialized xml that comes out is only semantically equivalent to the xml
that dojo receives from the server and then parses to generate the dom
object structure. In some cases, it is syntactically non-equivalent.
If browsers really were XHTML-compliant, this wouldn't be a problem. But we
all know that whitespace matters in browsers. The example that motivated
this investigation is from our application:
Our server generates <div></div> and after the serialization /
deserialization, it tries to weave <div/> into the original dom. Browsers
don't apply css styles to <div/> the same way they do it to <div></div>. So
I did some digging.
One solution is to do the following:
dojo.dom.removeChildren(localElement);
dojo.dom.moveChildren(contents, localElement);
// Hack forcing browser to apply css styles to the new fragment.
localElement.innerHTML = localElement.innerHTML;
The removeChildren and moveChildren calls should be obvious. But the key
difference is that they weave in dom nodes that were created from the first
parse of the xml stream received from the server. The second part is a bit
of a hack to force the browser to to apply css to the updated nodes.
This works great in Firefox, but not in IE, because dojo calls new
ActiveXObject("Microsoft.XMLDOM") to get its dom parser, and the nodes
created by that dom parser aren't compatible with the nodes created by ie
when it parsers the original page stream.
It seems that the best solution would be to have tacos take back text/plain
content from dojo.io.bind and then parse the stream with the same version of
the MS dom parser that ie is using.
Only problem is that i don't know how to detect which version ie is using.
And since this involves a fairly substantial change to the process, I
thought I'd post the proposal here before working on it any harder.
So... what is the answer?
[EMAIL PROTECTED]
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.5/321 - Release Date: 4/21/2006
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel