Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8951 closed bug (notabug)

bug: Widget Factory: Cannot bind namespaced events via _on

Reported by: dbarnes Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.widget Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:


The regular expression that parses the eventName in the _on method causes a namespaced event (keydown.nh in my case) to be bound as a delegated event (with the selector as .nh) This is because match 1 of the regex, assumes only alnum chars will be used for the eventName.

I will be submitting a GitHub PR soon, and will reference this ticket there.

Change History (5)

comment:1 Changed 10 years ago by Scott González

Resolution: notabug
Status: newclosed

Please don't send a PR. You shouldn't bind namespaced events.

comment:2 Changed 10 years ago by Scott González

Out of curiosity, why were you trying to do this?

comment:3 Changed 10 years ago by dbarnes

Well, I was extending the slider plugin, and it uses the keydown event itself. I was adding some functionality that I needed to enable/disable on the fly. This new feature used the keydown event, but because the base uses the same event, disabling that feature (and trying to unbind my keydown event) causes the keydown event on the base to be removed, breaking the plugin.

Aside from namespaces, how else can I separate these events? Or do I just have to dodge _on and _off in cases like this?

comment:4 Changed 10 years ago by Scott González

Send a PR to move the event handler into a named function (see how spinner binds to keydown). That will give you a hook point.

comment:5 Changed 10 years ago by dbarnes

PR submitted

Note: See TracTickets for help on using tickets.