Index: compact_forms.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/compact_forms/compact_forms.js,v
retrieving revision 1.6
diff -u -r1.6 compact_forms.js
--- compact_forms.js	6 Aug 2009 20:27:22 -0000	1.6
+++ compact_forms.js	19 Sep 2009 17:29:49 -0000
@@ -1,4 +1,4 @@
-// $Id: compact_forms.js,v 1.6 2009/08/06 20:27:22 sun Exp $
+// $Id: compact_forms.js,v 1.4 2009/05/06 23:43:39 sun Exp $
 
 (function ($) {
 
@@ -6,20 +6,19 @@
  * Compact Forms jQuery plugin.
  */
 $.fn.compactForm = function (stars, colons) {
-  stars = stars || 0;
-  colons = colons || 0;
+  var stars = stars || 0;
+  var colons = colons || 0;
 
-  this.each(function () {
+  this.each(function (index) {
     $(this).addClass('compact-form').find('label').each(function () {
-      var context = this.form;
       var $label = $(this);
-      var $field = $('#' + $label.attr('for'), context);
-      if (!$field.is('input:text,input:password,textarea')) {
+      var $field = $('#' + $label.attr('for'));
+      if ($field.attr('type') != 'text' && $field.attr('type') != 'password') {
         return;
       }
 
       if ($field.val() != '') {
-        $label.fadeOut(1);
+        $label.css('display', 'none');
       }
 
       $label.parent().addClass('compact-form-wrapper');
@@ -40,16 +39,28 @@
       }
 
       $field.focus(function () {
-        if($(this).val() === '') {
+        if ($(this).val() === '') {
           $label.fadeOut('fast');
         }
       });
 
       $field.blur(function () {
-        if($(this).val() === '') {
+        if ($(this).val() === '') {
           $label.fadeIn('slow');
         }
       });
+
+      // Chrome adds his passwords after page load, so we should track it on change.
+      $field.change(function(){
+        if ($(this) != document.activeElement) {
+         if ($(this).val() === '') {
+            $label.fadeIn('fast');
+          }
+          else {
+            $label.css('display', 'none');
+          }
+        }
+      });
     });
   });
 };
@@ -58,7 +69,9 @@
   if (!Drupal.settings || !Drupal.settings.compactForms) {
     return;
   }
-  $('#' + Drupal.settings.compactForms.forms.join(',#'), context).compactForm(Drupal.settings.compactForms.stars, Drupal.settings.compactForms.colons);
+  $.each(Drupal.settings.compactForms.forms, function () {
+    $('#' + this, context).compactForm(Drupal.settings.compactForms.stars, Drupal.settings.compactForms.colons);
+  });
 };
 
 })(jQuery);
