Index: compact_forms.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/compact_forms/compact_forms.js,v
retrieving revision 1.7
diff -u -p -r1.7 compact_forms.js
--- compact_forms.js	30 Sep 2009 03:52:36 -0000	1.7
+++ compact_forms.js	5 Aug 2010 05:20:51 -0000
@@ -7,9 +7,11 @@
  */
 $.fn.compactForm = function (stars) {
   stars = stars || 0;
+  placeholders = 'placeholder' in document.createElement('input');
 
   this.each(function () {
-    $(this).addClass('compact-form').find('label').each(function () {
+    var classes = 'compact-form' + (placeholders ? ' compact-form-html5' : '');
+    $(this).addClass(classes).find('label').each(function () {
       var context = this.form;
       var $label = $(this);
       var $field = $('#' + $label.attr('for'), context);
@@ -17,14 +19,6 @@ $.fn.compactForm = function (stars) {
         return;
       }
 
-      if ($field.val() != '') {
-        $label.fadeOut(1);
-      }
-
-      $label.parent().addClass('compact-form-wrapper');
-      $label.addClass('compact-form-label');
-      $field.addClass('compact-form-field');
-
       if (stars === 0) {
         $label.find('.form-required').hide();
       }
@@ -32,17 +26,32 @@ $.fn.compactForm = function (stars) {
         $label.find('.form-required').insertAfter($field).prepend('&nbsp;');
       }
 
-      $field.focus(function () {
-        if($(this).val() === '') {
-          $label.fadeOut('fast');
-        }
-      });
+      if (placeholders) {
+        $field.attr('placeholder', $label.text());
+        $label.hide();
+      }
+      else {
 
-      $field.blur(function () {
-        if($(this).val() === '') {
-          $label.fadeIn('slow');
+        if ($field.val() != '') {
+          $label.fadeOut(1);
         }
-      });
+
+        $label.parent().addClass('compact-form-wrapper');
+        $label.addClass('compact-form-label');
+        $field.addClass('compact-form-field');
+
+        $field.focus(function () {
+          if($(this).val() === '') {
+            $label.fadeOut('fast');
+          }
+        });
+
+        $field.blur(function () {
+          if($(this).val() === '') {
+            $label.fadeIn('slow');
+          }
+        });
+      }
     });
   });
 };
