#13050 closed bug (notabug)
.delegate does not support variables
Reported by: | 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 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
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 10 years ago by
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 follow-up: 5 Changed 10 years ago by
1.8.2 is right. The ID you are selecting should be below the delegation point.
comment:5 Changed 10 years ago by
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 follow-up: 7 Changed 10 years ago by
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 Changed 10 years ago by
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/
You have the arguments backwards. Ask for help on the forum.