Skip to content

Commit

Permalink
Tag the 2.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Feb 11, 2012
1 parent fefeb21 commit 4e2a345
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
31 changes: 14 additions & 17 deletions jquery.placeholder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! http://mths.be/placeholder v2.0.1 by @mathias */
/*! http://mths.be/placeholder v2.0.2 by @mathias */
;(function(window, document, $) {

var isInputSupported = 'placeholder' in document.createElement('input'),
Expand Down Expand Up @@ -26,7 +26,7 @@
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('jquery-placeholder-enabled', true)
.data('placeholder-enabled', true)
.trigger('blur.placeholder').end();
};

Expand All @@ -35,23 +35,20 @@

hooks = {
'get': function(element) {
var $element = $(element),
isPlaceholderEnabled = $element.data('jquery-placeholder-enabled');
return (isPlaceholderEnabled && $element.hasClass('placeholder')) ? '' : element.value;
var $element = $(element);
return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
},
'set': function(element, value) {
var $element = $(element)
isPlaceholderEnabled = $element.data('jquery-placeholder-enabled');
if (isPlaceholderEnabled) {
if (value == '') {
element.value = value;
// We can’t use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
} else if ($element.hasClass('placeholder')) {
clearPlaceholder.call(element, true, value) || (element.value = value);
} else {
element.value = value;
}
var $element = $(element);
if (!$element.data('placeholder-enabled')) {
return $element.value = value;
}
if (value == '') {
element.value = value;
// We can’t use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
} else if ($element.hasClass('placeholder')) {
clearPlaceholder.call(element, true, value) || (element.value = value);
} else {
element.value = value;
}
Expand Down
4 changes: 2 additions & 2 deletions jquery.placeholder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e2a345

Please sign in to comment.