scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 58 Rev 125
1 define( [ 1 define([
2 "./core", 2 "./core",
3 "./var/pnum", 3 "./var/pnum",
4 "./core/access", 4 "./core/access",
5 "./css/var/rmargin", 5 "./css/var/rmargin",
6 "./var/document", -  
7 "./var/rcssNum", -  
8 "./css/var/rnumnonpx", 6 "./css/var/rnumnonpx",
9 "./css/var/cssExpand", 7 "./css/var/cssExpand",
-   8 "./css/var/isHidden",
10 "./css/var/getStyles", 9 "./css/var/getStyles",
11 "./css/var/swap", -  
12 "./css/curCSS", 10 "./css/curCSS",
13 "./css/adjustCSS", 11 "./css/defaultDisplay",
14 "./css/addGetHookIf", 12 "./css/addGetHookIf",
15 "./css/support", 13 "./css/support",
-   14 "./data/var/data_priv",
16   15  
-   16 "./core/init",
17 "./core/init", 17 "./css/swap",
18 "./core/ready", 18 "./core/ready",
19 "./selector" // contains 19 "./selector" // contains
20 ], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand, 20 ], function( jQuery, pnum, access, rmargin, rnumnonpx, cssExpand, isHidden,
21 getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) { -  
22   -  
23 "use strict"; 21 getStyles, curCSS, defaultDisplay, addGetHookIf, support, data_priv ) {
24   -  
25 var 22  
26   -  
27 // Swappable if display is none or starts with table 23 var
28 // except "table", "table-cell", or "table-caption" 24 // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
-   25 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
-   26 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
-   27 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
29 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 28 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
30 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 29  
31 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 30 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
32 cssNormalTransform = { 31 cssNormalTransform = {
33 letterSpacing: "0", 32 letterSpacing: "0",
34 fontWeight: "400" 33 fontWeight: "400"
35 }, 34 },
36   35  
37 cssPrefixes = [ "Webkit", "Moz", "ms" ], -  
38 emptyStyle = document.createElement( "div" ).style; 36 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
39   37  
40 // Return a css property mapped to a potentially vendor prefixed property 38 // Return a css property mapped to a potentially vendor prefixed property
41 function vendorPropName( name ) { 39 function vendorPropName( style, name ) {
42   40  
43 // Shortcut for names that are not vendor prefixed 41 // Shortcut for names that are not vendor prefixed
44 if ( name in emptyStyle ) { 42 if ( name in style ) {
45 return name; 43 return name;
46 } 44 }
47   45  
48 // Check for vendor prefixed names 46 // Check for vendor prefixed names
49 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 47 var capName = name[0].toUpperCase() + name.slice(1),
-   48 origName = name,
50 i = cssPrefixes.length; 49 i = cssPrefixes.length;
51   50  
52 while ( i-- ) { 51 while ( i-- ) {
53 name = cssPrefixes[ i ] + capName; 52 name = cssPrefixes[ i ] + capName;
54 if ( name in emptyStyle ) { 53 if ( name in style ) {
55 return name; 54 return name;
56 } 55 }
57 } 56 }
-   57  
-   58 return origName;
58 } 59 }
59   60  
60 function setPositiveNumber( elem, value, subtract ) { 61 function setPositiveNumber( elem, value, subtract ) {
61   -  
62 // Any relative (+/-) values have already been -  
63 // normalized at this point -  
64 var matches = rcssNum.exec( value ); 62 var matches = rnumsplit.exec( value );
65 return matches ? 63 return matches ?
66   -  
67 // Guard against undefined "subtract", e.g., when used as in cssHooks 64 // Guard against undefined "subtract", e.g., when used as in cssHooks
68 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 65 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
69 value; 66 value;
70 } 67 }
71   68  
72 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 69 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
-   70 var i = extra === ( isBorderBox ? "border" : "content" ) ?
-   71 // If we already have the right measurement, avoid augmentation
73 var i, 72 4 :
-   73 // Otherwise initialize for horizontal or vertical properties
74 val = 0; 74 name === "width" ? 1 : 0,
75   -  
76 // If we already have the right measurement, avoid augmentation -  
77 if ( extra === ( isBorderBox ? "border" : "content" ) ) { 75  
78 i = 4; -  
79   -  
80 // Otherwise initialize for horizontal or vertical properties -  
81 } else { -  
82 i = name === "width" ? 1 : 0; -  
83 } 76 val = 0;
84   -  
85 for ( ; i < 4; i += 2 ) { 77  
86   78 for ( ; i < 4; i += 2 ) {
87 // Both box models exclude margin, so add it if we want it 79 // Both box models exclude margin, so add it if we want it
88 if ( extra === "margin" ) { 80 if ( extra === "margin" ) {
89 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 81 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
90 } 82 }
91   83  
92 if ( isBorderBox ) { 84 if ( isBorderBox ) {
93   -  
94 // border-box includes padding, so remove it if we want content 85 // border-box includes padding, so remove it if we want content
95 if ( extra === "content" ) { 86 if ( extra === "content" ) {
96 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 87 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
97 } 88 }
98   89  
99 // At this point, extra isn't border nor margin, so remove border 90 // At this point, extra isn't border nor margin, so remove border
100 if ( extra !== "margin" ) { 91 if ( extra !== "margin" ) {
101 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 92 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
102 } 93 }
103 } else { 94 } else {
104   -  
105 // At this point, extra isn't content, so add padding 95 // At this point, extra isn't content, so add padding
106 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 96 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
107   97  
108 // At this point, extra isn't content nor padding, so add border 98 // At this point, extra isn't content nor padding, so add border
109 if ( extra !== "padding" ) { 99 if ( extra !== "padding" ) {
110 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 100 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
111 } 101 }
112 } 102 }
113 } 103 }
114   104  
115 return val; 105 return val;
116 } 106 }
117   107  
118 function getWidthOrHeight( elem, name, extra ) { 108 function getWidthOrHeight( elem, name, extra ) {
119   109  
120 // Start with offset property, which is equivalent to the border-box value 110 // Start with offset property, which is equivalent to the border-box value
121 var val, -  
122 valueIsBorderBox = true, 111 var valueIsBorderBox = true,
-   112 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
123 styles = getStyles( elem ), 113 styles = getStyles( elem ),
124 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 114 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
125   -  
126 // Support: IE <=11 only -  
127 // Running getBoundingClientRect on a disconnected node -  
128 // in IE throws an error. -  
129 if ( elem.getClientRects().length ) { -  
130 val = elem.getBoundingClientRect()[ name ]; -  
131 } -  
132   115  
133 // Some non-html elements return undefined for offsetWidth, so check for null/undefined 116 // Some non-html elements return undefined for offsetWidth, so check for null/undefined
134 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 117 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
135 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 118 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
136 if ( val <= 0 || val == null ) { 119 if ( val <= 0 || val == null ) {
137   -  
138 // Fall back to computed then uncomputed css if necessary 120 // Fall back to computed then uncomputed css if necessary
139 val = curCSS( elem, name, styles ); 121 val = curCSS( elem, name, styles );
140 if ( val < 0 || val == null ) { 122 if ( val < 0 || val == null ) {
141 val = elem.style[ name ]; 123 val = elem.style[ name ];
142 } 124 }
143   125  
144 // Computed unit is not pixels. Stop here and return. 126 // Computed unit is not pixels. Stop here and return.
145 if ( rnumnonpx.test( val ) ) { 127 if ( rnumnonpx.test(val) ) {
146 return val; 128 return val;
147 } 129 }
148   130  
149 // Check for style in case a browser which returns unreliable values 131 // Check for style in case a browser which returns unreliable values
150 // for getComputedStyle silently falls back to the reliable elem.style 132 // for getComputedStyle silently falls back to the reliable elem.style
151 valueIsBorderBox = isBorderBox && 133 valueIsBorderBox = isBorderBox &&
152 ( support.boxSizingReliable() || val === elem.style[ name ] ); 134 ( support.boxSizingReliable() || val === elem.style[ name ] );
153   135  
154 // Normalize "", auto, and prepare for extra 136 // Normalize "", auto, and prepare for extra
155 val = parseFloat( val ) || 0; 137 val = parseFloat( val ) || 0;
156 } 138 }
157   139  
158 // Use the active box-sizing model to add/subtract irrelevant styles 140 // Use the active box-sizing model to add/subtract irrelevant styles
159 return ( val + 141 return ( val +
160 augmentWidthOrHeight( 142 augmentWidthOrHeight(
161 elem, 143 elem,
162 name, 144 name,
163 extra || ( isBorderBox ? "border" : "content" ), 145 extra || ( isBorderBox ? "border" : "content" ),
164 valueIsBorderBox, 146 valueIsBorderBox,
165 styles 147 styles
166 ) 148 )
167 ) + "px"; 149 ) + "px";
168 } 150 }
-   151  
-   152 function showHide( elements, show ) {
-   153 var display, elem, hidden,
-   154 values = [],
-   155 index = 0,
-   156 length = elements.length;
-   157  
-   158 for ( ; index < length; index++ ) {
-   159 elem = elements[ index ];
-   160 if ( !elem.style ) {
-   161 continue;
-   162 }
-   163  
-   164 values[ index ] = data_priv.get( elem, "olddisplay" );
-   165 display = elem.style.display;
-   166 if ( show ) {
-   167 // Reset the inline display of this element to learn if it is
-   168 // being hidden by cascaded rules or not
-   169 if ( !values[ index ] && display === "none" ) {
-   170 elem.style.display = "";
-   171 }
-   172  
-   173 // Set elements which have been overridden with display: none
-   174 // in a stylesheet to whatever the default browser style is
-   175 // for such an element
-   176 if ( elem.style.display === "" && isHidden( elem ) ) {
-   177 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
-   178 }
-   179 } else {
-   180 hidden = isHidden( elem );
-   181  
-   182 if ( display !== "none" || !hidden ) {
-   183 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
-   184 }
-   185 }
-   186 }
-   187  
-   188 // Set the display of most of the elements in a second loop
-   189 // to avoid the constant reflow
-   190 for ( index = 0; index < length; index++ ) {
-   191 elem = elements[ index ];
-   192 if ( !elem.style ) {
-   193 continue;
-   194 }
-   195 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
-   196 elem.style.display = show ? values[ index ] || "" : "none";
-   197 }
-   198 }
-   199  
-   200 return elements;
-   201 }
169   202  
170 jQuery.extend( { 203 jQuery.extend({
171   204  
172 // Add in style property hooks for overriding the default 205 // Add in style property hooks for overriding the default
173 // behavior of getting and setting a style property 206 // behavior of getting and setting a style property
174 cssHooks: { 207 cssHooks: {
175 opacity: { 208 opacity: {
176 get: function( elem, computed ) { 209 get: function( elem, computed ) {
177 if ( computed ) { 210 if ( computed ) {
178   211  
179 // We should always get a number back from opacity 212 // We should always get a number back from opacity
180 var ret = curCSS( elem, "opacity" ); 213 var ret = curCSS( elem, "opacity" );
181 return ret === "" ? "1" : ret; 214 return ret === "" ? "1" : ret;
182 } 215 }
183 } 216 }
184 } 217 }
185 }, 218 },
186   219  
187 // Don't automatically add "px" to these possibly-unitless properties 220 // Don't automatically add "px" to these possibly-unitless properties
188 cssNumber: { 221 cssNumber: {
189 "animationIterationCount": true, -  
190 "columnCount": true, 222 "columnCount": true,
191 "fillOpacity": true, 223 "fillOpacity": true,
192 "flexGrow": true, 224 "flexGrow": true,
193 "flexShrink": true, 225 "flexShrink": true,
194 "fontWeight": true, 226 "fontWeight": true,
195 "lineHeight": true, 227 "lineHeight": true,
196 "opacity": true, 228 "opacity": true,
197 "order": true, 229 "order": true,
198 "orphans": true, 230 "orphans": true,
199 "widows": true, 231 "widows": true,
200 "zIndex": true, 232 "zIndex": true,
201 "zoom": true 233 "zoom": true
202 }, 234 },
203   235  
204 // Add in properties whose names you wish to fix before 236 // Add in properties whose names you wish to fix before
205 // setting or getting the value 237 // setting or getting the value
206 cssProps: { 238 cssProps: {
207 "float": "cssFloat" 239 "float": "cssFloat"
208 }, 240 },
209   241  
210 // Get and set the style property on a DOM Node 242 // Get and set the style property on a DOM Node
211 style: function( elem, name, value, extra ) { 243 style: function( elem, name, value, extra ) {
212   244  
213 // Don't set styles on text and comment nodes 245 // Don't set styles on text and comment nodes
214 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 246 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
215 return; 247 return;
216 } 248 }
217   249  
218 // Make sure that we're working with the right name 250 // Make sure that we're working with the right name
219 var ret, type, hooks, 251 var ret, type, hooks,
220 origName = jQuery.camelCase( name ), 252 origName = jQuery.camelCase( name ),
221 style = elem.style; 253 style = elem.style;
222   -  
223 name = jQuery.cssProps[ origName ] || 254  
224 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 255 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
225   256  
226 // Gets hook for the prefixed version, then unprefixed version 257 // Gets hook for the prefixed version, then unprefixed version
227 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 258 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
228   259  
229 // Check if we're setting a value 260 // Check if we're setting a value
230 if ( value !== undefined ) { 261 if ( value !== undefined ) {
231 type = typeof value; 262 type = typeof value;
232   263  
233 // Convert "+=" or "-=" to relative numbers (#7345) 264 // Convert "+=" or "-=" to relative numbers (#7345)
234 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 265 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
235 value = adjustCSS( elem, name, ret ); 266 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
236   -  
237 // Fixes bug #9237 267 // Fixes bug #9237
238 type = "number"; 268 type = "number";
239 } 269 }
240   270  
241 // Make sure that null and NaN values aren't set (#7116) 271 // Make sure that null and NaN values aren't set (#7116)
242 if ( value == null || value !== value ) { 272 if ( value == null || value !== value ) {
243 return; 273 return;
244 } 274 }
245   275  
246 // If a number was passed in, add the unit (except for certain CSS properties) 276 // If a number, add 'px' to the (except for certain CSS properties)
247 if ( type === "number" ) { 277 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
248 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 278 value += "px";
-   279 }
249 } 280  
250   281 // Support: IE9-11+
251 // background-* props affect original clone's values 282 // background-* props affect original clone's values
252 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 283 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
253 style[ name ] = "inherit"; 284 style[ name ] = "inherit";
254 } 285 }
255   286  
256 // If a hook was provided, use that value, otherwise just set the specified value 287 // If a hook was provided, use that value, otherwise just set the specified value
257 if ( !hooks || !( "set" in hooks ) || -  
258 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 288 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
259   -  
260 style[ name ] = value; 289 style[ name ] = value;
261 } 290 }
262   291  
263 } else { 292 } else {
264   -  
265 // If a hook was provided get the non-computed value from there 293 // If a hook was provided get the non-computed value from there
266 if ( hooks && "get" in hooks && -  
267 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 294 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
268   -  
269 return ret; 295 return ret;
270 } 296 }
271   297  
272 // Otherwise just get the value from the style object 298 // Otherwise just get the value from the style object
273 return style[ name ]; 299 return style[ name ];
274 } 300 }
275 }, 301 },
276   302  
277 css: function( elem, name, extra, styles ) { 303 css: function( elem, name, extra, styles ) {
278 var val, num, hooks, 304 var val, num, hooks,
279 origName = jQuery.camelCase( name ); 305 origName = jQuery.camelCase( name );
280   306  
281 // Make sure that we're working with the right name 307 // Make sure that we're working with the right name
282 name = jQuery.cssProps[ origName ] || -  
283 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 308 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
284   309  
285 // Try prefixed name followed by the unprefixed name 310 // Try prefixed name followed by the unprefixed name
286 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 311 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
287   312  
288 // If a hook was provided get the computed value from there 313 // If a hook was provided get the computed value from there
289 if ( hooks && "get" in hooks ) { 314 if ( hooks && "get" in hooks ) {
290 val = hooks.get( elem, true, extra ); 315 val = hooks.get( elem, true, extra );
291 } 316 }
292   317  
293 // Otherwise, if a way to get the computed value exists, use that 318 // Otherwise, if a way to get the computed value exists, use that
294 if ( val === undefined ) { 319 if ( val === undefined ) {
295 val = curCSS( elem, name, styles ); 320 val = curCSS( elem, name, styles );
296 } 321 }
297   322  
298 // Convert "normal" to computed value 323 // Convert "normal" to computed value
299 if ( val === "normal" && name in cssNormalTransform ) { 324 if ( val === "normal" && name in cssNormalTransform ) {
300 val = cssNormalTransform[ name ]; 325 val = cssNormalTransform[ name ];
301 } 326 }
302   327  
303 // Make numeric if forced or a qualifier was provided and val looks numeric 328 // Make numeric if forced or a qualifier was provided and val looks numeric
304 if ( extra === "" || extra ) { 329 if ( extra === "" || extra ) {
305 num = parseFloat( val ); 330 num = parseFloat( val );
306 return extra === true || isFinite( num ) ? num || 0 : val; 331 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
307 } 332 }
308 return val; 333 return val;
309 } 334 }
310 } ); 335 });
311   336  
312 jQuery.each( [ "height", "width" ], function( i, name ) { 337 jQuery.each([ "height", "width" ], function( i, name ) {
313 jQuery.cssHooks[ name ] = { 338 jQuery.cssHooks[ name ] = {
314 get: function( elem, computed, extra ) { 339 get: function( elem, computed, extra ) {
315 if ( computed ) { 340 if ( computed ) {
316   341  
317 // Certain elements can have dimension info if we invisibly show them 342 // Certain elements can have dimension info if we invisibly show them
318 // but it must have a current display style that would benefit 343 // but it must have a current display style that would benefit
319 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 344 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
320   -  
321 // Support: Safari 8+ -  
322 // Table columns in Safari have non-zero offsetWidth & zero -  
323 // getBoundingClientRect().width unless display is changed. -  
324 // Support: IE <=11 only -  
325 // Running getBoundingClientRect on a disconnected node -  
326 // in IE throws an error. -  
327 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? -  
328 swap( elem, cssShow, function() { 345 jQuery.swap( elem, cssShow, function() {
329 return getWidthOrHeight( elem, name, extra ); 346 return getWidthOrHeight( elem, name, extra );
330 } ) : 347 }) :
331 getWidthOrHeight( elem, name, extra ); 348 getWidthOrHeight( elem, name, extra );
332 } 349 }
333 }, 350 },
334   351  
335 set: function( elem, value, extra ) { 352 set: function( elem, value, extra ) {
336 var matches, -  
337 styles = extra && getStyles( elem ), 353 var styles = extra && getStyles( elem );
-   354 return setPositiveNumber( elem, value, extra ?
338 subtract = extra && augmentWidthOrHeight( 355 augmentWidthOrHeight(
339 elem, 356 elem,
340 name, 357 name,
341 extra, 358 extra,
342 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 359 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
343 styles 360 styles
344 ); 361 ) : 0
345   -  
346 // Convert to pixels if value adjustment is needed -  
347 if ( subtract && ( matches = rcssNum.exec( value ) ) && -  
348 ( matches[ 3 ] || "px" ) !== "px" ) { -  
349   -  
350 elem.style[ name ] = value; -  
351 value = jQuery.css( elem, name ); -  
352 } 362 );
353   -  
354 return setPositiveNumber( elem, value, subtract ); -  
355 } 363 }
356 }; 364 };
357 } ); 365 });
-   366  
358   367 // Support: Android 2.3
359 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 368 jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
360 function( elem, computed ) { 369 function( elem, computed ) {
361 if ( computed ) { 370 if ( computed ) {
362 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || -  
363 elem.getBoundingClientRect().left - 371 return jQuery.swap( elem, { "display": "inline-block" },
364 swap( elem, { marginLeft: 0 }, function() { -  
365 return elem.getBoundingClientRect().left; -  
366 } ) -  
367 ) + "px"; 372 curCSS, [ elem, "marginRight" ] );
368 } 373 }
369 } 374 }
370 ); 375 );
371   376  
372 // These hooks are used by animate to expand properties 377 // These hooks are used by animate to expand properties
373 jQuery.each( { 378 jQuery.each({
374 margin: "", 379 margin: "",
375 padding: "", 380 padding: "",
376 border: "Width" 381 border: "Width"
377 }, function( prefix, suffix ) { 382 }, function( prefix, suffix ) {
378 jQuery.cssHooks[ prefix + suffix ] = { 383 jQuery.cssHooks[ prefix + suffix ] = {
379 expand: function( value ) { 384 expand: function( value ) {
380 var i = 0, 385 var i = 0,
381 expanded = {}, 386 expanded = {},
382   387  
383 // Assumes a single number if not a string 388 // Assumes a single number if not a string
384 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 389 parts = typeof value === "string" ? value.split(" ") : [ value ];
385   390  
386 for ( ; i < 4; i++ ) { 391 for ( ; i < 4; i++ ) {
387 expanded[ prefix + cssExpand[ i ] + suffix ] = 392 expanded[ prefix + cssExpand[ i ] + suffix ] =
388 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 393 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
389 } 394 }
390   395  
391 return expanded; 396 return expanded;
392 } 397 }
393 }; 398 };
394   399  
395 if ( !rmargin.test( prefix ) ) { 400 if ( !rmargin.test( prefix ) ) {
396 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 401 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
397 } 402 }
398 } ); 403 });
399   404  
400 jQuery.fn.extend( { 405 jQuery.fn.extend({
401 css: function( name, value ) { 406 css: function( name, value ) {
402 return access( this, function( elem, name, value ) { 407 return access( this, function( elem, name, value ) {
403 var styles, len, 408 var styles, len,
404 map = {}, 409 map = {},
405 i = 0; 410 i = 0;
406   411  
407 if ( jQuery.isArray( name ) ) { 412 if ( jQuery.isArray( name ) ) {
408 styles = getStyles( elem ); 413 styles = getStyles( elem );
409 len = name.length; 414 len = name.length;
410   415  
411 for ( ; i < len; i++ ) { 416 for ( ; i < len; i++ ) {
412 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 417 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
413 } 418 }
414   419  
415 return map; 420 return map;
416 } 421 }
417   422  
418 return value !== undefined ? 423 return value !== undefined ?
419 jQuery.style( elem, name, value ) : 424 jQuery.style( elem, name, value ) :
420 jQuery.css( elem, name ); 425 jQuery.css( elem, name );
421 }, name, value, arguments.length > 1 ); 426 }, name, value, arguments.length > 1 );
-   427 },
-   428 show: function() {
-   429 return showHide( this, true );
-   430 },
-   431 hide: function() {
-   432 return showHide( this );
-   433 },
-   434 toggle: function( state ) {
-   435 if ( typeof state === "boolean" ) {
-   436 return state ? this.show() : this.hide();
-   437 }
-   438  
-   439 return this.each(function() {
-   440 if ( isHidden( this ) ) {
-   441 jQuery( this ).show();
-   442 } else {
-   443 jQuery( this ).hide();
-   444 }
-   445 });
422 } 446 }
423 } ); 447 });
424   448  
425 return jQuery; 449 return jQuery;
426 } ); 450 });
427   451