mirror of
https://github.com/jquery/jquery.git
synced 2026-02-11 03:54:59 -05:00
Core:CSS: Attach test nodes to documentElement, not body
Attaching test divs to document.documentElement instead of document.body used to cause issues in jQuery 1.x; jQuery Compat doesn't execute any tests on document ready, though so it could be aligned with master. This makes jQuery Compat support tests work correctly even if jQuery is included & used in head before body even exists - making it similar to the master behavior. Fixes gh-2502
This commit is contained in:
@@ -88,15 +88,10 @@ define([
|
||||
|
||||
function computeStyleTests() {
|
||||
var contents, divStyle,
|
||||
body = document.body;
|
||||
|
||||
if ( !body || !body.style ) {
|
||||
// Test fired too early or in an unsupported environment, exit.
|
||||
return;
|
||||
}
|
||||
documentElement = document.documentElement;
|
||||
|
||||
// Setup
|
||||
body.appendChild( container );
|
||||
documentElement.appendChild( container );
|
||||
|
||||
div.style.cssText =
|
||||
// Support: Android 2.3
|
||||
@@ -162,7 +157,7 @@ define([
|
||||
}
|
||||
|
||||
// Teardown
|
||||
body.removeChild( container );
|
||||
documentElement.removeChild( container );
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user