From dafd8ee6fe4f13100f11be4cfd791f8b01454c97 Mon Sep 17 00:00:00 2001 From: Rockallite Wulf Date: Mon, 14 Apr 2014 10:11:10 +0800 Subject: [PATCH 1/2] Elminate JSHint warnings --- src/placeholder_polyfill.jquery.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/placeholder_polyfill.jquery.js b/src/placeholder_polyfill.jquery.js index 958aea4..e757c7d 100644 --- a/src/placeholder_polyfill.jquery.js +++ b/src/placeholder_polyfill.jquery.js @@ -12,7 +12,9 @@ * */ +/* globals requestAnimationFrame, cancelAnimationFrame */ (function($) { + 'use strict'; var debug = false, animId; function showPlaceholderIfEmpty(input,options) { @@ -66,7 +68,7 @@ } function stopCheckChange(){ if (window.cancelAnimationFrame) { - cancelAnimationFrame(animId); + cancelAnimationFrame(animId); } } function log(msg){ @@ -106,8 +108,8 @@ } } - if(text === "" || text === undefined) { - text = input[0].attributes["placeholder"].value; + if(text === '' || text === undefined) { + text = input[0].attributes.placeholder.value; } label = input.closest('label'); input.removeAttr('placeholder'); @@ -154,14 +156,14 @@ showPlaceholderIfEmpty(input,o.options); // reformat on window resize and optional reformat on font resize - requires: http://www.tomdeater.com/jquery/onfontresize/ - $(document).bind("fontresize resize", function(){ + $(document).bind('fontresize resize', function(){ positionPlaceholder(placeholder,input); }); // optional reformat when a textarea is being resized - requires http://benalman.com/projects/jquery-resize-plugin/ if($.event.special.resize){ - $("textarea").bind("resize", function(event){ - if ($(this).is(":visible")) { + $('textarea').bind('resize', function(event){ + if ($(this).is(':visible')) { positionPlaceholder(placeholder,input); } event.stopPropagation(); @@ -169,7 +171,7 @@ }); }else{ // we simply disable the resizeablilty of textareas when we can't react on them resizing - $("textarea").css('resize','none'); + $('textarea').css('resize','none'); } if(index >= l-1 && typeof $.attrHooks !== 'undefined'){ @@ -193,7 +195,7 @@ }; } - if (input.is(":focus")) { + if (input.is(':focus')) { onFocusIn(); } }); From 73e63f8bd70a34f4350004576387fc7d36b1e759 Mon Sep 17 00:00:00 2001 From: Rockallite Wulf Date: Mon, 14 Apr 2014 10:21:48 +0800 Subject: [PATCH 2/2] Convert tabs to spaces --- src/placeholder_polyfill.jquery.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/placeholder_polyfill.jquery.js b/src/placeholder_polyfill.jquery.js index e757c7d..a02fb40 100644 --- a/src/placeholder_polyfill.jquery.js +++ b/src/placeholder_polyfill.jquery.js @@ -163,11 +163,11 @@ // optional reformat when a textarea is being resized - requires http://benalman.com/projects/jquery-resize-plugin/ if($.event.special.resize){ $('textarea').bind('resize', function(event){ - if ($(this).is(':visible')) { - positionPlaceholder(placeholder,input); - } - event.stopPropagation(); - event.preventDefault(); + if ($(this).is(':visible')) { + positionPlaceholder(placeholder,input); + } + event.stopPropagation(); + event.preventDefault(); }); }else{ // we simply disable the resizeablilty of textareas when we can't react on them resizing