ded/bonzo — pull request #51 by runningskull (2011-11-24 08:42:36+00:00)
Title: Make html() more robust for older versions of IE

IE8 will throw a "Unknown Runtime Error" if you attempt to set the innerHTML for a block-level element nested inside a inline-level element (ie. a <div> inside a <p>).

If we catch an error trying to set the innerHTML, we can fall back on empty()'ing the element and then appending the HTML as an element instead.

This is the same technique that jQuery uses (https://github.com/jquery/jquery/blob/master/src/manipulation.js#L231-243), presumably for the same reason.

Thanks as always for the great micro-libraries. They rock my world.

ps. Here's the earliest mention of this quirk I can find: http://blog.rakeshpai.me/2007/02/ies-unknown-runtime-error-when-using.html