Needs review
Project:
Autosave
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
15 Jul 2010 at 16:51 UTC
Updated:
6 Aug 2012 at 15:54 UTC
Jump to comment: Most recent file
Comments
Comment #1
aaronbaumanComment #2
buzzman commentedComment #3
liquidcms commentednot actually a "bug" is it? more of a what, theming suggestion? or i guess better adherence to standards?
i'll look at committing in a couple days. Can you point to any documentation on what a Drupal.behaviour is?
Comment #4
galaxor commentedHi. I accidentally did this work as well, before I noticed this bug. That is, I made autosave use Drupal behaviors. My patch slightly different from this one: It only operates on form elements that don't have the 'autosave-processed' css class. Also, after attaching itself, this patch adds the 'autosave-processed' css class to the things it just attached to.
That's a pattern Drupalers use to make sure that if your Behavior gets called more than once on the same object, it won't cause wonkiness.
@liquidcms, here's a document that describes Drupal behaviors: The Drupal Javascript API.
@aaronbauman, I've incorporated your changes to the element ids.
Also, while I was at it, I made it use Drupal.t(). This addresses #669218: Use Drupal.t in autosave.js and #893894: use Drupal's translation mechanism for Javascript files.
Finally, this patch also contains the strongarm compatibility patch I submitted in #850934: Incompatibility with Strongarm module.
Tell me if you would like any of these patches split out, so they can be applied and critiqued separately.
Comment #5
galaxor commentedbtw, my patch is against 6.x-2.9
Comment #6
liquidcms commentedanyone able to review this??
Comment #7
liquidcms commentedi have committed the drupal.behaviours part and the better DOM ids part
not sure what unused var is about