Merge branch 'master' of http://github.com/aakoch/jquery into aakoch-master
authorjeresig <jeresig@gmail.com>
Mon, 27 Sep 2010 18:49:13 +0000 (14:49 -0400)
committerjeresig <jeresig@gmail.com>
Mon, 27 Sep 2010 18:49:13 +0000 (14:49 -0400)
19 files changed:
src/ajax.js
src/attributes.js
src/core.js
src/css.js
src/data.js
src/effects.js
src/event.js
src/support.js
test/data/cow.jpg [deleted file]
test/data/testsuite.css
test/index.html
test/unit/ajax.js
test/unit/attributes.js
test/unit/data.js
test/unit/effects.js
test/unit/event.js
test/unit/manipulation.js
test/unit/selector.js
test/unit/traversing.js

index eebb81b..31efc56 100644 (file)
@@ -4,6 +4,7 @@ var jsc = jQuery.now(),
        rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
        rselectTextarea = /^(?:select|textarea)/i,
        rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+       rnoContent = /^(?:GET|HEAD|DELETE)$/,
        rbracket = /\[\]$/,
        jsre = /\=\?(&|$)/,
        rquery = /\?/,
@@ -204,10 +205,12 @@ jQuery.extend({
 
        ajax: function( origSettings ) {
                var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
-                       jsonp, status, data, type = s.type.toUpperCase();
+                       jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
 
                s.url = s.url.replace( rhash, "" );
-               s.context = origSettings && origSettings.context || s;
+
+               // Use original (not extended) context object if it was provided
+               s.context = origSettings && origSettings.context != null ? origSettings.context : s;
 
                // convert data if not already a string
                if ( s.data && s.processData && typeof s.data !== "string" ) {
@@ -300,10 +303,10 @@ jQuery.extend({
                if ( s.dataType === "script" && type === "GET" && remote ) {
                        var head = document.getElementsByTagName("head")[0] || document.documentElement;
                        var script = document.createElement("script");
-                       script.src = s.url;
                        if ( s.scriptCharset ) {
                                script.charset = s.scriptCharset;
                        }
+                       script.src = s.url;
 
                        // Handle Script loading
                        if ( !jsonp ) {
@@ -353,8 +356,8 @@ jQuery.extend({
 
                // Need an extra try/catch for cross domain requests in Firefox 3
                try {
-                       // Set the correct header, if data is being sent
-                       if ( s.data || origSettings && origSettings.contentType ) {
+                       // Set content-type if data specified and content-body is valid for this type
+                       if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
                                xhr.setRequestHeader("Content-Type", s.contentType);
                        }
 
@@ -377,7 +380,7 @@ jQuery.extend({
 
                        // Set the Accepts header for the server, depending on the dataType
                        xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
-                               s.accepts[ s.dataType ] + ", */*" :
+                               s.accepts[ s.dataType ] + ", */*; q=0.01" :
                                s.accepts._default );
                } catch( headerError ) {}
 
@@ -489,10 +492,10 @@ jQuery.extend({
 
                // Send the data
                try {
-                       xhr.send( (type !== "GET" && s.data) || null );
+                       xhr.send( noContent || s.data == null ? null : s.data );
 
                } catch( sendError ) {
-                       jQuery.ajax.handleError( s, xhr, null, e );
+                       jQuery.ajax.handleError( s, xhr, null, sendError );
 
                        // Fire the complete handlers
                        jQuery.ajax.handleComplete( s, xhr, status, data );
@@ -542,7 +545,7 @@ jQuery.extend({
 });
 
 function buildParams( prefix, obj, traditional, add ) {
-       if ( jQuery.isArray(obj) ) {
+       if ( jQuery.isArray(obj) && obj.length ) {
                // Serialize array item.
                jQuery.each( obj, function( i, v ) {
                        if ( traditional || rbracket.test( prefix ) ) {
@@ -562,10 +565,15 @@ function buildParams( prefix, obj, traditional, add ) {
                });
                        
        } else if ( !traditional && obj != null && typeof obj === "object" ) {
+               if ( jQuery.isEmptyObject( obj ) ) {
+                       add( prefix, "" );
+
                // Serialize object item.
-               jQuery.each( obj, function( k, v ) {
-                       buildParams( prefix + "[" + k + "]", v, traditional, add );
-               });
+               } else {
+                       jQuery.each( obj, function( k, v ) {
+                               buildParams( prefix + "[" + k + "]", v, traditional, add );
+                       });
+               }
                                        
        } else {
                // Serialize scalar item.
index 73dee36..cb9f2cf 100644 (file)
@@ -136,7 +136,7 @@ jQuery.fn.extend({
        },
 
        val: function( value ) {
-               if ( value === undefined ) {
+               if ( !arguments.length ) {
                        var elem = this[0];
 
                        if ( elem ) {
@@ -163,8 +163,11 @@ jQuery.fn.extend({
                                        for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
                                                var option = options[ i ];
 
-                                               if ( option.selected ) {
-                                                       // Get the specifc value for the option
+                                               // Don't return options that are disabled or in a disabled optgroup
+                                               if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 
+                                                               (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+                                                       // Get the specific value for the option
                                                        value = jQuery(option).val();
 
                                                        // We don't need an array for one selects
@@ -207,9 +210,10 @@ jQuery.fn.extend({
                                val = value.call(this, i, self.val());
                        }
 
-                       // Typecast each time if the value is a Function and the appended
-                       // value is therefore different each time.
-                       if ( typeof val === "number" ) {
+                       // Treat null/undefined as ""; convert numbers to string
+                       if ( val == null ) {
+                               val = "";
+                       } else if ( typeof val === "number" ) {
                                val += "";
                        }
 
@@ -329,7 +333,7 @@ jQuery.extend({
 
                        // Ensure that missing attributes return undefined
                        // Blackberry 4.7 returns "" from getAttribute #6938
-                       if ( !elem.attributes[ name ] && !elem.hasAttribute( name ) ) {
+                       if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
                                return undefined;
                        }
 
index 6c6d006..3389e83 100644 (file)
@@ -33,6 +33,9 @@ var jQuery = function( selector, context ) {
        // Check for non-word characters
        rnonword = /\W/,
 
+       // Check for digits
+       rdigit = /\d/,
+
        // Match a standalone tag
        rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
 
@@ -91,7 +94,7 @@ jQuery.fn = jQuery.prototype = {
                }
                
                // The body element only exists once, optimize finding it
-               if ( selector === "body" && !context ) {
+               if ( selector === "body" && !context && document.body ) {
                        this.context = document;
                        this[0] = document.body;
                        this.selector = "body";
@@ -488,6 +491,10 @@ jQuery.extend({
                return obj && typeof obj === "object" && "setInterval" in obj;
        },
 
+       isNaN: function( obj ) {
+               return obj == null || !rdigit.test( obj ) || isNaN( obj );
+       },
+
        type: function( obj ) {
                return obj == null ?
                        String( obj ) :
index 69c4452..07ff686 100644 (file)
@@ -32,10 +32,15 @@ jQuery.extend({
        // behavior of getting and setting a style property
        cssHooks: {
                opacity: {
-                       get: function( elem ) {
-                               // We should always get a number back from opacity
-                               var ret = curCSS( elem, "opacity", "opacity" );
-                               return ret === "" ? "1" : ret;
+                       get: function( elem, computed ) {
+                               if ( computed ) {
+                                       // We should always get a number back from opacity
+                                       var ret = curCSS( elem, "opacity", "opacity" );
+                                       return ret === "" ? "1" : ret;
+
+                               } else {
+                                       return elem.style.opacity;
+                               }
                        }
                }
        },
@@ -174,9 +179,9 @@ if ( !jQuery.support.opacity ) {
        jQuery.cssHooks.opacity = {
                get: function( elem, computed ) {
                        // IE uses filters for opacity
-                       return ropacity.test((computed ? elem.currentStyle.filter : elem.style.filter) || "") ?
+                       return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
                                (parseFloat(RegExp.$1) / 100) + "" :
-                               "1";
+                               computed ? "1" : "";
                },
 
                set: function( elem, value ) {
@@ -187,11 +192,10 @@ if ( !jQuery.support.opacity ) {
                        style.zoom = 1;
 
                        // Set the alpha filter to set the opacity
-                       var opacity = parseInt( value, 10 ) + "" === "NaN" ?
+                       var opacity = jQuery.isNaN(value) ?
                                "" :
-                               "alpha(opacity=" + value * 100 + ")";
-
-                       var filter = style.filter || elem.currentStyle.filter || "";
+                               "alpha(opacity=" + value * 100 + ")",
+                               filter = style.filter || "";
 
                        style.filter = ralpha.test(filter) ?
                                filter.replace(ralpha, opacity) :
@@ -219,7 +223,7 @@ if ( getComputedStyle ) {
 
 } else if ( document.documentElement.currentStyle ) {
        curCSS = function( elem, name ) {
-               var left, rsLeft, ret = elem.currentStyle[ name ], style = elem.style;
+               var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;
 
                // From the awesome hack by Dean Edwards
                // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
index ac082dd..43ab595 100644 (file)
@@ -1,8 +1,7 @@
 (function( jQuery ) {
 
 var windowData = {},
-       rbrace = /^(?:\{.*\}|\[.*\])$/,
-       rdigit = /\d/;
+       rbrace = /^(?:\{.*\}|\[.*\])$/;
 
 jQuery.extend({
        cache: {},
@@ -17,12 +16,13 @@ jQuery.extend({
        // attempt to add expando properties to them.
        noData: {
                "embed": true,
-               "object": true,
+               // Ban all objects except for Flash (which handle expandos)
+               "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
                "applet": true
        },
 
        data: function( elem, name, data ) {
-               if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+               if ( !jQuery.acceptData( elem ) ) {
                        return;
                }
 
@@ -85,7 +85,7 @@ jQuery.extend({
        },
 
        removeData: function( elem, name ) {
-               if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+               if ( !jQuery.acceptData( elem ) ) {
                        return;
                }
 
@@ -126,6 +126,19 @@ jQuery.extend({
                                delete cache[ id ];
                        }
                }
+       },
+
+       // A method for determining if a DOM node can handle the data expando
+       acceptData: function( elem ) {
+               if ( elem.nodeName ) {
+                       match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+                       if ( match ) {
+                               return !(match === true || elem.getAttribute("classid") !== match);
+                       }
+               }
+
+               return true;
        }
 });
 
@@ -160,7 +173,7 @@ jQuery.fn.extend({
                                                        data = data === "true" ? true :
                                                                data === "false" ? false :
                                                                data === "null" ? null :
-                                                               rdigit.test( data ) && !isNaN( data ) ? parseFloat( data ) :
+                                                               !jQuery.isNaN( data ) ? parseFloat( data ) :
                                                                rbrace.test( data ) ? jQuery.parseJSON( data ) :
                                                                data;
                                                } catch( e ) {}
index f3163eb..56141bb 100644 (file)
@@ -248,7 +248,7 @@ jQuery.each({
 
 jQuery.extend({
        speed: function( speed, easing, fn ) {
-               var opt = speed && typeof speed === "object" ? speed : {
+               var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
                        complete: fn || !fn && easing ||
                                jQuery.isFunction( speed ) && speed,
                        duration: speed,
index e667ddb..65b5952 100644 (file)
@@ -331,6 +331,7 @@ jQuery.event = {
                        if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
                                if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
                                        event.result = false;
+                                       event.preventDefault();
                                }
                        }
 
@@ -429,7 +430,7 @@ jQuery.event = {
                return event.result;
        },
 
-       props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+       props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
 
        fix: function( event ) {
                if ( event[ jQuery.expando ] ) {
index 75e89dd..d35dbed 100644 (file)
@@ -13,7 +13,9 @@
        div.innerHTML = "   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
 
        var all = div.getElementsByTagName("*"),
-               a = div.getElementsByTagName("a")[0];
+               a = div.getElementsByTagName("a")[0],
+               select = document.createElement("select"),
+               opt = select.appendChild( document.createElement("option") );
 
        // Can't get basic test support
        if ( !all || !all.length || !a ) {
 
                // Make sure that a selected-by-default option has a working selected property.
                // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
-               optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
+               optSelected: opt.selected,
 
                // Will be defined later
+               optDisabled: false,
                checkClone: false,
                scriptEval: false,
                noCloneEvent: true,
                boxModel: null
        };
 
+       // Make sure that the options inside disabled selects aren't marked as disabled
+       // (WebKit marks them as diabled)
+       select.disabled = true;
+       jQuery.support.optDisabled = !opt.disabled;
+
        script.type = "text/javascript";
        try {
                script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
diff --git a/test/data/cow.jpg b/test/data/cow.jpg
deleted file mode 100644 (file)
index 2c5b672..0000000
Binary files a/test/data/cow.jpg and /dev/null differ
index 5cc7828..1846892 100644 (file)
@@ -10,7 +10,7 @@ div#fx-tests h4.pass {
 }
 
 div#fx-tests div.box {
-        background: red url(data/cow.jpg) no-repeat;
+        background: red;
         overflow: hidden;
         border: 2px solid #000;
 }
index 78060d4..5650a1d 100644 (file)
                                <option id="option3d" value="3">3</option>
                                <option id="option3e">no value</option>
                        </select>
+                       <select name="select4" id="select4" multiple="multiple">
+                               <optgroup disabled="disabled">
+                                       <option id="option4a" class="emptyopt" value="">Nothing</option>
+                                       <option id="option4b" disabled="disabled" selected="selected" value="1">1</option>
+                                       <option id="option4c" selected="selected" value="2">2</option>
+                               </optgroup>
+                               <option selected="selected" disabled="disabled" id="option4d" value="3">3</option>
+                               <option id="option4e">no value</option>
+                       </select>
                        
                        <object id="object1" codebase="stupid">
                                <param name="p1" value="x1" />
index b7eb57d..6199270 100644 (file)
@@ -390,7 +390,7 @@ test("serialize()", function() {
 });
 
 test("jQuery.param()", function() {
-       expect(19);
+       expect(22);
        
        equals( !jQuery.ajaxSettings.traditional, true, "traditional flag, falsy by default" );
   
@@ -419,6 +419,11 @@ test("jQuery.param()", function() {
        equals( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
 
        equals( decodeURIComponent( jQuery.param({ a: [1,2,3], 'b[]': [4,5,6], 'c[d]': [7,8,9], e: { f: [10], g: [11,12], h: 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
+
+       // Make sure empty arrays and objects are handled #6481
+       equals( jQuery.param({"foo": {"bar": []} }), "foo%5Bbar%5D=", "Empty array param" );
+       equals( jQuery.param({"foo": {"bar": [], foo: 1} }), "foo%5Bbar%5D=&foo%5Bfoo%5D=1", "Empty array param" );
+       equals( jQuery.param({"foo": {"bar": {}} }), "foo%5Bbar%5D=", "Empty object param" );
        
        jQuery.ajaxSetup({ traditional: true });
        
@@ -1242,8 +1247,16 @@ test("jQuery.ajax - If-Modified-Since support", function() {
                                                ok(data == null, "response body should be empty")
                                        }
                                        start();
+                               },
+                               error: function() {
+                                       equals(false, "error");
+                                       start();
                                }
                        });
+               },
+               error: function() {
+                       equals(false, "error");
+                       start();
                }
        });
 });
@@ -1273,13 +1286,20 @@ test("jQuery.ajax - Etag support", function() {
                                                ok(data == null, "response body should be empty")
                                        }
                                        start();
+                               },
+                               error: function() {
+                                       equals(false, "error");
+                                       start();
                                }
                        });
+               },
+               error: function() {
+                       equals(false, "error");
+                       start();
                }
        });
 });
 
-
 test("jQuery.ajax - active counter", function() {
     ok( jQuery.ajax.active == 0, "ajax active counter should be zero: " + jQuery.ajax.active );
 });
index 0372721..3326dfe 100644 (file)
@@ -302,7 +302,7 @@ test("removeAttr(String)", function() {
 });
 
 test("val()", function() {
-       expect(17);
+       expect(20);
 
        document.getElementById('text1').value = "bla";
        equals( jQuery("#text1").val(), "bla", "Check for modified value of input element" );
@@ -329,6 +329,14 @@ test("val()", function() {
        jQuery('#select3').val("");
        same( jQuery('#select3').val(), [''], 'Call val() on a multiple="multiple" select' );
 
+       same( jQuery('#select4').val(), [], 'Call val() on multiple="multiple" select with all disabled options' );
+
+       jQuery('#select4 optgroup').add('#select4 > [disabled]').attr('disabled', false);
+       same( jQuery('#select4').val(), ['2', '3'], 'Call val() on multiple="multiple" select with some disabled options' );
+
+       jQuery('#select4').attr('disabled', true);
+       same( jQuery('#select4').val(), ['2', '3'], 'Call val() on disabled multiple="multiple" select' );
+
        var checks = jQuery("<input type='checkbox' name='test' value='1'/><input type='checkbox' name='test' value='2'/><input type='checkbox' name='test' value=''/><input type='checkbox' name='test'/>").appendTo("#form");
 
        same( checks.serialize(), "", "Get unchecked values." );
@@ -351,14 +359,20 @@ test("val()", function() {
 });
 
 var testVal = function(valueObj) {
-       expect(6);
+       expect(8);
 
        jQuery("#text1").val(valueObj( 'test' ));
        equals( document.getElementById('text1').value, "test", "Check for modified (via val(String)) value of input element" );
 
+       jQuery("#text1").val(valueObj( undefined ));
+       equals( document.getElementById('text1').value, "", "Check for modified (via val(undefined)) value of input element" );
+
        jQuery("#text1").val(valueObj( 67 ));
        equals( document.getElementById('text1').value, "67", "Check for modified (via val(Number)) value of input element" );
 
+       jQuery("#text1").val(valueObj( null ));
+       equals( document.getElementById('text1').value, "", "Check for modified (via val(null)) value of input element" );
+
        jQuery("#select1").val(valueObj( "3" ));
        equals( jQuery("#select1").val(), "3", "Check for modified (via val(String)) value of select element" );
 
index 1163ddc..77ee099 100644 (file)
@@ -24,6 +24,24 @@ test("expando", function(){
        equals( id.foo, "bar", "jQuery.data worked correctly" );
 });
 
+test("jQuery.acceptData", function() {
+       expect(7);
+
+       ok( jQuery.acceptData( document ), "document" );
+       ok( jQuery.acceptData( document.documentElement ), "documentElement" );
+       ok( jQuery.acceptData( {} ), "object" );
+       ok( !jQuery.acceptData( document.createElement("embed") ), "embed" );
+       ok( !jQuery.acceptData( document.createElement("applet") ), "applet" );
+
+       var flash = document.createElement("object");
+       flash.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
+       ok( jQuery.acceptData( flash ), "flash" );
+
+       var applet = document.createElement("object");
+       applet.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
+       ok( !jQuery.acceptData( applet ), "applet" );
+});
+
 test("jQuery.data", function() {
        expect(13);
        var div = document.createElement("div");
@@ -63,11 +81,14 @@ test("jQuery.data", function() {
 });
 
 test(".data()", function() {
-       expect(2);
+       expect(4);
 
        var div = jQuery("#foo");
+       strictEqual( div.data("foo"), undefined, "Make sure that missing result is undefined" );
+
        div.data("test", "success");
        same( div.data(), {test: "success"}, "data() get the entire data object" );
+       strictEqual( div.data("foo"), undefined, "Make sure that missing result is still undefined" );
 
        var nodiv = jQuery("#unfound");
        equals( nodiv.data(), null, "data() on empty set returns null" );
index ed6faa9..b9d5c88 100644 (file)
@@ -389,16 +389,16 @@ jQuery.each( {
        "CSS Auto": function(elem,prop){
                jQuery(elem).addClass("auto" + prop)
                        .text("This is a long string of text.");
-               return prop == "opacity" ? 1 : "";
+               return "";
        },
        "JS Auto": function(elem,prop){
                jQuery(elem).css(prop,"")
                        .text("This is a long string of text.");
-               return prop == "opacity" ? 1 : "";
+               return "";
        },
        "CSS 100": function(elem,prop){
                jQuery(elem).addClass("large" + prop);
-               return prop == "opacity" ? 1 : "";
+               return "";
        },
        "JS 100": function(elem,prop){
                jQuery(elem).css(prop,prop == "opacity" ? 1 : "100px");
@@ -406,7 +406,7 @@ jQuery.each( {
        },
        "CSS 50": function(elem,prop){
                jQuery(elem).addClass("med" + prop);
-               return prop == "opacity" ? 0.5 : "";
+               return "";
        },
        "JS 50": function(elem,prop){
                jQuery(elem).css(prop,prop == "opacity" ? 0.50 : "50px");
@@ -414,7 +414,7 @@ jQuery.each( {
        },
        "CSS 0": function(elem,prop){
                jQuery(elem).addClass("no" + prop);
-               return prop == "opacity" ? 0 : "";
+               return "";
        },
        "JS 0": function(elem,prop){
                jQuery(elem).css(prop,prop == "opacity" ? 0 : "0px");
@@ -481,10 +481,6 @@ jQuery.each( {
                                        
                                var cur_o = jQuery.style(this, "opacity");
 
-                               if ( cur_o !== "" ) {
-                                       cur_o = jQuery.css(this, "opacity");
-                               }
-       
                                if ( t_o == "hide" || t_o == "show" )
                                        equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o);
                                        
index 3032497..3c77e34 100644 (file)
@@ -255,7 +255,7 @@ test("bind(), iframes", function() {
 });
 
 test("bind(), trigger change on select", function() {
-       expect(3);
+       expect(4);
        var counter = 0;
        function selectOnChange(event) {
                equals( event.data, counter++, "Event.data is not a global event object" );
index e1d3dbf..2fc6f18 100644 (file)
@@ -899,7 +899,7 @@ var testHtml = function(valueObj) {
        equals( div.children().children().length, 1, "Make sure that a grandchild exists." );
 
        var space = jQuery("<div/>").html(valueObj("&#160;"))[0].innerHTML;
-       ok( /^\s$|^&nbsp;$/.test( space ), "Make sure entities are passed through correctly." );
+       ok( /^\xA0$|^&nbsp;$/.test( space ), "Make sure entities are passed through correctly." );
        equals( jQuery("<div/>").html(valueObj("&amp;"))[0].innerHTML, "&amp;", "Make sure entities are passed through correctly." );
 
        jQuery("#main").html(valueObj("<style>.foobar{color:green;}</style>"));
index 58ae68d..97fc689 100644 (file)
@@ -21,7 +21,7 @@ test("element", function() {
        same( jQuery("p", jQuery("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
        same( jQuery("div").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
 
-       same( jQuery("#form").find("select").get(), q("select1","select2","select3"), "Finding selects with a context." );
+       same( jQuery("#form").find("select").get(), q("select1","select2","select3","select4"), "Finding selects with a context." );
        
        ok( jQuery("#length").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
        ok( jQuery("#lengthtest input").length, '&lt;input name="length"&gt; cannot be found under IE, see #945' );
@@ -338,7 +338,7 @@ test("pseudo - :not", function() {
        expect(24);
        t( "Not", "a.blog:not(.link)", ["mark"] );
 
-       t( "Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e"] );
+       t( "Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e", "option4e"] );
        t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] );
 
        t( ":not() failing interior", "p:not(.foo)", ["firstp","ap","sndp","en","sap","first"] );
@@ -360,8 +360,8 @@ test("pseudo - :not", function() {
        t( "No element not selector", ".container div:not(.excluded) div", [] );
 
        t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2"]);
-       t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3"]);
-       t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3"]);
+       t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3", "select4"]);
+       t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3", "select4"]);
 
        t( ":not() Multiple Class", "#foo a:not(.blog)", ["yahoo","anchor2"] );
        t( ":not() Multiple Class", "#foo a:not(.link)", ["yahoo","anchor2"] );
@@ -427,7 +427,7 @@ test("pseudo - visibility", function() {
 test("pseudo - form", function() {
        expect(8);
 
-       t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3"] );
+       t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3", "select4"] );
        t( "Form element :radio", "#form :radio", ["radio1", "radio2"] );
        t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] );
        t( "Form element :text", "#form :text:not(#search)", ["text1", "text2", "hidden2", "name"] );
@@ -435,5 +435,5 @@ test("pseudo - form", function() {
        t( "Form element :checkbox:checked", "#form :checkbox:checked", ["check1"] );
        t( "Form element :radio:checked, :checkbox:checked", "#form :radio:checked, #form :checkbox:checked", ["radio2", "check1"] );
 
-       t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c"] );
+       t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d"] );
 });
index 179e130..4233f70 100644 (file)
@@ -152,7 +152,7 @@ test("not(Selector)", function() {
        equals( jQuery("#main > p#ap > a").not("#google").length, 2, "not('selector')" );
        same( jQuery("p").not(".result").get(), q("firstp", "ap", "sndp", "en", "sap", "first"), "not('.class')" );
        same( jQuery("p").not("#ap, #sndp, .result").get(), q("firstp", "en", "sap", "first"), "not('selector, selector')" );
-       same( jQuery("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d", "option3e" ), "not('complex selector')");
+       same( jQuery("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d", "option3e", "option4e" ), "not('complex selector')");
 
        same( jQuery('#ap *').not('code').get(), q("google", "groups", "anchor1", "mark"), "not('tag selector')" );
        same( jQuery('#ap *').not('code, #mark').get(), q("google", "groups", "anchor1"), "not('tag, ID selector')" );
@@ -163,7 +163,7 @@ test("not(Element)", function() {
        expect(1);
 
        var selects = jQuery("#form select");
-       same( selects.not( selects[1] ).get(), q("select1", "select3"), "filter out DOM element");
+       same( selects.not( selects[1] ).get(), q("select1", "select3", "select4"), "filter out DOM element");
 });
 
 test("not(Function)", function() {