Created
May 12, 2011 09:59
-
-
Save c4urself/968270 to your computer and use it in GitHub Desktop.
HTML5 for Ajax loaded content in IE 7 and 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.changer.nl | |
// http://jdbartlett.github.com/innershiv | |
window.innerShiv = (function() { | |
var d, r; | |
return function(h, u) { | |
if (!d) { | |
d = document.createElement('div'); | |
r = document.createDocumentFragment(); | |
/*@cc_on d.style.display = 'none';@*/ | |
} | |
var e = d.cloneNode(true); | |
/*@cc_on document.body.appendChild(e);@*/ | |
e.innerHTML = h; | |
/*@cc_on document.body.removeChild(e);@*/ | |
if (u === false) return e.childNodes; | |
var f = r.cloneNode(true), i = e.childNodes.length; | |
while (i--) f.appendChild(e.firstChild); | |
return f; | |
} | |
}()); | |
jQuery.ajaxSetup({ | |
dataFilter: function(data, dataType) { | |
if (typeof innerShiv === 'function' && (dataType === 'html' || dataType === undefined)) { | |
return innerShiv(data, false); | |
} | |
else { | |
return data; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment