From 116da9470c64f01cfc2014df6abb265a5790a1ad Mon Sep 17 00:00:00 2001 From: git <git@2562638.no-reply.drupal.org> Date: Wed, 5 Jun 2013 18:29:50 +0200 Subject: [PATCH] Issue #2006340 - All Browsers: The Soft Character Limit Indicators not working when text is pasted in Title field --- soft_length_limit.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/soft_length_limit.js b/soft_length_limit.js index 3ab5ba4..04efe0f 100644 --- a/soft_length_limit.js +++ b/soft_length_limit.js @@ -74,14 +74,22 @@ // Adds the "exceeded" class if the length is less than the minimum, in the case where the minimum is set. // Adds the "under-min" class, for under-character-minimum specific behavior. Used for min/enhanced character count. if (minimum > 0) { - if (val.length < minimum && val.length < limit && !$tooltip.hasClass('exceeded')) { - $tooltip.addClass('exceeded under-min'); - $(this).addClass('exceeded under-min'); - } - else if (val.length <= limit && val.length >= minimum) { - $tooltip.removeClass('exceeded under-min'); - $(this).removeClass('exceeded under-min'); - } + if (val.length < minimum) { + $tooltip.addClass('under-min'); + $(this).addClass('under-min'); + } + if (val.length >= minimum) { + $tooltip.removeClass('under-min'); + $(this).removeClass('under-min'); + } + if (val.length > limit) { + $tooltip.addClass('exceeded'); + $(this).addClass('exceeded'); + } + if (val.length <= limit) { + $tooltip.removeClass('exceeded'); + $(this).removeClass('exceeded'); + } } // The minimal/enhanced version of character limits -- GitLab