diff options
Diffstat (limited to 'libs/bower_components/jquery-placeholder/jquery.placeholder.js')
-rw-r--r-- | libs/bower_components/jquery-placeholder/jquery.placeholder.js | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/libs/bower_components/jquery-placeholder/jquery.placeholder.js b/libs/bower_components/jquery-placeholder/jquery.placeholder.js index c951197961..94e5e2ca11 100644 --- a/libs/bower_components/jquery-placeholder/jquery.placeholder.js +++ b/libs/bower_components/jquery-placeholder/jquery.placeholder.js @@ -1,11 +1,18 @@ -/*! http://mths.be/placeholder v2.0.8 by @mathias */ -;(function(window, document, $) { +/*! http://mths.be/placeholder v2.0.9 by @mathias */ +(function(factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function($) { // Opera Mini v7 doesn’t support placeholder although its DOM seems to indicate so var isOperaMini = Object.prototype.toString.call(window.operamini) == '[object OperaMini]'; var isInputSupported = 'placeholder' in document.createElement('input') && !isOperaMini; var isTextareaSupported = 'placeholder' in document.createElement('textarea') && !isOperaMini; - var prototype = $.fn; var valHooks = $.valHooks; var propHooks = $.propHooks; var hooks; @@ -13,7 +20,7 @@ if (isInputSupported && isTextareaSupported) { - placeholder = prototype.placeholder = function() { + placeholder = $.fn.placeholder = function() { return this; }; @@ -21,7 +28,7 @@ } else { - placeholder = prototype.placeholder = function() { + placeholder = $.fn.placeholder = function() { var $this = this; $this .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') @@ -60,7 +67,7 @@ if (!$element.data('placeholder-enabled')) { return element.value = value; } - if (value == '') { + if (value === '') { element.value = value; // Issue #56: Setting the placeholder causes problems if the element continues to have focus. if (element != safeActiveElement()) { @@ -123,7 +130,7 @@ var $input = $(input); if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) { if ($input.data('placeholder-password')) { - $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id')); + $input = $input.hide().nextAll('input[type="password"]:first').show().attr('id', $input.removeAttr('id').data('placeholder-id')); // If `clearPlaceholder` was called from `$.valHooks.input.set` if (event === true) { return $input[0].value = value; @@ -142,8 +149,8 @@ var input = this; var $input = $(input); var id = this.id; - if (input.value == '') { - if (input.type == 'password') { + if (input.value === '') { + if (input.type === 'password') { if (!$input.data('placeholder-textinput')) { try { $replacement = $input.clone().attr({ 'type': 'text' }); @@ -164,7 +171,7 @@ }) .before($replacement); } - $input = $input.removeAttr('id').hide().prev().attr('id', id).show(); + $input = $input.removeAttr('id').hide().prevAll('input[type="text"]:first').attr('id', id).show(); // Note: `$input[0] != input` now! } $input.addClass('placeholder'); @@ -182,4 +189,4 @@ } catch (exception) {} } -}(this, document, jQuery)); +})); |