core: changed jQuery.css to num (uses curCSS) in the height/width methods with dramat...
[jquery.git] / src / core.js
index 5e1f0b0..6255dc5 100644 (file)
@@ -21,7 +21,7 @@ var jQuery = window.jQuery = window.$ = function( selector, context ) {
 
 // A simple way to check for HTML strings or ID strings
 // (both of which we optimize for)
-var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
+var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
 
 // Is it a simple selector
        isSimple = /^.[^:#\[\.]*$/,
@@ -943,12 +943,12 @@ jQuery.extend({
                        context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
 
                jQuery.each(elems, function(i, elem){
+                       if ( typeof elem == 'number' )
+                               elem += '';
+
                        if ( !elem )
                                return;
 
-                       if ( elem.constructor == Number )
-                               elem += '';
-
                        // Convert html string into DOM nodes
                        if ( typeof elem == "string" ) {
                                // Fix "XHTML"-style tags in all browsers
@@ -1358,7 +1358,7 @@ jQuery.each([ "Height", "Width" ], function(i, name){
                                // Get or set width or height on the element
                                size == undefined ?
                                        // Get width or height on the element
-                                       (this.length ? jQuery.css( this[0], type ) : null) :
+                                       (this.length ? num( this, type) : null) :
 
                                        // Set the width or height on the element (default to pixels if value is unitless)
                                        this.css( type, size.constructor == String ? size : size + "px" );
@@ -1368,4 +1368,4 @@ jQuery.each([ "Height", "Width" ], function(i, name){
 // Helper function used by the dimensions and offset modules
 function num(elem, prop) {
        return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
-}
\ No newline at end of file
+}