Minidom empty script element bug

Derek Basch dbasch at yahoo.com
Tue Mar 15 17:56:31 EST 2005


Hello All,

I ran into a problem while dynamically constructing XHTML documents using
minidom. If you create a script tag such as:

script_node_0 = self.doc.createElement("script")
script_node_0.setAttribute("type", "text/javascript")
script_node_0.setAttribute("src", "../test.js")

minidom renders it as:

<script src='../test.js' type='text/javascript'/>

Which is incorrect because:

XHTML 1.0 specs, Appendix C
~~~~@~~~~
C.3 Element Minimization and Empty Element Content

Given an empty instance of an element whose content model is not EMPTY (for
example, an empty title or paragraph) do not use the minimized form (e.g.
use <p> </p> and not <p />)
~~~~@~~~~

reference for further explanation:
http://lists.evolt.org/archive/Week-of-Mon-20020304/105951.html

So, the rendered page completely fails on IE6 because it actually handles the
empty script element correctly. Mozilla handles the element incorrectly and
instantiates the javascript.

How do I get minidom to NOT render an empty script element? Should I submit a
bug report?

Thanks for the help,
Derek Basch





		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 



More information about the Python-list mailing list