Make sure that the body element exists before doing the body selector optimization. Fixes #6529.

This commit is contained in:
jeresig 2010-09-24 15:53:38 -04:00
parent 5c055040d3
commit e0a9615f82

View file

@ -91,7 +91,7 @@ jQuery.fn = jQuery.prototype = {
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context ) {
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = "body";