2012-07-18
liffiton
The comment/CDATA prefix/suffix surrounding code within <script> blocks in multiple places in Dokuwiki (such as _tpl_metaheaders_action()) causes invalid syntax errors in IE (version 9 and I believe 8 as well) and prevents the code from running.
For example, creating a script block in a plugin using the handle_tpl_metaheader_output() function and specifying a non-empty _data member (as in the mathjax plugin, where a user ran into this) will create a script block with contents like:
<!--//--><![CDATA[//><!--
alert("Hi")
//--><!]]>
Executing this in IE9's javascript console produces a syntax error, and the script (created by a plugin) fails to run on any wiki page as well.
In the javascript console, this simpler version works correctly, and modifying _tpl_metaheaders_action() in template.php to match fixes the plugin for IE:
/*<![CDATA[*/
alert("Hi")
/*!]]>*/
The same CDATA prefix/suffix shows up in a few places in inc/html.php as well. I haven't experienced the issue outside of the mathjax plugin, but I expect it produces the same error when it appears in other places.
To reproduce:
1) Install the mathjax plugin (alternatively: create a new plugin that creates a script block with inline code)
2) Load any wiki page with IE9
3) There will either be an error reported upon loading the page, or else it will be visible in the javascript console (F12 to access developer tools)