aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.core.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-07-21 22:17:52 -0400
committerScott González <scott.gonzalez@gmail.com>2010-07-21 22:17:52 -0400
commit4deb824699b025d74d6849a73ec47c182df93fa0 (patch)
tree42e2cacdc7b031e8f56c23617eb31538fb715156 /ui/jquery.ui.core.js
parent3f070bdc62a8d00ca6d8428b1a1fe9e39ff72c65 (diff)
downloadjquery-ui-4deb824699b025d74d6849a73ec47c182df93fa0.tar.gz
jquery-ui-4deb824699b025d74d6849a73ec47c182df93fa0.zip
Core: Added .outerWidth(), .outerHeight(), .innerWidth(), .innerHeight(). Fixes #5850 - .outerWidth(), .outerHeight(), .innerWidth(), .innerHeight() setters.
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[':'], {