简体   繁体   中英

Prevent TinyMCE adding a space to the <!--[if lt IE9]> tags?

I am in the unfortunate situation of having to provide support for IE8 and I am loading html5shiv and respondjs into the <head> to deal with this.

However, I have to load all my header and footer code in a TinyMCE 4 editor instance. And TinyMCE seems to have a mind-boggling issue where it adds a space into the conditional where by:

<!--[if lt IE 9]>

becomes:

<!-- [if lt IE 9]>

after I save it, and the one little added space between the - and the [ breaks the conditional so the html5shiv and respondjs scripts inside it are never included.

Is there any way to fix this without directly modifying the TinyMCE init script? (as I have no control over that).

Would it matter if I just loaded the scripts without the conditionals (on all browsers)? What effect would they have on other non-IE browsers?

Discovered TinyMCE do have an option for this, passed into the tinymce.init function.

protect: [/\<!--\[.*\]\>/g, /\<!\[.*\]--\>/g]

http://www.tinymce.com/wiki.php/Configuration:protect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM