Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
javascript
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Jul 2010 at 10:30 UTC
Updated:
30 May 2012 at 17:19 UTC
Jump to comment: Most recent
Comments
Comment #1
andypostI think this could be useful! Patch applies cleanly, tested in FF3.6.7/8 and google chrome 6.0.472.0
Comment #2
sundrupal.textarea-detach.0.patch queued for re-testing.
Comment #3
sundrupal.textarea-detach.0.patch queued for re-testing.
Comment #4
sunComment #5
dave reidJust because someone is upset doesn't mean we have to mark something as won't fix. Someone else is more than welcome to pick up work on a ticket.
Comment #6
sunSounds like D8 material to me.
Comment #7
andypostThis is not API change just a bug fix so let's commiters decide.
Comment #8
sunThanks, but please don't abuse that tag. It should only be used for issues that require attention.
Comment #9
tom_o_t commenteddrupal.textarea-detach.0.patch queued for re-testing.
Comment #10
webchickThis smells like D8 to me too (and the original patch author seems to agree). I wasn't able to find any other core behaviours implementing this method in a quick grep. In any case, it could definitely use some more reviews before committing given the comfort level communicated by the OP, making it not really rtbc yet.
Comment #11
sunAs of now, I agree. Still need to find time to test Wysiwyg module in-depth for Drupal 7.
However, in general, we do not bump bug fixes to D8 yet. This patch is a bug fix, because all Drupal behaviors are expected to detach when they ought to, as that is what Drupal's "JavaScript behavior API" exactly states.
Will try to ping TwoD about this issue.
Comment #12
twodPong...
The patch still applies nicely and works as advertised, with multi-value fields and all that too.
While detaching this particular behavior is most likely not critical (I mean, not even Overlay detaches), it could be convenient. And if documentation states that modules _should_ detach, then this really is a Core bug that needs fixing.
I tested it with some changes to Wysiwyg module to see if we could reuse the behavior easily and it worked pretty well then too, see patch below.
I could only find another detach implementation in file module, and I didn't check to see if anything was relying on those behaviors to be detached, but if this gets in I think it'd be worth considering if not to add detach code to all modules that attach something (and add/modify DOM elements), or change the docs.
Comment #13
webchickAt this point we're < 100 hours away from Drupal 7.0. That's not the kind of time you want to go off on a jaunt adding detach stuff to every module. That sounds like decent clean-up for 8.x though. For 7.x, I'd be happy just fixing the documentation.
The OP isn't clear to me and neither is #12 (though it's a bit clearer) exactly what "bug" this patch is fixing. Is there some limitation where WYSIWYG module can't do something without this patch? If so, could you be more explicit about what this patch actually fixes?
Comment #14
sunUm, no. The current API documentation is correct (but perhaps not 100% clear): we introduced detaching behaviors for D7 to explicitly demand from all Drupal behaviors that are changing the DOM document to detach (revert) their changes. This is nothing new; it was introduced around 1.5 years ago.
Comment #15
twodI think I just thought of a better/simpler example for how Wysiwyg and other modules could benefit from this. I'm not at home so I can't test it or make a patch though.
Since the resize grippie (and anything else that might be in the way) has to be removed when attaching an editor, any event handlers other modules may have registered on it will be lost, see #530288: jQuery events not restored on editor toggle.
If Wysiwyg could just call
Drupal.detachBehaviors(fieldContext, settings, 'unload')andDrupal.attachBehaviors(fieldContext, settings), event handlers and whatnot would be restored (or rather, reinitialized). If there are modules that know their script is compatible with - or specifically written for - WYSIWYG editors, they could be hooked into an "attached" event triggered by Wysiwyg module after it has detached all regular-textarea-behaviors, if they aren't already implemented as plugins (thinking of Image Assist and Insert modules here).Comment #16
nod_All right, grippie this does not exist in 8.x anymore.
Is this still something we want fixed in 7.x?
Comment #17
nod_