1

I'm getting a weird issue in IE 8.

Here's what we got. Running Asp.net MVC 3. Using Ajax.beginform to post some databack. The response returns a view that contains HTML 5 in it (just a section tag). This works just fine in browsers that know what the heck HTML 5 is.

@using (Ajax.BeginForm(new AjaxOptions {InsertionMode = InsertionMode.Replace, UpdateTargetId = "main" }))
{
    <section class="stackoverflow">Hello World!</section>
}

However, in IE 8, when the HTML gets inserted, we get some funkiness. Inspecting the element using the developer tools show that IE 8 is self closing the section tag instead of wrapping the tag around the content like this:

<section class="stackoverflow"/>
Text - Hello World!

We are referencing the popular HTML5 shiv JS file but that doesnt seem to have any affect after page load. It appears that whatever javascript is doing the insertion, isn't recognizing the new section tag.

The other interesting thing is that when UnobtrusiveJavaScriptEnabled is false in the web.config, it works just fine. But we need to have UnobtrusiveJavaScriptEnabled enabled for a few other reasons.

Any ideas?

1 Answer 1

1

Disabling UnobtrusiveJavaScriptEnabled will use the Microsoft Ajax libraries whereas when its enabled, it uses the JQUery libraries. This is why there's the inconsistency between it working when disabled and working when enabled. JQuery doesnt use innerHTML when inserting the DOM elements whereas the MS libraries do.

I have found some work arounds using a plugin called innershiv. Here are some references: http://tomcoote.co.uk/javascript/ajax-html5-in-ie/
Can't select HTML5 element's children in IE8 with jQuery selector


We are also using HTML5 shiv which this issue is a reported bug:
http://code.google.com/p/html5shiv/issues/detail?id=4

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.