jquery core: casting numbers received by val() to string.
[jquery.git] / src / core.js
index 56a2b1f..d46f89d 100644 (file)
@@ -401,6 +401,9 @@ jQuery.fn = jQuery.prototype = {
                        return undefined;
                }
 
+               if( value.constructor == Number )
+                       value += '';
+
                return this.each(function(){
                        if ( this.nodeType != 1 )
                                return;
@@ -427,7 +430,7 @@ jQuery.fn = jQuery.prototype = {
 
        html: function( value ) {
                return value == undefined ?
-                       (this.length ?
+                       (this[0] ?
                                this[0].innerHTML :
                                null) :
                        this.empty().append( value );
@@ -504,9 +507,9 @@ jQuery.fn = jQuery.prototype = {
                                        this;
 
                                // execute all scripts after the elements have been injected
-                               if ( jQuery.nodeName( elem, "script" ) ) {
+                               if ( jQuery.nodeName( elem, "script" ) )
                                        scripts = scripts.add( elem );
-                               } else {
+                               else {
                                        // Remove any inner scripts for later evaluation
                                        if ( elem.nodeType == 1 )
                                                scripts = scripts.add( jQuery( "script", elem ).remove() );
@@ -637,7 +640,9 @@ jQuery.extend({
                        else
                                script.appendChild( document.createTextNode( data ) );
 
-                       head.appendChild( script );
+                       // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
+                       // This arises when a base node is used (#2709).
+                       head.insertBefore( script, head.firstChild );
                        head.removeChild( script );
                }
        },
@@ -743,14 +748,14 @@ jQuery.extend({
        },
 
        prop: function( elem, value, type, i, name ) {
-                       // Handle executable functions
-                       if ( jQuery.isFunction( value ) )
-                               value = value.call( elem, i );
-
-                       // Handle passing in a number to a CSS property
-                       return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
-                               value + "px" :
-                               value;
+               // Handle executable functions
+               if ( jQuery.isFunction( value ) )
+                       value = value.call( elem, i );
+
+               // Handle passing in a number to a CSS property
+               return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
+                       value + "px" :
+                       value;
        },
 
        className: {