mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
HTMLStringToElements adds comments to force tag closers
This commit is contained in:
parent
deaa391103
commit
ac091ce40e
@ -31,8 +31,7 @@ def displayhtml (public_key,
|
||||
else:
|
||||
server = API_SERVER
|
||||
|
||||
# DCR: added comment to force ElementTree to emit </script> tag closer
|
||||
return """<script type="text/javascript" src="%(ApiServer)s/challenge?k=%(PublicKey)s%(ErrorParam)s"><!-- --></script>
|
||||
return """<script type="text/javascript" src="%(ApiServer)s/challenge?k=%(PublicKey)s%(ErrorParam)s"></script>
|
||||
|
||||
<noscript>
|
||||
<iframe src="%(ApiServer)s/noscript?k=%(PublicKey)s%(ErrorParam)s" height="300" width="500" frameborder="0"></iframe><br />
|
||||
|
@ -4083,6 +4083,17 @@ class HTMLStringToElements(HTMLParser):
|
||||
self._elementStack.top().text = data
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
top = self._elementStack.top()
|
||||
if len(top.getchildren()) == 0:
|
||||
# insert a comment to prevent ElementTree from using <... /> convention
|
||||
# force it to create a tag closer a la </tag>
|
||||
# prevents problems in certain browsers
|
||||
if top.tag == 'script' and top.get('type') == 'text/javascript':
|
||||
if top.text == None:
|
||||
top.text = '// force tag closer'
|
||||
else:
|
||||
self.handle_comment('force tag closer')
|
||||
self._elementStack.pop()
|
||||
self._elementStack.pop()
|
||||
|
||||
def handle_comment(self, data):
|
||||
|
Loading…
x
Reference in New Issue
Block a user