/* innerShiv: makes HTML5shim work on innerHTML & jQuery * http://jdbartlett.github.com/innershiv * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */
window.innerShiv = (function () {
	var div; var doc = document; var needsShiv; var html5 = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' ');
	function fcloseTag(all, front, tag) { return (/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i).test(tag) ? all : front + '></' + tag + '>'; }
	return function ( html, returnFrag) { if (!div) { div = doc.createElement('div'); div.innerHTML = '<nav></nav>'; needsShiv = div.childNodes.length !== 1; if (needsShiv) { var shimmedFrag = doc.createDocumentFragment(); var i = html5.length; while (i--) { shimmedFrag.createElement(html5[i]); } shimmedFrag.appendChild(div); } } html = html .replace(/^\s\s*/, '').replace(/\s\s*$/, '') .replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '') .replace(/(<([\w:]+)[^>]*?)\/>/g, fcloseTag); var tabled; if (tabled = html.match(/^<(tbody|tr|td|th|col|colgroup|thead|tfoot)[\s\/>]/i)) { div.innerHTML = '<table>' + html + '</table>'; } else { div.innerHTML = html; } var scope; if (tabled) { scope = div.getElementsByTagName(tabled[1])[0].parentNode; } else { scope = div; } if (returnFrag === false) { return scope.childNodes; } var returnedFrag = doc.createDocumentFragment(); var j = scope.childNodes.length; while (j--) { returnedFrag.appendChild(scope.firstChild); } return returnedFrag; };
}());
