]> source.dussan.org Git - jquery.git/commitdiff
Fixes #9109. When jQuery is loaded in the body, then the fake body element used in...
authorjaubourg <j@ubourg.net>
Mon, 9 May 2011 07:48:23 +0000 (09:48 +0200)
committerjaubourg <j@ubourg.net>
Mon, 9 May 2011 07:48:23 +0000 (09:48 +0200)
src/support.js
test/boxModelIE.html [new file with mode: 0644]

index 41af0632206138417f7d253e1e9d6867a2e71e52..9a6a318d19c34eabc735aa19e0af00ae093369d5 100644 (file)
@@ -3,6 +3,7 @@
 jQuery.support = (function() {
 
        var div = document.createElement( "div" ),
+               documentElement = document.documentElement,
                all,
                a,
                select,
@@ -150,7 +151,7 @@ jQuery.support = (function() {
                body.style[ i ] = bodyStyle[ i ];
        }
        body.appendChild( div );
-       document.documentElement.appendChild( body );
+       documentElement.insertBefore( body, documentElement.firstChild );
 
        // Check if a disconnected checkbox will retain its checked
        // value of true after appended to the DOM (IE6/7)
@@ -210,7 +211,7 @@ jQuery.support = (function() {
 
        // Remove the body element we added
        body.innerHTML = "";
-       document.documentElement.removeChild( body );
+       documentElement.removeChild( body );
 
        // Technique from Juriy Zaytsev
        // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
diff --git a/test/boxModelIE.html b/test/boxModelIE.html
new file mode 100644 (file)
index 0000000..f8e6a43
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<body>
+       <h3>jQuery Test boxModel detection in IE 6 & 7 compatMode="CSS1Compat"</h3>
+       <div>document.compatMode = <span id="compat-mode">?</span></div>
+       <div>jQuery.support.boxModel = <span id="box-model">?</span></div>
+       <script src="../src/core.js"></script>
+       <script src="../src/deferred.js"></script>
+       <script src="../src/support.js"></script>
+       <script src="../src/data.js"></script>
+       <script src="../src/queue.js"></script>
+       <script src="../src/attributes.js"></script>
+       <script src="../src/event.js"></script>
+       <script src="../src/sizzle/sizzle.js"></script>
+       <script src="../src/sizzle-jquery.js"></script>
+       <script src="../src/traversing.js"></script>
+       <script src="../src/manipulation.js"></script>
+       <script src="../src/css.js"></script>
+       <script src="../src/ajax.js"></script>
+       <script src="../src/ajax/jsonp.js"></script>
+       <script src="../src/ajax/script.js"></script>
+       <script src="../src/ajax/xhr.js"></script>
+       <script src="../src/effects.js"></script>
+       <script src="../src/offset.js"></script>
+       <script src="../src/dimensions.js"></script>
+       <script>
+       jQuery(function() {
+               jQuery( "#compat-mode" ).text( document.compatMode );
+               jQuery( "#box-model" ).text( jQuery.support.boxModel );
+       });
+       </script>
+</body>
+</html>
\ No newline at end of file