backbone-js-on-rails
backbone-js-on-rails copied to clipboard
Bootstrapping data in IE 8
Under the Security section, IE8 standards mode has a problem with grabbing the text of a script tag of type "text/json".
<script type="text/json" id="bootstrap">
{ "hello" : "world" }
</script>
From developer console inside of IE8:
$("#bootstrap").html()
$("#bootstrap").text()
The first line gives you what you expect. The second, however, gives you an empty string.
Proposed amendment:
div.html($('#bootstrap').html());
From my tests this gives you the same XSS protection as the current version but works in >= IE 8, Safari, Chrome, & Firefox.