After filing this issue #610068: Document AJAX no-js and use-ajax about not understanding how to use the 'use-ajax' class and hacking away trying to figure it out, I finally chatted with merlinofchaos in irc and he explained how it was supposed to work but it was still missing a small piece. Just need to set the event type for links to 'click'.
Attached is a one-line patch.

CommentFileSizeAuthor
#3 ajax_links_615504_01.patch433 bytesrfay
ajax_links.patch812 byteskatbailey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Issue tags: +rfaynovember

subscribing and will review

rfay’s picture

I confirm that this works, and thank you for your example code. It also does not break any of the simple examples in the ajax_example in the Examples module.

However, you say "Just need to set the event type for links to 'click'."

But the patch actually sets the event type for all elements with the class, doesn't it? Might there not be some repercussions of this?

rfay’s picture

FileSize
433 bytes

OK, I took a closer look. element_settings only gets used by the href.

I think perhaps this minor change is clearer about the intent. Patch attached. Still a one-line patch. Does the exact same thing. Moved to a more specific location.

merlinofchaos’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I think I didn't realize that the event in use for links would be wrong. This fixes it to the proper event.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -JavaScript, -Ajax, -rfaynovember

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