aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.js
blob: 832f192d51c48d01c322b575dfa3014f1382f6ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
define([
	"./core",
	"./var/strundefined",
	"./var/support",
	// This is listed as a dependency for build order, but it's still optional in builds
	"./core/ready"
], function( jQuery, strundefined, support ) {

// Note: most support tests are defined in their respective modules.

jQuery(function() {
	// We need to execute this one support test ASAP because we need to know
	// if body.style.zoom needs to be set.

	var container,
		div = document.createElement( "div" ),
		divReset =
			"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" +
			"display:block;padding:0;margin:0;border:0",
		body = document.getElementsByTagName("body")[0];

	if ( !body ) {
		// Return for frameset docs that don't have a body
		return;
	}

	// Setup
	div.setAttribute( "className", "t" );
	div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";

	container = document.createElement( "div" );
	container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";

	body.appendChild( container ).appendChild( div );

	// Will be changed later if needed.
	support.inlineBlockNeedsLayout = false;

	if ( typeof div.style.zoom !== strundefined ) {
		// Support: IE<8
		// Check if natively block-level elements act like inline-block
		// elements when setting their display to 'inline' and giving
		// them layout
		div.innerHTML = "";
		div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
		support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );

		if ( support.inlineBlockNeedsLayout ) {
			// Prevent IE 6 from affecting layout for positioned elements #11048
			// Prevent IE from shrinking the body in IE 7 mode #12869
			// Support: IE<8
			body.style.zoom = 1;
		}
	}

	body.removeChild( container );

	// Null elements to avoid leaks in IE
	container = div = null;
});

});