Skip to main content

Bug Tracker

Side navigation

#13050 closed bug (notabug)

Opened December 13, 2012 04:03PM UTC

Closed December 13, 2012 04:21PM UTC

Last modified December 13, 2012 06:17PM UTC

.delegate does not support variables

Reported by: mmeah@riverstar.com 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.

Attachments (0)
Change History (7)

Changed December 13, 2012 04:21PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

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

Changed December 13, 2012 04:23PM UTC by dmethvin comment:2

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.

Changed December 13, 2012 05:31PM UTC by mmeah@riverstar.com comment:3

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/

Changed December 13, 2012 06:02PM UTC by dmethvin comment:4

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

Changed December 13, 2012 06:07PM UTC by mmeah@riverstar.com comment:5

Replying to [comment:4 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.

Changed December 13, 2012 06:10PM UTC by dmethvin comment:6

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.

Changed December 13, 2012 06:17PM UTC by mmeah@riverstar.com comment:7

Replying to [comment:6 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/