diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-11-05 15:24:45 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-11-05 15:24:45 -0500 |
commit | 8a32c39136996db17c0ca2ece636d3814466934d (patch) | |
tree | 84d430017a7f9139593f3108ef06427473df04a0 /ui | |
parent | 02694a90f329e84ef7532d8b51e6c209207dc649 (diff) | |
download | jquery-ui-8a32c39136996db17c0ca2ece636d3814466934d.tar.gz jquery-ui-8a32c39136996db17c0ca2ece636d3814466934d.zip |
Core: Moved old jQuery support code to the bottom (above deprecated).
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.core.js | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 26a956b1a..5d8a9935c 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -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, @@ -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" ); + }); + }; + }); +} + |