From 47abe5e1da5bcb5a268aefea9817b8747b051b18 Mon Sep 17 00:00:00 2001 From: Dan Heberden Date: Fri, 18 Feb 2011 10:09:07 -0800 Subject: [PATCH] Bug #6911 - Prevent action on disabled elements, both triggering and bound via .live() --- src/event.js | 2 +- test/delegatetest.html | 155 +++++++++++++++++++++++++---------------- 2 files changed, 95 insertions(+), 62 deletions(-) diff --git a/src/event.js b/src/event.js index 1bfb4bbc..f7e0a08c 100644 --- a/src/event.js +++ b/src/event.js @@ -1099,7 +1099,7 @@ function liveHandler( event ) { for ( j = 0; j < live.length; j++ ) { handleObj = live[j]; - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) { + if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { elem = close.elem; related = null; diff --git a/test/delegatetest.html b/test/delegatetest.html index 6479d26e..c4f33aae 100644 --- a/test/delegatetest.html +++ b/test/delegatetest.html @@ -11,63 +11,71 @@

Change Tests

- - - - - - - - - - - - + + + + + + + + + + + + + @@ -79,6 +87,7 @@ + @@ -89,6 +98,7 @@ + @@ -100,6 +110,7 @@ + @@ -111,6 +122,7 @@ + @@ -121,11 +133,24 @@ + + + + + + + + + + + + +
- Change each: - - - - - - - -
- - - - -
- -
- - - - -
- - - - - - - $(document).bind('change')
+ Change each: + + + + + + + +
+ +
+ + +
+
+
+
+
+
+ +
+ +
+ + +
+ + + + + + + $(document).bind('change')
+ $(document).bind('click') +
Live: SELECT MULTI CHECKBOXBUTTON RADIO FILE TEXTSELECT MULTI CHECKBOXBUTTON RADIO FILE TEXTSELECT MULTI CHECKBOXBUTTON RADIO FILE TEXTSELECT MULTI CHECKBOXBUTTON RADIO FILE TEXTSELECT MULTI CHECKBOXBUTTON RADIO FILE TEXTSELECT MULTI CHECKBOXBUTTON RADIO FILE TEXT TEXTAREA
Live Click:SELECTMULTICHECKBOXBUTTONRADIOFILETEXTTEXTAREADOCUMENT

Submit Tests

@@ -162,7 +187,7 @@