From: John Resig Date: Mon, 6 Dec 2010 22:02:00 +0000 (-0500) Subject: Merge branch 'restrictAttr' of https://github.com/jitter/jquery into jitter-restrictAttr X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=commitdiff_plain;h=d4a9d45527ac8861f50ae3777d1bb3e33dacbea2;hp=b50f41a2e3ba9ab9a7bcf69a9633b0a8258015d6 Merge branch 'restrictAttr' of https://github.com/jitter/jquery into jitter-restrictAttr --- diff --git a/.gitattributes b/.gitattributes index bcb36db..d6dc470 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -* crlf=input +* eol=lf +*.jar binary diff --git a/src/attributes.js b/src/attributes.js index f463b4a..b0e3601 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,6 +1,6 @@ (function( jQuery ) { -var rclass = /[\n\t]/g, +var rclass = /[\n\t\r]/g, rspaces = /\s+/, rreturn = /\r/g, rspecialurl = /^(?:href|src|style)$/, diff --git a/src/css.js b/src/css.js index 4665fa7..8a83c60 100644 --- a/src/css.js +++ b/src/css.js @@ -177,13 +177,18 @@ jQuery.each(["height", "width"], function( i, name ) { } if ( val != null ) { - return val === "" ? "auto" : val; + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; } } if ( val < 0 || val == null ) { val = elem.style[ name ]; - return val === "" ? "auto" : val; + + // Should return "auto" instead of 0, use 0 for + // temporary backwards-compat + return val === "" || val === "auto" ? "0px" : val; } return typeof val === "string" ? val : val + "px"; diff --git a/src/event.js b/src/event.js index 3cfc817..58a6953 100644 --- a/src/event.js +++ b/src/event.js @@ -1075,8 +1075,8 @@ function liveHandler( event ) { events = events.events; } - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { + // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) + if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { return; } diff --git a/test/data/text.php b/test/data/text.php index c06ef4b..b9df4cf 100644 --- a/test/data/text.php +++ b/test/data/text.php @@ -1,12 +1,12 @@ -Lorem ipsum dolor sit amet -consectetuer adipiscing elit -Sed lorem leo -lorem leo consectetuer adipiscing elit -Sed lorem leo -rhoncus sit amet -elementum at -bibendum at, eros -Cras at mi et tortor egestas vestibulum -sed Cras at mi vestibulum -Phasellus sed felis sit amet -orci dapibus semper. +Lorem ipsum dolor sit amet +consectetuer adipiscing elit +Sed lorem leo +lorem leo consectetuer adipiscing elit +Sed lorem leo +rhoncus sit amet +elementum at +bibendum at, eros +Cras at mi et tortor egestas vestibulum +sed Cras at mi vestibulum +Phasellus sed felis sit amet +orci dapibus semper. diff --git a/test/delegatetest.html b/test/delegatetest.html index b2840c1..327085c 100644 --- a/test/delegatetest.html +++ b/test/delegatetest.html @@ -1,242 +1,242 @@ - - - - - - -

Change Tests

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Change each: - - - - - - - -
- - - - -
- -
- - - - -
- - - - - - - $(document).bind('change')
Live:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Bind:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
Focusin:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Focusout:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Live Focus:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
Live Blur:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
-

Submit Tests

- - - - - - - - - - - - - - - -
- Submit each: - -
- -
-
-
- -
-
-
- -
-
$(document).bind('submit')
Results:TEXTPASSWORDBUTTONDOCUMENT
- - - - - - + + + + + + +

Change Tests

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Change each: + + + + + + + +
+ + + + +
+ +
+ + + + +
+ + + + + + + $(document).bind('change')
Live:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Bind:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
Focusin:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Focusout:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREADOCUMENT
Live Focus:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
Live Blur:SELECTMULTICHECKBOXRADIOFILETEXTTEXTAREA
+

Submit Tests

