Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13050 closed bug (notabug)

.delegate does not support variables

Reported by: mmeah@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:

Description

The selector (first) parameter does not support variables anymore, but still works with 1.8.0

.delegate(myVar+" a","click",myFunc) does not work .delegate("a","click",myFunc) does still work

I know .on is the new way of doing things, but need to support legacy code.

Change History (7)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

You have the arguments backwards. Ask for help on the forum.

comment:2 Changed 7 years ago by dmethvin

Actually, you don't have them backwards but you're wrong, they are supported. It's just concatenating strings with JavaScript after all. If after discussing this with people on the forum you can provide an example of failure using jsFiddle, we can reopen.

comment:3 Changed 7 years ago by mmeah@…

You are correct, it isn't a variable issue. But there is still a discrepancy in how 1.8.0 and 1.8.3, on in the jsfiddle below between 1.7.2 and 1.8.2

Seems like ID cannot be in the selector.

(Ver 1.7.2) http://jsfiddle.net/mmeah/WYS6P/ (Ver 1.8.2) http://jsfiddle.net/mmeah/ML4dt/

comment:4 Changed 7 years ago by dmethvin

1.8.2 is right. The ID you are selecting should be below the delegation point.

comment:5 in reply to:  4 Changed 7 years ago by mmeah@…

Replying to dmethvin:

1.8.2 is right. The ID you are selecting should be below the delegation point.

Please elaborate. So IDs can never be in the delegate selector? I understand the point of how code "should" be written, but this was supported in 1.8.0.

comment:6 Changed 7 years ago by dmethvin

The id is clearly not needed, since you're already below it. You're expecting the search to start from the <html> element I assume, which it erroneously did in previous versions. If the id was below the delegation point the selector would make sense.

comment:7 in reply to:  6 Changed 7 years ago by mmeah@…

Replying to dmethvin:

The id is clearly not needed, since you're already below it. You're expecting the search to start from the <html> element I assume, which it erroneously did in previous versions. If the id was below the delegation point the selector would make sense.

Got it! Thanks for explaining! Updated jsfiddle showing a corrected example. http://jsfiddle.net/mmeah/ML4dt/1/

Note: See TracTickets for help on using tickets.