This issue originated from #668104: Make overlay respect other click handlers #31.

More info on namespaced events: http://docs.jquery.com/Namespaced_Events

Comments

casey’s picture

Looking at how jQuery UI is using namespaced events (keypress.ui-dialog, click.dialog-overlay) I suggest using "drupal-{module name}". drupal to prevent collision with non drupal scripts.

When a module wants to further distinguish between events it should use "drupal-{module name}.drupal-{module name}-{subdivision}". Note the use of multiple namespaces.

casey’s picture

Title: We need a general principle on usage of jQuery's namespaced events » We need guidelines on usage of DOM events and jQuery's namespaced events

We also need guidelines on names of custom DOM events.

I suggest using "drupal{ModuleName}{Event}"

casey’s picture

Note #445130: Namespace the Drupal jQuery functions where extensions of the jQuery object are prefixed with "drupal". so "drupal{FunctionName}".

casey’s picture

Issue tags: +Needs documentation

I think we should include this in JavaScript coding standards.

nod_’s picture

Version: 7.x-dev » 8.x-dev
Category: bug » task

Totally, and I'd like to include #1446166: Use JS events instead of Drupal.behaviors into how we'll go about this.

nod_’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#1778828: [policy, no patch] Update JS coding standards