Skip to content

Commit

Permalink
pass jslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Timmy Willison committed Oct 21, 2010
1 parent 1c6f7ea commit e273286
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions jquery.outofplace.js
@@ -1,4 +1,4 @@
/*!
/*
* jquery.outofplace.js
* HTML5 placeholders for all browsers
* Copyright (c) 2010 timmy willison
Expand Down Expand Up @@ -33,7 +33,7 @@
//
// See README for usage

(function ($, window, document, undefined) {
(function ($, window, undefined) {

// Use the HTML5 placeholder attribute at all times.
// Validation will check that the placeholder is not
Expand All @@ -48,8 +48,9 @@
submit: function () {
$(this).find('input, textarea').each(function () {
var $input = $(this);
if($input.val() == $input.data('placeholder'))
if( $input.val() == $input.data('placeholder') ) {
$input.val('');
}
});
return true;
},
Expand All @@ -63,8 +64,8 @@
}, opts);

return this.addClass(opts.placeholderClass).each(function () {
var input = $(this);
var defaultText = input.attr('placeholder') || '';
var input = $(this),
defaultText = input.attr('placeholder') || '';

// Set the placeholder data for future reference
input.data('placeholder', defaultText);
Expand All @@ -73,8 +74,9 @@
input.removeAttr('placeholder');

// Set the value if field is empty
if ($.trim(input.val()) === '')
if ($.trim(input.val()) === '') {
input.val(defaultText);
}

// Focus and blurs, notice the class added and removed
input.focus(function () {
Expand All @@ -90,4 +92,4 @@
.closest('form').submit(opts.submit);
});
};
})(jQuery, this, document);
})(jQuery, this);
2 changes: 1 addition & 1 deletion jquery.outofplace.min.js
Expand Up @@ -6,4 +6,4 @@
* http://timmywillison.com/licence/
*/
(function(b){b.fn.outOfPlace=function(c){c=b.extend({submit:function(){b(this).find("input, textarea").each(function(){var a=b(this);a.val()==a.data("placeholder")&&a.val("")});return true},placeholderClass:"place"},c);return this.addClass(c.placeholderClass).each(function(){var a=b(this),d=a.attr("placeholder")||"";a.data("placeholder",d);a.removeAttr("placeholder");b.trim(a.val())===""&&a.val(d);a.focus(function(){a.val()==d&&a.val("").removeClass(c.placeholderClass)}).blur(function(){b.trim(a.val())===
""&&a.val(d).addClass(c.placeholderClass)}).closest("form").submit(c.submit)})}})(jQuery,this,document);
""&&a.val(d).addClass(c.placeholderClass)}).closest("form").submit(c.submit)})}})(jQuery,this);

0 comments on commit e273286

Please sign in to comment.