[Developers] mjt xhtml

Nick Thompson nix at metaweb.com
Tue Apr 3 19:48:00 UTC 2007


vtalwar at berkeley.edu wrote:
> The thought of using mjt to create svg's recently popped into my head.

neat!  i'd thought about trying this but figured that xml vs html issues
would make it too hard - but it sounds like you already got pretty far.  if
it's making it as far as the double id="..." attribute then i think the
chances are good that it can work, at least in firefox.

> Essentially what's happening is that when the attributes are generated for
> "top", you get something like this trying to be created in the XML
> document:
> 
> <DIV style="display: none;" id="top" id="top">1</DIV>

there is a mjt.js bug here... as you point out, the browser tolerates the
duplicated id="top" in html, but xml is not so forgiving.

i'll be pushing out a new version of mjt.js this week with a fix for this
bug as well as some other goodies.  i need to test the new goodies on
ie6 first :-/.

     nick

> 
> (this markup is from the flatten_markup function)
> This is fine in the HTML document but is problematic for the XML document
> since it doesn't allow for duplicate attributes (the id attr). The end
> result is that setting the innerHTML value for tmpdiv in replace_html()
> has no effect (since the xml doesn't validate I guess? not sure...). I got
> around this problem by changing using createElementNS with
> "http://www.w3.org/TR/REC-html40" to create tempdiv and also the original
> "top" div but then document.getElementById doesn't seem to be able to find
> "top" (maybe since it has a different namespace now? not sure again...).
> 
> Any suggestions would be much appreciated :)
> 
> Thanks,
> Vishal
> 
> 
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers



More information about the Developers mailing list