uc_aac calls Drupal.attachBehaviors() to notify other modules that the DOM has been changed, however it does not provide a context which limits the usefulness of the attachBehaviors call.

The attached patch supplies the newly created form as the context, allowing modules to better react to the changes. It also only calls ucAacAttach() if the context provided has the class uc-aac-cart, i.e. only if uc_aac replaced the form in the first place. This avoids having ucAacAttach() called twice (once upon page load, once after Drupal.attachBehaviors() called by the initial ucAacCalculate).

CommentFileSizeAuthor
uc_aac-js-context.patch762 bytesstewart.adam

Comments

cybis’s picture

This is awesome and solves a compatibility issue with Ubercart Dependent Attribute. It also makes my ugly mickey mouse patch here #715878: Not aware of changes made by Dependent Attributes irrelevant. Yeah!

stewart.adam’s picture

Any updates on this? It would be great to have this patch committed to dev.

asb’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community

The patch applies cleanly against uc_aac 6.x-2.1:

$ patch -p1 < uc_aac-js-context.patch 
patching file uc_aac.js

Also it still applies against the current uc_aac 6.x-2.x-dev from 2013-Oct-19:

patch -p1 < uc_aac-js-context.patch 
patching file uc_aac.js
Hunk #1 succeeded at 15 (offset -1 lines).
Hunk #2 succeeded at 33 (offset -1 lines).

Are there any objections to commit the patch?