@@ -131,49 +131,52 @@ $.fn.extend({
131
131
}
132
132
} ) ;
133
133
134
- $ . each ( [ "Width" , "Height" ] , function ( i , name ) {
135
- var side = name === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] ,
136
- type = name . toLowerCase ( ) ,
137
- orig = {
138
- innerWidth : $ . fn . innerWidth ,
139
- innerHeight : $ . fn . innerHeight ,
140
- outerWidth : $ . fn . outerWidth ,
141
- outerHeight : $ . fn . outerHeight
142
- } ;
143
-
144
- function reduce ( elem , size , border , margin ) {
145
- $ . each ( side , function ( ) {
146
- size -= parseFloat ( $ . curCSS ( elem , "padding" + this , true ) ) || 0 ;
147
- if ( border ) {
148
- size -= parseFloat ( $ . curCSS ( elem , "border" + this + "Width" , true ) ) || 0 ;
149
- }
150
- if ( margin ) {
151
- size -= parseFloat ( $ . curCSS ( elem , "margin" + this , true ) ) || 0 ;
152
- }
153
- } ) ;
154
- return size ;
155
- }
134
+ // support: jQuery <1.8
135
+ if ( ! $ ( "<a>" ) . outerWidth ( 1 ) . jquery ) {
136
+ $ . each ( [ "Width" , "Height" ] , function ( i , name ) {
137
+ var side = name === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] ,
138
+ type = name . toLowerCase ( ) ,
139
+ orig = {
140
+ innerWidth : $ . fn . innerWidth ,
141
+ innerHeight : $ . fn . innerHeight ,
142
+ outerWidth : $ . fn . outerWidth ,
143
+ outerHeight : $ . fn . outerHeight
144
+ } ;
156
145
157
- $ . fn [ "inner" + name ] = function ( size ) {
158
- if ( size === undefined ) {
159
- return orig [ "inner" + name ] . call ( this ) ;
146
+ function reduce ( elem , size , border , margin ) {
147
+ $ . each ( side , function ( ) {
148
+ size -= parseFloat ( $ . curCSS ( elem , "padding" + this , true ) ) || 0 ;
149
+ if ( border ) {
150
+ size -= parseFloat ( $ . curCSS ( elem , "border" + this + "Width" , true ) ) || 0 ;
151
+ }
152
+ if ( margin ) {
153
+ size -= parseFloat ( $ . curCSS ( elem , "margin" + this , true ) ) || 0 ;
154
+ }
155
+ } ) ;
156
+ return size ;
160
157
}
161
158
162
- return this . each ( function ( ) {
163
- $ ( this ) . css ( type , reduce ( this , size ) + "px" ) ;
164
- } ) ;
165
- } ;
159
+ $ . fn [ "inner" + name ] = function ( size ) {
160
+ if ( size === undefined ) {
161
+ return orig [ "inner" + name ] . call ( this ) ;
162
+ }
163
+
164
+ return this . each ( function ( ) {
165
+ $ ( this ) . css ( type , reduce ( this , size ) + "px" ) ;
166
+ } ) ;
167
+ } ;
166
168
167
- $ . fn [ "outer" + name ] = function ( size , margin ) {
168
- if ( typeof size !== "number" ) {
169
- return orig [ "outer" + name ] . call ( this , size ) ;
170
- }
169
+ $ . fn [ "outer" + name ] = function ( size , margin ) {
170
+ if ( typeof size !== "number" ) {
171
+ return orig [ "outer" + name ] . call ( this , size ) ;
172
+ }
171
173
172
- return this . each ( function ( ) {
173
- $ ( this ) . css ( type , reduce ( this , size , true , margin ) + "px" ) ;
174
- } ) ;
175
- } ;
176
- } ) ;
174
+ return this . each ( function ( ) {
175
+ $ ( this ) . css ( type , reduce ( this , size , true , margin ) + "px" ) ;
176
+ } ) ;
177
+ } ;
178
+ } ) ;
179
+ }
177
180
178
181
// selectors
179
182
function focusable ( element , isTabIndexNotNaN ) {
0 commit comments