1 module("support", { teardown: moduleTeardown });
3 var computedSupport = getComputedSupport( jQuery.support );
5 function getComputedSupport( support ) {
9 for ( prop in support ) {
10 if ( typeof support[ prop ] === "function" ) {
11 result[ prop ] = support[ prop ]();
13 result[ prop ] = support[ prop ];
21 testIframeWithCallback( "body background is not lost if set prior to loading jQuery (#9239)", "support/bodyBackground.html", function( color, support ) {
27 ok( okValue[ color ], "color was not reset (" + color + ")" );
29 deepEqual( jQuery.extend( {}, support ), computedSupport, "Same support properties" );
33 // This test checks CSP only for browsers with "Content-Security-Policy" header support
34 // i.e. no old WebKit or old Firefox
35 testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
39 deepEqual( jQuery.extend( {}, support ), computedSupport, "No violations of CSP polices" );
43 supportjQuery.get( "data/support/csp.log" ).done(function( data ) {
44 equal( data, "", "No log request should be sent" );
45 supportjQuery.get( "data/support/csp-clean.php" ).done( start );
52 userAgent = window.navigator.userAgent;
54 if ( /chrome/i.test( userAgent ) ) {
55 // Catches Chrome on Android as well (i.e. the default
56 // Android browser on Android >= 4.4).
59 "boxSizingReliable": true,
62 "clearCloneStyle": true,
64 "createHTMLDocument": true,
65 "focusinBubbles": false,
66 "noCloneChecked": true,
69 "pixelMarginRight": true,
70 "pixelPosition": true,
72 "reliableMarginRight": true
74 } else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
77 "boxSizingReliable": false,
80 "clearCloneStyle": false,
82 "createHTMLDocument": true,
83 "focusinBubbles": true,
84 "noCloneChecked": false,
87 "pixelMarginRight": true,
88 "pixelPosition": true,
90 "reliableMarginRight": true
92 } else if ( /msie 9\.0/i.test( userAgent ) ) {
95 "boxSizingReliable": false,
98 "clearCloneStyle": false,
100 "createHTMLDocument": true,
101 "focusinBubbles": true,
102 "noCloneChecked": false,
104 "optSelected": false,
105 "pixelMarginRight": true,
106 "pixelPosition": true,
108 "reliableMarginRight": true
110 } else if ( /8.0(\.\d+|) safari/i.test( userAgent ) ) {
113 "boxSizingReliable": true,
116 "clearCloneStyle": true,
118 "createHTMLDocument": false,
119 "focusinBubbles": false,
120 "noCloneChecked": true,
123 "pixelMarginRight": true,
124 "pixelPosition": false,
126 "reliableMarginRight": true
128 } else if ( /(6|7)\.0(\.\d+|) safari/i.test( userAgent ) ) {
131 "boxSizingReliable": true,
134 "clearCloneStyle": true,
136 "createHTMLDocument": true,
137 "focusinBubbles": false,
138 "noCloneChecked": true,
141 "pixelMarginRight": true,
142 "pixelPosition": false,
144 "reliableMarginRight": true
146 } else if ( /firefox/i.test( userAgent ) ) {
149 "boxSizingReliable": true,
152 "clearCloneStyle": true,
154 "createHTMLDocument": true,
155 "focusinBubbles": false,
156 "noCloneChecked": true,
159 "pixelMarginRight": true,
160 "pixelPosition": true,
162 "reliableMarginRight": true
164 } else if ( /iphone os 8/i.test( userAgent ) ) {
167 "boxSizingReliable": true,
170 "clearCloneStyle": true,
172 "createHTMLDocument": false,
173 "focusinBubbles": false,
174 "noCloneChecked": true,
177 "pixelMarginRight": true,
178 "pixelPosition": false,
180 "reliableMarginRight": true
182 } else if ( /iphone os (6|7)/i.test( userAgent ) ) {
185 "boxSizingReliable": true,
188 "clearCloneStyle": true,
190 "createHTMLDocument": true,
191 "focusinBubbles": false,
192 "noCloneChecked": true,
195 "pixelMarginRight": true,
196 "pixelPosition": false,
198 "reliableMarginRight": true
200 } else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
203 "boxSizingReliable": true,
206 "clearCloneStyle": true,
208 "createHTMLDocument": true,
209 "focusinBubbles": false,
210 "noCloneChecked": true,
213 "pixelMarginRight": false,
214 "pixelPosition": false,
216 "reliableMarginRight": true
218 } else if ( /android 2\.3/i.test( userAgent ) ) {
221 "boxSizingReliable": true,
224 "clearCloneStyle": false,
226 "createHTMLDocument": true,
227 "focusinBubbles": false,
228 "noCloneChecked": true,
229 "optDisabled": false,
231 "pixelMarginRight": true,
232 "pixelPosition": false,
234 "reliableMarginRight": false
239 test( "Verify that the support tests resolve as expected per browser", function() {
243 for ( prop in computedSupport ) {
249 for ( i in expected ) {
250 // TODO check for all modules containing support properties
251 if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) {
252 equal( computedSupport[ i ], expected[ i ],
253 "jQuery.support['" + i + "']: " + computedSupport[ i ] +
254 ", expected['" + i + "']: " + expected[ i ]);
256 ok( true, "no ajax; skipping jQuery.support[' " + i + " ']" );