Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove the invisible body in support; Add temporary tests to verify c…

…orrect support completions for upcoming support changes.
  • Loading branch information...
commit 3d6237ef8aff8a31ace3e956e2700aa11e3da752 1 parent 0de484d
Timmy Willison authored November 17, 2011
166  src/support.js
@@ -2,31 +2,26 @@
2 2
 
3 3
 jQuery.support = (function() {
4 4
 
5  
-	var div = document.createElement( "div" ),
6  
-		documentElement = document.documentElement,
  5
+	var support,
7 6
 		all,
8 7
 		a,
9 8
 		select,
10 9
 		opt,
11 10
 		input,
12 11
 		marginDiv,
13  
-		support,
14 12
 		fragment,
15  
-		body,
16  
-		testElementParent,
17  
-		testElement,
18  
-		testElementStyle,
19 13
 		tds,
20 14
 		events,
21 15
 		eventName,
22 16
 		i,
23  
-		isSupported;
  17
+		isSupported,
  18
+		div = document.createElement( "div" ),
  19
+		documentElement = document.documentElement;
24 20
 
25 21
 	// Preliminary tests
26 22
 	div.setAttribute("className", "t");
27 23
 	div.innerHTML = "   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
28 24
 
29  
-
30 25
 	all = div.getElementsByTagName( "*" );
31 26
 	a = div.getElementsByTagName( "a" )[ 0 ];
32 27
 
@@ -46,11 +41,11 @@ jQuery.support = (function() {
46 41
 
47 42
 		// Make sure that tbody elements aren't automatically inserted
48 43
 		// IE will insert them into empty tables
49  
-		tbody: !div.getElementsByTagName( "tbody" ).length,
  44
+		tbody: !div.getElementsByTagName("tbody").length,
50 45
 
51 46
 		// Make sure that link elements get serialized correctly by innerHTML
52 47
 		// This requires a wrapper element in IE
53  
-		htmlSerialize: !!div.getElementsByTagName( "link" ).length,
  48
+		htmlSerialize: !!div.getElementsByTagName("link").length,
54 49
 
55 50
 		// Get the style information from getAttribute
56 51
 		// (IE uses .cssText instead)
@@ -58,7 +53,7 @@ jQuery.support = (function() {
58 53
 
59 54
 		// Make sure that URLs aren't manipulated
60 55
 		// (IE normalizes it by default)
61  
-		hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
  56
+		hrefNormalized: ( a.getAttribute("href") === "/a" ),
62 57
 
63 58
 		// Make sure that element opacity exists
64 59
 		// (IE uses filter instead)
@@ -140,81 +135,13 @@ jQuery.support = (function() {
140 135
 	// WebKit doesn't clone checked state correctly in fragments
141 136
 	support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
142 137
 
143  
-	div.innerHTML = "";
144  
-
145  
-	// Figure out if the W3C box model works as expected
146  
-	div.style.width = div.style.paddingLeft = "1px";
147  
-
148  
-	// We don't want to do body-related feature tests on frameset
149  
-	// documents, which lack a body. So we use
150  
-	// document.getElementsByTagName("body")[0], which is undefined in
151  
-	// frameset documents, while document.body isn’t. (7398)
152  
-	body = document.getElementsByTagName("body")[ 0 ];
153  
-	// We use our own, invisible, body unless the body is already present
154  
-	// in which case we use a div (#9239)
155  
-	testElement = document.createElement( body ? "div" : "body" );
156  
-	testElementStyle = {
157  
-		visibility: "hidden",
158  
-		width: 0,
159  
-		height: 0,
160  
-		border: 0,
161  
-		margin: 0,
162  
-		background: "none"
163  
-	};
164  
-	if ( body ) {
165  
-		jQuery.extend( testElementStyle, {
166  
-			position: "absolute",
167  
-			left: "-999px",
168  
-			top: "-999px"
169  
-		});
170  
-	}
171  
-	for ( i in testElementStyle ) {
172  
-		testElement.style[ i ] = testElementStyle[ i ];
173  
-	}
174  
-	testElement.appendChild( div );
175  
-	testElementParent = body || documentElement;
176  
-	testElementParent.insertBefore( testElement, testElementParent.firstChild );
177  
-
178 138
 	// Check if a disconnected checkbox will retain its checked
179 139
 	// value of true after appended to the DOM (IE6/7)
180 140
 	support.appendChecked = input.checked;
181 141
 
182  
-	support.boxModel = div.offsetWidth === 2;
183  
-
184  
-	if ( "zoom" in div.style ) {
185  
-		// Check if natively block-level elements act like inline-block
186  
-		// elements when setting their display to 'inline' and giving
187  
-		// them layout
188  
-		// (IE < 8 does this)
189  
-		div.style.display = "inline";
190  
-		div.style.zoom = 1;
191  
-		support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
192  
-
193  
-		// Check if elements with layout shrink-wrap their children
194  
-		// (IE 6 does this)
195  
-		div.style.display = "";
196  
-		div.innerHTML = "<div style='width:4px;'></div>";
197  
-		support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
198  
-	}
199  
-
200  
-	div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
201  
-	tds = div.getElementsByTagName( "td" );
202  
-
203  
-	// Check if table cells still have offsetWidth/Height when they are set
204  
-	// to display:none and there are still other visible table cells in a
205  
-	// table row; if so, offsetWidth/Height are not reliable for use when
206  
-	// determining if an element has been hidden directly using
207  
-	// display:none (it is still safe to use offsets if a parent element is
208  
-	// hidden; don safety goggles and see bug #4512 for more information).
209  
-	// (only IE 8 fails this test)
210  
-	isSupported = ( tds[ 0 ].offsetHeight === 0 );
211  
-
212  
-	tds[ 0 ].style.display = "";
213  
-	tds[ 1 ].style.display = "none";
  142
+	fragment.removeChild( input );
  143
+	fragment.appendChild( div );
214 144
 
215  
-	// Check if empty table cells still have offsetWidth/Height
216  
-	// (IE < 8 fail this test)
217  
-	support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
218 145
 	div.innerHTML = "";
219 146
 
220 147
 	// Check if div with explicit width and no margin-right incorrectly
@@ -222,13 +149,14 @@ jQuery.support = (function() {
222 149
 	// info see bug #3333
223 150
 	// Fails in WebKit before Feb 2011 nightlies
224 151
 	// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
225  
-	if ( document.defaultView && document.defaultView.getComputedStyle ) {
  152
+	if ( window.getComputedStyle ) {
226 153
 		marginDiv = document.createElement( "div" );
227 154
 		marginDiv.style.width = "0";
228 155
 		marginDiv.style.marginRight = "0";
  156
+		div.style.width = "2px";
229 157
 		div.appendChild( marginDiv );
230 158
 		support.reliableMarginRight =
231  
-			( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
  159
+			( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
232 160
 	}
233 161
 
234 162
 	// Technique from Juriy Zaytsev
@@ -242,7 +170,7 @@ jQuery.support = (function() {
242 170
 			submit: 1,
243 171
 			change: 1,
244 172
 			focusin: 1
245  
-		} ) {
  173
+		}) {
246 174
 			eventName = "on" + i;
247 175
 			isSupported = ( eventName in div );
248 176
 			if ( !isSupported ) {
@@ -253,11 +181,10 @@ jQuery.support = (function() {
253 181
 		}
254 182
 	}
255 183
 
256  
-	testElement.innerHTML = "";
257  
-	testElementParent.removeChild( testElement );
  184
+	fragment.removeChild( div );
258 185
 
259  
-	// Null connected elements to avoid leaks in IE
260  
-	testElement = fragment = select = opt = body = marginDiv = div = input = null;
  186
+	// Null elements to avoid leaks in IE
  187
+	fragment = select = opt = body = marginDiv = div = input = null;
261 188
 
262 189
 	// Run fixed position tests at doc ready to avoid a crash
263 190
 	// related to the invisible body in IE8
@@ -268,8 +195,8 @@ jQuery.support = (function() {
268 195
 			vb = "visibility:hidden;border:0;",
269 196
 			style = "style='" + ptlm + "border:5px solid #000;padding:0;'",
270 197
 			html = "<div " + style + "><div></div></div>" +
271  
-							"<table " + style + " cellpadding='0' cellspacing='0'>" +
272  
-							"<tr><td></td></tr></table>";
  198
+				"<table " + style + " cellpadding='0' cellspacing='0'>" +
  199
+				"<tr><td></td></tr></table>";
273 200
 
274 201
 		// Reconstruct a container
275 202
 		body = document.getElementsByTagName("body")[0];
@@ -283,13 +210,53 @@ jQuery.support = (function() {
283 210
 		container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
284 211
 		body.insertBefore( container, body.firstChild );
285 212
 
286  
-		// Construct a test element
287  
-		testElement = document.createElement("div");
288  
-		testElement.style.cssText = ptlm + vb;
  213
+		// Construct the test element
  214
+		div = document.createElement("div");
  215
+		container.appendChild( div );
  216
+
  217
+		// Check if table cells still have offsetWidth/Height when they are set
  218
+		// to display:none and there are still other visible table cells in a
  219
+		// table row; if so, offsetWidth/Height are not reliable for use when
  220
+		// determining if an element has been hidden directly using
  221
+		// display:none (it is still safe to use offsets if a parent element is
  222
+		// hidden; don safety goggles and see bug #4512 for more information).
  223
+		// (only IE 8 fails this test)
  224
+		div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
  225
+		tds = div.getElementsByTagName( "td" );
  226
+		isSupported = ( tds[ 0 ].offsetHeight === 0 );
  227
+
  228
+		tds[ 0 ].style.display = "";
  229
+		tds[ 1 ].style.display = "none";
  230
+
  231
+		// Check if empty table cells still have offsetWidth/Height
  232
+		// (IE <= 8 fail this test)
  233
+		support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
  234
+
  235
+		// Figure out if the W3C box model works as expected
  236
+		div.innerHTML = "";
  237
+		div.style.width = div.style.paddingLeft = "1px";
  238
+		jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
  239
+
  240
+		if ( typeof div.style.zoom !== "undefined" ) {
  241
+			// Check if natively block-level elements act like inline-block
  242
+			// elements when setting their display to 'inline' and giving
  243
+			// them layout
  244
+			// (IE < 8 does this)
  245
+			div.style.display = "inline";
  246
+			div.style.zoom = 1;
  247
+			support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
  248
+
  249
+			// Check if elements with layout shrink-wrap their children
  250
+			// (IE 6 does this)
  251
+			div.style.display = "";
  252
+			div.innerHTML = "<div style='width:4px;'></div>";
  253
+			support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
  254
+		}
  255
+
  256
+		div.style.cssText = ptlm + vb;
  257
+		div.innerHTML = html;
289 258
 
290  
-		testElement.innerHTML = html;
291  
-		container.appendChild( testElement );
292  
-		outer = testElement.firstChild;
  259
+		outer = div.firstChild;
293 260
 		inner = outer.firstChild;
294 261
 		td = outer.nextSibling.firstChild.firstChild;
295 262
 
@@ -312,7 +279,7 @@ jQuery.support = (function() {
312 279
 		offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
313 280
 
314 281
 		body.removeChild( container );
315  
-		testElement = container = null;
  282
+		div  = container = null;
316 283
 
317 284
 		jQuery.extend( support, offsetSupport );
318 285
 	});
@@ -320,7 +287,4 @@ jQuery.support = (function() {
320 287
 	return support;
321 288
 })();
322 289
 
323  
-// Keep track of boxModel
324  
-jQuery.boxModel = jQuery.support.boxModel;
325  
-
326 290
 })( jQuery );
2  test/data/support/boxModelIE.html
@@ -22,7 +22,7 @@
22 22
 	<script src="../../../src/offset.js"></script>
23 23
 	<script src="../../../src/dimensions.js"></script>
24 24
 	<script>
25  
-	window.parent.supportCallback( document.compatMode, jQuery.support.boxModel );
  25
+	jQuery(function() { window.parent.supportCallback( document.compatMode, jQuery.support.boxModel ) });
26 26
 	</script>
27 27
 </body>
28 28
 </html>
2  test/index.html
@@ -36,9 +36,9 @@
36 36
 	<script src="data/testrunner.js"></script>
37 37
 
38 38
 	<script src="unit/core.js"></script>
39  
-	<script src="unit/support.js"></script>
40 39
 	<script src="unit/callbacks.js"></script>
41 40
 	<script src="unit/deferred.js"></script>
  41
+	<script src="unit/support.js"></script>
42 42
 	<script src="unit/data.js"></script>
43 43
 	<script src="unit/queue.js"></script>
44 44
 	<script src="unit/attributes.js"></script>
264  test/unit/support.js
@@ -60,3 +60,267 @@ supportIFrameTest( "A background on the testElement does not cause IE8 to crash
60 60
 	expect(1);
61 61
 	ok( true, "IE8 does not crash" );
62 62
 });
  63
+
  64
+var userAgent = window.navigator.userAgent;
  65
+
  66
+// These tests do not have to stay
  67
+// They are here to help with upcoming support changes for 1.8
  68
+if ( /chrome\/16\.0/i.test(userAgent) ) {
  69
+	test("Verify that the support tests resolve as expected per browser", function() {
  70
+		var i,
  71
+		expected = {
  72
+			"leadingWhitespace":true,
  73
+			"tbody":true,
  74
+			"htmlSerialize":true,
  75
+			"style":true,
  76
+			"hrefNormalized":true,
  77
+			"opacity":true,
  78
+			"cssFloat":true,
  79
+			"checkOn":true,
  80
+			"optSelected":true,
  81
+			"getSetAttribute":true,
  82
+			"enctype":true,
  83
+			"html5Clone":true,
  84
+			"submitBubbles":true,
  85
+			"changeBubbles":true,
  86
+			"focusinBubbles":false,
  87
+			"deleteExpando":true,
  88
+			"noCloneEvent":true,
  89
+			"inlineBlockNeedsLayout":false,
  90
+			"shrinkWrapBlocks":false,
  91
+			"reliableMarginRight":true,
  92
+			"noCloneChecked":true,
  93
+			"optDisabled":true,
  94
+			"radioValue":true,
  95
+			"checkClone":true,
  96
+			"appendChecked":true,
  97
+			"boxModel":true,
  98
+			"reliableHiddenOffsets":true,
  99
+			"ajax":true,
  100
+			"cors":true,
  101
+			"doesNotAddBorder":true,
  102
+			"doesAddBorderForTableAndCells":false,
  103
+			"fixedPosition":true,
  104
+			"subtractsBorderForOverflowNotVisible":false,
  105
+			"doesNotIncludeMarginInBodyOffset":true
  106
+		};
  107
+		for ( i in expected ) {
  108
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  109
+		}
  110
+	});
  111
+} else if ( /msie 8\.0/i.test(userAgent) ) {
  112
+	test("Verify that the support tests resolve as expected per browser", function() {
  113
+		var i,
  114
+		expected = {
  115
+			"leadingWhitespace":false,
  116
+			"tbody":true,
  117
+			"htmlSerialize":false,
  118
+			"style":false,
  119
+			"hrefNormalized":true,
  120
+			"opacity":false,
  121
+			"cssFloat":false,
  122
+			"checkOn":true,
  123
+			"optSelected":false,
  124
+			"getSetAttribute":true,
  125
+			"enctype":true,
  126
+			"html5Clone":false,
  127
+			"submitBubbles":false,
  128
+			"changeBubbles":false,
  129
+			"focusinBubbles":true,
  130
+			"deleteExpando":false,
  131
+			"noCloneEvent":false,
  132
+			"inlineBlockNeedsLayout":false,
  133
+			"shrinkWrapBlocks":false,
  134
+			"reliableMarginRight":true,
  135
+			"noCloneChecked":false,
  136
+			"optDisabled":true,
  137
+			"radioValue":false,
  138
+			"checkClone":true,
  139
+			"appendChecked":true,
  140
+			"boxModel":true,
  141
+			"reliableHiddenOffsets":false,
  142
+			"ajax":true,
  143
+			"cors":false,
  144
+			"doesNotAddBorder":false,
  145
+			"doesAddBorderForTableAndCells":true,
  146
+			"fixedPosition":true,
  147
+			"subtractsBorderForOverflowNotVisible":false,
  148
+			"doesNotIncludeMarginInBodyOffset":true
  149
+		};
  150
+		for ( i in expected ) {
  151
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  152
+		}
  153
+	});
  154
+} else if ( /msie 7\.0/i.test(userAgent) ) {
  155
+	test("Verify that the support tests resolve as expected per browser", function() {
  156
+		var i,
  157
+		expected = {
  158
+			"ajax": true,
  159
+			"appendChecked": false,
  160
+			"boxModel": true,
  161
+			"changeBubbles": false,
  162
+			"checkClone": false,
  163
+			"checkOn": true,
  164
+			"cors": false,
  165
+			"cssFloat": false,
  166
+			"deleteExpando": false,
  167
+			"doesAddBorderForTableAndCells": true,
  168
+			"doesNotAddBorder": true,
  169
+			"doesNotIncludeMarginInBodyOffset": true,
  170
+			"enctype": true,
  171
+			"fixedPosition": true,
  172
+			"focusinBubbles": true,
  173
+			"getSetAttribute": false,
  174
+			"hrefNormalized": false,
  175
+			"html5Clone": false,
  176
+			"htmlSerialize": false,
  177
+			"inlineBlockNeedsLayout": true,
  178
+			"leadingWhitespace": false,
  179
+			"noCloneChecked": false,
  180
+			"noCloneEvent": false,
  181
+			"opacity": false,
  182
+			"optDisabled": true,
  183
+			"optSelected": false,
  184
+			"radioValue": false,
  185
+			"reliableHiddenOffsets": false,
  186
+			"reliableMarginRight": true,
  187
+			"shrinkWrapBlocks": false,
  188
+			"submitBubbles": false,
  189
+			"subtractsBorderForOverflowNotVisible": false,
  190
+			"tbody": false,
  191
+			"style": false
  192
+		};
  193
+		for ( i in expected ) {
  194
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  195
+		}
  196
+	});
  197
+} else if ( /msie 6\.0/i.test(userAgent) ) {
  198
+	test("Verify that the support tests resolve as expected per browser", function() {
  199
+		var i,
  200
+		expected = {
  201
+			"leadingWhitespace":false,
  202
+			"tbody":false,
  203
+			"htmlSerialize":false,
  204
+			"style":false,
  205
+			"hrefNormalized":false,
  206
+			"opacity":false,
  207
+			"cssFloat":false,
  208
+			"checkOn":true,
  209
+			"optSelected":false,
  210
+			"getSetAttribute":false,
  211
+			"enctype":true,
  212
+			"html5Clone":false,
  213
+			"submitBubbles":false,
  214
+			"changeBubbles":false,
  215
+			"focusinBubbles":true,
  216
+			"deleteExpando":false,
  217
+			"noCloneEvent":false,
  218
+			"inlineBlockNeedsLayout":true,
  219
+			"shrinkWrapBlocks":true,
  220
+			"reliableMarginRight":true,
  221
+			"noCloneChecked":false,
  222
+			"optDisabled":true,
  223
+			"radioValue":false,
  224
+			"checkClone":false,
  225
+			"appendChecked":false,
  226
+			"boxModel":true,
  227
+			"reliableHiddenOffsets":false,
  228
+			"ajax":true,
  229
+			"cors":false,
  230
+			"doesNotAddBorder":true,
  231
+			"doesAddBorderForTableAndCells":true,
  232
+			"fixedPosition":false,
  233
+			"subtractsBorderForOverflowNotVisible":false,
  234
+			"doesNotIncludeMarginInBodyOffset":true
  235
+		};
  236
+		for ( i in expected ) {
  237
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  238
+		}
  239
+	});
  240
+} else if ( /5\.1\.1 safari/i.test(userAgent) ) {
  241
+	test("Verify that the support tests resolve as expected per browser", function() {
  242
+		var i,
  243
+		expected = {
  244
+			"leadingWhitespace":true,
  245
+			"tbody":true,
  246
+			"htmlSerialize":true,
  247
+			"style":true,
  248
+			"hrefNormalized":true,
  249
+			"opacity":true,
  250
+			"cssFloat":true,
  251
+			"checkOn":false,
  252
+			"optSelected":true,
  253
+			"getSetAttribute":true,
  254
+			"enctype":true,
  255
+			"html5Clone":true,
  256
+			"submitBubbles":true,
  257
+			"changeBubbles":true,
  258
+			"focusinBubbles":false,
  259
+			"deleteExpando":true,
  260
+			"noCloneEvent":true,
  261
+			"inlineBlockNeedsLayout":false,
  262
+			"shrinkWrapBlocks":false,
  263
+			"reliableMarginRight":true,
  264
+			"noCloneChecked":true,
  265
+			"optDisabled":true,
  266
+			"radioValue":true,
  267
+			"checkClone":true,
  268
+			"appendChecked":true,
  269
+			"boxModel":true,
  270
+			"reliableHiddenOffsets":true,
  271
+			"ajax":true,
  272
+			"cors":true,
  273
+			"doesNotAddBorder":true,
  274
+			"doesAddBorderForTableAndCells":false,
  275
+			"fixedPosition":true,
  276
+			"subtractsBorderForOverflowNotVisible":false,
  277
+			"doesNotIncludeMarginInBodyOffset":true
  278
+		};
  279
+		for ( i in expected ) {
  280
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  281
+		}
  282
+	});
  283
+} else if ( /firefox\/3\.6/i.test(userAgent) ) {
  284
+	test("Verify that the support tests resolve as expected per browser", function() {
  285
+		var i,
  286
+		expected = {
  287
+			"leadingWhitespace":true,
  288
+			"tbody":true,
  289
+			"htmlSerialize":true,
  290
+			"style":true,
  291
+			"hrefNormalized":true,
  292
+			"opacity":true,
  293
+			"cssFloat":true,
  294
+			"checkOn":true,
  295
+			"optSelected":true,
  296
+			"getSetAttribute":true,
  297
+			"enctype":false,
  298
+			"html5Clone":true,
  299
+			"submitBubbles":true,
  300
+			"changeBubbles":true,
  301
+			"focusinBubbles":false,
  302
+			"deleteExpando":true,
  303
+			"noCloneEvent":true,
  304
+			"inlineBlockNeedsLayout":false,
  305
+			"shrinkWrapBlocks":false,
  306
+			"reliableMarginRight":true,
  307
+			"noCloneChecked":true,
  308
+			"optDisabled":true,
  309
+			"radioValue":true,
  310
+			"checkClone":true,
  311
+			"appendChecked":true,
  312
+			"boxModel":true,
  313
+			"reliableHiddenOffsets":true,
  314
+			"ajax":true,
  315
+			"cors":true,
  316
+			"doesNotAddBorder":true,
  317
+			"doesAddBorderForTableAndCells":true,
  318
+			"fixedPosition":true,
  319
+			"subtractsBorderForOverflowNotVisible":false,
  320
+			"doesNotIncludeMarginInBodyOffset":true
  321
+		};
  322
+		for ( i in expected ) {
  323
+			equal( jQuery.support[i], expected[i], "jQuery.support['" + i + "']: " + jQuery.support[i] + ", expected['" + i + "']: " + expected[i]);
  324
+		}
  325
+	});
  326
+}

18 notes on commit 3d6237e

Mike Sherov

excuse my ignorance, but doesn't FF3.6 need document.defaultView so IFRAME's will be happy? #524 (comment)

Timmy Willison

It is needed in css.js, not in the support test.

Rick Waldron

What if jQuery is loaded in an iframe that has display:none in Firefox 3.6? (I'm curious, I haven't tested this)

Mike Sherov

funny you should ask, @rwldrn, I have a PR for this sitting in the queue: #555

Rick Waldron
Collaborator

These tests are great.

Rick Waldron
Collaborator

One thing... really inconsistent with space around foo("here") vs foo( "here" )...

John-David Dalton

Ok, so this is kinda an interesting issue. Would :heart: a blog post on it.

Mike Sherov

body leaks to global now, right? I found this with JSHint, btw. ;-)

Mike Sherov

body is not defined before this.

Timmy Willison
Collaborator

True, that is inconsistent. I should fix that.

But...since we're discussing it, I prefer foo("here") to foo( "here" ). Double quotes provide a visible space by themselves don't you think?

Timmy Willison

@rwldrn: Just tested and looks like it has the correct result.

Rick Waldron
Collaborator

@timmywil As it turns out, I do agree. My nit wasn't that it should be padded, but just that you're all over the damn place ;)

I think I'm going to open a ticket to officially change the style guide to reflect this, what do you think? I'll deal with the grunt work myself.

Richard D. Worth

@rwldrn your proposed change seems like a real source for even worse inconsistency. Imagine
foo("here", 4 )
or
foo( 4, "here")
Yuck.

Rick Waldron
Collaborator

@rdworth tough one, part of me thinks that's not too bad and pretty damn readable.

Richard D. Worth

My cry is not "it's not readable because of lack of horizontal space" it's "that's an ugly inconsistency that adds complexity to something that should be as simple as possible (and already isn't)". My 2c

Rick Waldron
Collaborator

@rdworth hahaha, ok! stop yelling at me.. geez... ;)

Rick Waldron
Collaborator

@timmywil Can you update the whitespace in accordance with style guide - thanks dude :)

Timmy Willison
Collaborator

haha, and it's over that quick? @rdworth: we already have an answer to that. If either one or both of the parenthesis do not have quotes next to them, insert an extra space next to the quote. So what I propose would still be:

foo( "here", 4 );
foo( 4, "here" );
foo("here");
Richard D. Worth

Oh, if it's single arg only, I won't lose sleep. Sorry for the noise.

Rick Waldron
Collaborator

Yes, that is nice. Thanks for the follow through haha.

Eddie Monge

How is foo(4) handled? is it like that or foo( 4 )? If its the second, then seems like it should always be spaced wrapped in parens

Timmy Willison
Collaborator

Everything else is the same, so foo( 4 ). Quotes on both sides of the parens is the only exception.

Mike Sherov
Collaborator
Richard D. Worth

Quotes on both sides of the parens is the only exception.

Other than curly braces and square brackets which are the current exceptions it is proposed quotes be added to ;)

Eddie Monge

So many inconsistencies. I say its spaces next to the parens always, and maybe braces and brackets should be added to that.

Rick Waldron
Collaborator

Other style guide changes are not up for discussion. Thanks to everyone, please consider the thread closed

Please sign in to comment.
Something went wrong with that request. Please try again.