Created
July 6, 2011 09:06
-
-
Save renan/1066877 to your computer and use it in GitHub Desktop.
jQuery + innerShiv, checking if it have any html5 tag on it first, see https://github.com/jdbartlett/innershiv/issues/9
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
(function ($) { | |
var init = jQuery.fn.init; rootjQuery = jQuery(document); | |
var html5 = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '); | |
$.fn.init = function (selector, context, rootjQuery) { | |
if (typeof selector == 'string' && selector.indexOf('>') != -1 && selector.indexOf('<') != -1) { | |
for (var i in html5) { | |
if (selector.indexOf('<' + html5[i]) != -1) { | |
return new init(innerShiv(selector, false), context, rootjQuery); | |
} | |
} | |
return new init(selector, context, rootjQuery); | |
} | |
return new init(selector, context, rootjQuery); | |
}; | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment