aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.core.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.core.js')
-rw-r--r--ui/jquery.ui.core.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js
index bffa51d77..0804edab7 100644
--- a/ui/jquery.ui.core.js
+++ b/ui/jquery.ui.core.js
@@ -186,6 +186,49 @@ $.fn.extend({
}
});
+$.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( $.curCSS( elem, "padding" + this, true)) || 0;
+ if ( border ) {
+ size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true)) || 0;
+ }
+ if ( margin ) {
+ size -= parseFloat( $.curCSS( elem, "margin" + this, true)) || 0;
+ }
+ });
+ return size;
+ }
+
+ $.fn[ "inner" + name ] = function( size ) {
+ if ( size === undefined ) {
+ return orig[ "inner" + name ].call( this );
+ }
+
+ return this.each(function() {
+ $.style( this, 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() {
+ $.style( this, type, reduce( this, size, true, margin ) + "px" );
+ });
+ };
+});
//Additional selectors
$.extend($.expr[':'], {