Overlay should use events instead of single callbacks. Currently overlay has three configurable callback of which one is unusable because its implemented by overlay itself (onOverlayClose in the hashchangeHandler).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

casey’s picture

Category: task » bug

This can be considered a bug as at least one of the callbacks is unusable.

casey’s picture

FileSize
4.51 KB

Reroll

cwgordon7’s picture

Status: Needs review » Reviewed & tested by the community

Sounds like a good idea. Patch looks good, applies cleanly, and doesn't break anything, so rtbc. :)

Dries’s picture

Looks good.

+++ modules/overlay/overlay-parent.js	24 Apr 2010 10:12:05 -0000
@@ -319,6 +327,9 @@
 
+  // Allow other scripts to respond to this event.
+  $(document).trigger('drupalOverlayBeforeLoad');

Do we need this event?

casey’s picture

drupalOverlayBeforeLoad allows for example altering the url to load.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Kiphaas7’s picture

Status: Fixed » Active

This isn't good:

from Drupal.overlay.load:

  self.$iframe
    .bind('load.overlay-event', function () {

Since the iframe content get's (re)loaded multiple times, this also means that everytime the iframe loads new content, a new load event is bound.

So after 3 "overlay loads", load.overlay-event has been bound 3 times, and as a consequence at the third iframe load 'drupalOverlayLoad' is called 3 times.

Solution could either be using once() or unbinding right before binding ($something.unbind().bind();)

cwgordon7’s picture

Sorry, isn't that the expected behavior?

cwgordon7’s picture

Assigned: Unassigned » cwgordon7

I'm sorry, I misunderstood the problem. I see. Patch coming.

cwgordon7’s picture

Status: Active » Needs review
FileSize
738 bytes

Here's a patch, just uses .once to avoid attaching it multiple times.

ksenzee’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Nice catch Kiphaas7.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.