How to fix innerHTML on IE not rendering entities with HTML5 doctype?
I'm observing that when using an HTML5 doctype (<!DOCTYPE html>)
, assigning a string containing HTML entities to a DOM object's innerHTML does not convert/render those entities on IE8 (and probably other IE versions).
document.getElementById('some-div').innerHTML = 'Doesn't work.';
Does anybody have a solution? I've come across this: http://ajaxian.com/archives/innershiv-mak开发者_如何学Pythone-innerhtml-html5-work-in-ie, but it doesn't remedy the situation. The example I give above is of an element that's already on the DOM anyways.
It's '
(and it does not work even using HTML4.01 DOCTYPE).
Other HTML entities like © &
etc work perfectly both IE7 and IE8.
'
does not work in IE (it's not because of HTML5 DOCTYPE, it's the same with other DOCTYPE).
Also here they say it does not work, use '
as apostrophe
精彩评论