@@ -119,49 +119,52 @@ $.fn.extend({
119119 }
120120} ) ;
121121
122- $ . each ( [ "Width" , "Height" ] , function ( i , name ) {
123- var side = name === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] ,
124- type = name . toLowerCase ( ) ,
125- orig = {
126- innerWidth : $ . fn . innerWidth ,
127- innerHeight : $ . fn . innerHeight ,
128- outerWidth : $ . fn . outerWidth ,
129- outerHeight : $ . fn . outerHeight
130- } ;
122+ // support: jQuery <1.8
123+ if ( ! $ ( "<a>" ) . outerWidth ( 1 ) . jquery ) {
124+ $ . each ( [ "Width" , "Height" ] , function ( i , name ) {
125+ var side = name === "Width" ? [ "Left" , "Right" ] : [ "Top" , "Bottom" ] ,
126+ type = name . toLowerCase ( ) ,
127+ orig = {
128+ innerWidth : $ . fn . innerWidth ,
129+ innerHeight : $ . fn . innerHeight ,
130+ outerWidth : $ . fn . outerWidth ,
131+ outerHeight : $ . fn . outerHeight
132+ } ;
133+
134+ function reduce ( elem , size , border , margin ) {
135+ $ . each ( side , function ( ) {
136+ size -= parseFloat ( $ . css ( elem , "padding" + this ) ) || 0 ;
137+ if ( border ) {
138+ size -= parseFloat ( $ . css ( elem , "border" + this + "Width" ) ) || 0 ;
139+ }
140+ if ( margin ) {
141+ size -= parseFloat ( $ . css ( elem , "margin" + this ) ) || 0 ;
142+ }
143+ } ) ;
144+ return size ;
145+ }
131146
132- function reduce ( elem , size , border , margin ) {
133- $ . each ( side , function ( ) {
134- size -= parseFloat ( $ . css ( elem , "padding" + this ) ) || 0 ;
135- if ( border ) {
136- size -= parseFloat ( $ . css ( elem , "border" + this + "Width" ) ) || 0 ;
147+ $ . fn [ "inner" + name ] = function ( size ) {
148+ if ( size === undefined ) {
149+ return orig [ "inner" + name ] . call ( this ) ;
137150 }
138- if ( margin ) {
139- size -= parseFloat ( $ . css ( elem , "margin" + this ) ) || 0 ;
140- }
141- } ) ;
142- return size ;
143- }
144-
145- $ . fn [ "inner" + name ] = function ( size ) {
146- if ( size === undefined ) {
147- return orig [ "inner" + name ] . call ( this ) ;
148- }
149151
150- return this . each ( function ( ) {
151- $ ( this ) . css ( type , reduce ( this , size ) + "px" ) ;
152- } ) ;
153- } ;
152+ return this . each ( function ( ) {
153+ $ ( this ) . css ( type , reduce ( this , size ) + "px" ) ;
154+ } ) ;
155+ } ;
154156
155- $ . fn [ "outer" + name ] = function ( size , margin ) {
156- if ( typeof size !== "number" ) {
157- return orig [ "outer" + name ] . call ( this , size ) ;
158- }
157+ $ . fn [ "outer" + name ] = function ( size , margin ) {
158+ if ( typeof size !== "number" ) {
159+ return orig [ "outer" + name ] . call ( this , size ) ;
160+ }
159161
160- return this . each ( function ( ) {
161- $ ( this ) . css ( type , reduce ( this , size , true , margin ) + "px" ) ;
162- } ) ;
163- } ;
164- } ) ;
162+ return this . each ( function ( ) {
163+ $ ( this ) . css ( type , reduce ( this , size , true , margin ) + "px" ) ;
164+ } ) ;
165+ } ;
166+ } ) ;
167+ }
165168
166169// selectors
167170function focusable ( element , isTabIndexNotNaN ) {
0 commit comments