Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate JSHint warnings #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/placeholder_polyfill.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*
*/

/* globals requestAnimationFrame, cancelAnimationFrame */
(function($) {
'use strict';
var debug = false,
animId;
function showPlaceholderIfEmpty(input,options) {
Expand Down Expand Up @@ -66,7 +68,7 @@
}
function stopCheckChange(){
if (window.cancelAnimationFrame) {
cancelAnimationFrame(animId);
cancelAnimationFrame(animId);
}
}
function log(msg){
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -154,22 +156,22 @@
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")) {
positionPlaceholder(placeholder,input);
}
event.stopPropagation();
event.preventDefault();
$('textarea').bind('resize', function(event){
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
$("textarea").css('resize','none');
$('textarea').css('resize','none');
}

if(index >= l-1 && typeof $.attrHooks !== 'undefined'){
Expand All @@ -193,7 +195,7 @@
};
}

if (input.is(":focus")) {
if (input.is(':focus')) {
onFocusIn();
}
});
Expand Down