aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@gmail.com>2016-05-01 18:40:20 -0300
committerRichard Gibson <richard.gibson@gmail.com>2016-05-06 22:12:20 -0400
commit7fd36ea145a11d5896de6d064b546b1c57a83f34 (patch)
tree93f66ac01b9aaa6cd0229939b2cd852a35574e8e /src
parent931f45fc387d68cfce004f786330d18f74cf03e5 (diff)
downloadjquery-7fd36ea145a11d5896de6d064b546b1c57a83f34.tar.gz
jquery-7fd36ea145a11d5896de6d064b546b1c57a83f34.zip
Event: Evaluate delegate selectors at add time
This ensures that invalid selectors throw right away. Fixes gh-3071 Closes gh-3097
Diffstat (limited to 'src')
-rw-r--r--src/event.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js
index ffaec578d..3f1c5f31a 100644
--- a/src/event.js
+++ b/src/event.js
@@ -120,6 +120,11 @@ jQuery.event = {
selector = handleObjIn.selector;
}
+ // If the selector is invalid, throw any exceptions at attach time
+ if ( selector ) {
+ jQuery.find( selector, elem );
+ }
+
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;