Drupal.behaviors.AJAX.attach() doesn't use context

Created on 22 April 2016, over 8 years ago
Updated 31 October 2023, about 1 year ago

As the title says: the Drupal.behaviors.AJAX.attach() method in misc/ajax.js doesn't properly use the context parameter when creating jQuery objects. It is my understanding, that the context should always be used in those cases, and I don't really know why it isn't there.

Since the JS code checks for the ajax-processed class, this will usually not cause any errors, I think – but I currently have a use case where I want to attach behaviors to DOM nodes that aren't currently inside the normal document tree – and thus aren't found if context is ignored.

So, I wanted to know whether there's an actual reason to not use context there. And, if there isn't, it would of course be great if we could fix this.

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
AjaxΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024