Skip to main content

Search and Top Navigation

#8951 closed bug (notabug)

Opened January 08, 2013 05:26PM UTC

Closed January 08, 2013 05:28PM UTC

Last modified January 08, 2013 06:24PM UTC

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:
Description

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.

Attachments (0)
Change History (5)

Changed January 08, 2013 05:28PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

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

Changed January 08, 2013 05:30PM UTC by scottgonzalez comment:2

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

Changed January 08, 2013 05:55PM UTC by dbarnes comment:3

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?

Changed January 08, 2013 05:59PM UTC by scottgonzalez comment:4

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.

Changed January 08, 2013 06:24PM UTC by dbarnes comment:5

PR submitted