Skip to content

Commit

Permalink
Classname checks with parent
Browse files Browse the repository at this point in the history
Since both wrapper and the element itself having the same classes,
before binding, element itself or not control added
  • Loading branch information
bcinarli committed Nov 15, 2014
1 parent 6c04e66 commit 19a72b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/uxrocket.textlimit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,25 @@
};

var setLayout = function($el){
var columns = '',
var columns = ' ' + $el.context.className,
$remaining = $el.siblings(opts.remaining),
chars = opts.maxLength - $el.val().length,
visible = '';

columns = ' ' + $el.context.className;


if(chars < 0){
chars = 0;
}

if(opts.visible === false){
visible = ' uxitd-hide-remaining';
}
if($el.parent().is('.uxitd-plugin-wrap')){
$el.parent().addClass('uxitd-textlimit-wrap' + columns + visible);
}
else {
$el.wrap('<span class="uxitd-plugin-wrap uxitd-textlimit-wrap' + columns + visible + '"></span>');
}

if($el.parent().is('.uxitd-plugin-wrap')){
$el.parent().addClass('uxitd-textlimit-wrap' + columns + visible);
}
else {
$el.wrap('<span class="uxitd-plugin-wrap uxitd-textlimit-wrap' + columns + visible + '"></span>');
}

if($remaining.length < 1){
$el.after('<span title="Kalan karakter sayısı" class="uxitd-textlimit-remaining ' + opts.remaining.substring(1, opts.remaining.length) + '">' + chars + '</span>');
Expand Down Expand Up @@ -115,7 +113,7 @@
var $el = $(this),
limit;

if($el.hasClass('uxitd-textlimit-ready')){
if($el.hasClass('uxitd-textlimit-ready') || $el.hasClass('uxitd-plugin-wrap')){
return;
}

Expand All @@ -127,7 +125,7 @@
};

// version
ux.version = "0.4.0";
ux.version = "0.5.1";

// settings
ux.settings = defaults;
Expand Down
2 changes: 2 additions & 0 deletions version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Versiyon 0.5.1
- FIX: Class kontrolleri yüzünden, eklenecek eleman inputun kendisi mi yoksa değil mi kontrolü eklendi.

0 comments on commit 19a72b9

Please sign in to comment.