From 345c7e6cd1c287127ac3cb20417960b6b09a7e47 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 7 Jul 2011 19:30:12 +0200 Subject: [PATCH] Get rid of an unused argument in `setPlaceholder()`. Also, shorten the header comment a bit. --- jquery.placeholder.js | 12 ++++-------- jquery.placeholder.min.js | 8 ++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/jquery.placeholder.js b/jquery.placeholder.js index aca462a..9110d2d 100644 --- a/jquery.placeholder.js +++ b/jquery.placeholder.js @@ -1,8 +1,4 @@ -/*! - * HTML5 Placeholder jQuery Plugin v1.8.3 - * @link http://mths.be/placeholder - * @author Mathias Bynens - */ +/*! http://mths.be/placeholder v1.8.4 by @mathias */ ;(function($) { var isInputSupported = 'placeholder' in document.createElement('input'), @@ -69,7 +65,7 @@ } } - function setPlaceholder(elem) { + function setPlaceholder() { var $replacement, $input = $(this), $origInput = $input, @@ -78,9 +74,9 @@ if ($input.is(':password')) { if (!$input.data('placeholder-textinput')) { try { - $replacement = $input.clone().attr({ type: 'text' }); + $replacement = $input.clone().attr({ 'type': 'text' }); } catch(e) { - $replacement = $('').attr($.extend(args(this), { type: 'text' })); + $replacement = $('').attr($.extend(args(this), { 'type': 'text' })); } $replacement .removeAttr('name') diff --git a/jquery.placeholder.min.js b/jquery.placeholder.min.js index b42e45f..822fed3 100644 --- a/jquery.placeholder.min.js +++ b/jquery.placeholder.min.js @@ -1,6 +1,2 @@ -/*! - * HTML5 Placeholder jQuery Plugin v1.8.3 - * @link http://mths.be/placeholder - * @author Mathias Bynens - */ -(function(f){var e='placeholder' in document.createElement('input'),a='placeholder' in document.createElement('textarea');if(e&&a){f.fn.placeholder=function(){return this};f.fn.placeholder.input=f.fn.placeholder.textarea=true}else{f.fn.placeholder=function(){return this.filter((e?'textarea':':input')+'[placeholder]').bind('focus.placeholder',b).bind('blur.placeholder',d).trigger('blur.placeholder').end()};f.fn.placeholder.input=e;f.fn.placeholder.textarea=a;f(function(){f('form').bind('submit.placeholder',function(){var g=f('.placeholder',this).each(b);setTimeout(function(){g.each(d)},10)})});f(window).bind('unload.placeholder',function(){f('.placeholder').val('')})}function c(h){var g={},i=/^jQuery\d+$/;f.each(h.attributes,function(k,j){if(j.specified&&!i.test(j.name)){g[j.name]=j.value}});return g}function b(){var g=f(this);if(g.val()===g.attr('placeholder')&&g.hasClass('placeholder')){if(g.data('placeholder-password')){g.hide().next().attr('id',g.removeAttr('id').data('placeholder-id')).show().focus()}else{g.val('').removeClass('placeholder')}}}function d(h){var l,k=f(this),g=k,j=this.id;if(k.val()===''){if(k.is(':password')){if(!k.data('placeholder-textinput')){try{l=k.clone().attr({type:'text'})}catch(i){l=f('').attr(f.extend(c(this),{type:'text'}))}l.removeAttr('name').data('placeholder-password',true).data('placeholder-id',j).bind('focus.placeholder',b);k.data('placeholder-textinput',l).data('placeholder-id',j).before(l)}k=k.removeAttr('id').hide().prev().attr('id',j).show()}k.addClass('placeholder').val(k.attr('placeholder'))}else{k.removeClass('placeholder')}}}(jQuery)); \ No newline at end of file +/*! http://mths.be/placeholder v1.8.4 by @mathias */ +(function($){var e='placeholder' in document.createElement('input'),a='placeholder' in document.createElement('textarea');if(e&&a){$.fn.placeholder=function(){return this};$.fn.placeholder.input=$.fn.placeholder.textarea=true}else{$.fn.placeholder=function(){return this.filter((e?'textarea':':input')+'[placeholder]').bind('focus.placeholder',b).bind('blur.placeholder',d).trigger('blur.placeholder').end()};$.fn.placeholder.input=e;$.fn.placeholder.textarea=a;$(function(){$('form').bind('submit.placeholder',function(){var f=$('.placeholder',this).each(b);setTimeout(function(){f.each(d)},10)})});$(window).bind('unload.placeholder',function(){$('.placeholder').val('')})}function c(g){var f={},h=/^jQuery\d+$/;$.each(g.attributes,function(k,j){if(j.specified&&!h.test(j.name)){f[j.name]=j.value}});return f}function b(){var f=$(this);if(f.val()===f.attr('placeholder')&&f.hasClass('placeholder')){if(f.data('placeholder-password')){f.hide().next().attr('id',f.removeAttr('id').data('placeholder-id')).show().focus()}else{f.val('').removeClass('placeholder')}}}function d(){var j,i=$(this),f=i,h=this.id;if(i.val()===''){if(i.is(':password')){if(!i.data('placeholder-textinput')){try{j=i.clone().attr({type:'text'})}catch(g){j=$('').attr($.extend(c(this),{type:'text'}))}j.removeAttr('name').data('placeholder-password',true).data('placeholder-id',h).bind('focus.placeholder',b);i.data('placeholder-textinput',j).data('placeholder-id',h).before(j)}i=i.removeAttr('id').hide().prev().attr('id',h).show()}i.addClass('placeholder').val(i.attr('placeholder'))}else{i.removeClass('placeholder')}}}(jQuery)); \ No newline at end of file