+ + + + + + + + + + + + + + + +
+ Submit each: + +
+ +
+
+
+ +
+
+
+ +
+
$(document).bind('submit')
Results:TEXTPASSWORDBUTTONDOCUMENT
+ + + + + + diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 7314b3a..d17653d 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -764,7 +764,7 @@ test("toggleClass(Fucntion[, boolean]) with incoming value", function() { }); test("addClass, removeClass, hasClass", function() { - expect(14); + expect(17); var jq = jQuery("

Hi

"), x = jq[0]; @@ -784,12 +784,14 @@ test("addClass, removeClass, hasClass", function() { ok( jq.hasClass("hi"), "Check has1" ); ok( jq.hasClass("bar"), "Check has2" ); - var jq = jQuery("

"); - ok( jq.hasClass("class1"), "Check hasClass with carriage return" ); - ok( jq.is(".class1"), "Check is with carriage return" ); + var jq = jQuery("

"); + ok( jq.hasClass("class1"), "Check hasClass with line feed" ); + ok( jq.is(".class1"), "Check is with line feed" ); ok( jq.hasClass("class2"), "Check hasClass with tab" ); ok( jq.is(".class2"), "Check is with tab" ); ok( jq.hasClass("cla.ss3"), "Check hasClass with dot" ); + ok( jq.hasClass("class4"), "Check hasClass with carriage return" ); + ok( jq.is(".class4"), "Check is with carriage return" ); jq.removeClass("class2"); ok( jq.hasClass("class2")==false, "Check the class has been properly removed" ); @@ -797,4 +799,6 @@ test("addClass, removeClass, hasClass", function() { ok( jq.hasClass("cla.ss3"), "Check the dotted class has not been removed" ); jq.removeClass("cla.ss3"); ok( jq.hasClass("cla.ss3")==false, "Check the dotted class has been removed" ); + jq.removeClass("class4"); + ok( jq.hasClass("class4")==false, "Check the class has been properly removed" ); }); diff --git a/test/unit/css.js b/test/unit/css.js index 71f8835..cddd902 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -13,8 +13,10 @@ test("css(String|Hash)", function() { var div = jQuery( "
" ); - equals( div.css("width"), "auto", "Width on disconnected node." ); - equals( div.css("height"), "auto", "Height on disconnected node." ); + // These should be "auto" (or some better value) + // temporarily provide "0px" for backwards compat + equals( div.css("width"), "0px", "Width on disconnected node." ); + equals( div.css("height"), "0px", "Height on disconnected node." ); div.css({ width: 4, height: 4 }); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index 92cf17b..8255bf3 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -103,7 +103,7 @@ test("height() with function args", function() { }); test("innerWidth()", function() { - expect(3); + expect(4); var $div = jQuery("#nothiddendiv"); // set styles @@ -121,10 +121,15 @@ test("innerWidth()", function() { // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); + + var div = jQuery( "
" ); + + // Temporarily require 0 for backwards compat - should be auto + equals( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." ); }); test("innerHeight()", function() { - expect(3); + expect(4); var $div = jQuery("#nothiddendiv"); // set styles @@ -142,10 +147,15 @@ test("innerHeight()", function() { // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); + + var div = jQuery( "
" ); + + // Temporarily require 0 for backwards compat - should be auto + equals( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." ); }); test("outerWidth()", function() { - expect(6); + expect(7); var $div = jQuery("#nothiddendiv"); $div.css("width", 30); @@ -164,10 +174,15 @@ test("outerWidth()", function() { // reset styles $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" }); + + var div = jQuery( "
" ); + + // Temporarily require 0 for backwards compat - should be auto + equals( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." ); }); test("outerHeight()", function() { - expect(6); + expect(7); var $div = jQuery("#nothiddendiv"); $div.css("height", 30); @@ -185,4 +200,9 @@ test("outerHeight()", function() { // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); + + var div = jQuery( "
" ); + + // Temporarily require 0 for backwards compat - should be auto + equals( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." ); }); diff --git a/version.txt b/version.txt index 4ae0c26..7810cd6 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.4.4pre \ No newline at end of file +1.4.5pre \ No newline at end of file