Skip to content

Commit

Permalink
Core: Moved old jQuery support code to the bottom (above deprecated).
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Nov 5, 2012
1 parent 02694a9 commit 8a32c39
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions ui/jquery.ui.core.js
Expand Up @@ -128,53 +128,6 @@ $.fn.extend({
}
});

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};

function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}

$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}

return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};

$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}

return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}

// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
Expand Down Expand Up @@ -230,6 +183,53 @@ $.extend( $.expr[ ":" ], {
// support
$.support.selectstart = "onselectstart" in document.createElement( "div" );

// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};

function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}

$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}

return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};

$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}

return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}




Expand Down

0 comments on commit 8a32c39

Please sign in to comment.