Skip to content
Permalink
Browse files

Cleaning up some un-needed CSS code and adding back a temporary (depr…

…ecated) curCSS method.
  • Loading branch information
jeresig committed Sep 17, 2010
1 parent 51d2580 commit 6541eb9d80db42c6ced396fcd198228bff9ec7f1
Showing with 10 additions and 9 deletions.
  1. +8 −7 src/css.js
  2. +2 −2 src/dimensions.js
@@ -21,7 +21,9 @@ var ralpha = /alpha\([^)]*\)/,

jQuery.fn.css = function( name, value ) {
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return jQuery.css( elem, name, value );
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};

@@ -90,19 +92,15 @@ jQuery.extend({
}
},

css: function( elem, name, value, extra ) {
css: function( elem, name, extra ) {
// Make sure that we're working with the right name
var ret, origName = name.replace( rdashAlpha, fcamelCase ),
hooks = jQuery.cssHooks[ origName ];

name = jQuery.cssProps[ origName ] || origName;

// Check if we're setting a value, just use jQuery.style (DEPRECATED)
if ( value !== undefined ) {
jQuery.style( elem, name, value );

// If a hook was provided get the computed value from there
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;

// Otherwise, if a way to get the computed value exists, use that
@@ -130,6 +128,9 @@ jQuery.extend({
}
});

// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;

jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
@@ -8,14 +8,14 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
// innerHeight and innerWidth
jQuery.fn["inner" + name] = function() {
return this[0] ?
parseFloat( jQuery.css( this[0], type, undefined, "padding" ), 10 ) :
parseFloat( jQuery.css( this[0], type, "padding" ), 10 ) :

This comment has been minimized.

Copy link
@karbassi

karbassi Sep 17, 2010

I don't believe parseFloat takes a second param.

This comment has been minimized.

Copy link
@jeresig

jeresig Sep 17, 2010

Author Member

Ha, good call - fixed. 2d70dc9

null;
};

// outerHeight and outerWidth
jQuery.fn["outer" + name] = function( margin ) {
return this[0] ?
parseFloat( jQuery.css( this[0], type, undefined, margin ? "margin" : "border" ), 10 ) :
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ), 10 ) :
null;
};

0 comments on commit 6541eb9

Please sign in to comment.
You can’t perform that action at this time.