backbone-js-on-rails icon indicating copy to clipboard operation
backbone-js-on-rails copied to clipboard

Bootstrapping data in IE 8

Open morganick opened this issue 11 years ago • 0 comments

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.

morganick avatar Mar 07 '13 20:03 morganick