Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1038 from cormacmccarthy/1036---clean-up-pillbox-…
Browse files Browse the repository at this point in the history
…lint-issues

(1036---clean-up-pillbox-lint-issues) cleans up lint warnings Fixes #1036.
  • Loading branch information
interactivellama committed Feb 6, 2015
2 parents c8b1231 + 7f9caac commit 38e00ee
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions js/pillbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@

// First parameter is 1 based index (optional, if index is not passed all new items will be appended)
// Second parameter can be array of objects [{ ... }, { ... }] or you can pass n additional objects as args
// object structure is as follows (index and value are optional): { text: '', value: '' }
// object structure is as follows (attr and value are optional): { text: '', value: '', attr: {}, data: {} }
addItems: function () {
var self = this;
var items, index, isInternal;
Expand All @@ -189,7 +189,7 @@
isInternal = items[1] && !items[1].text;
}

//Accounting for array parameter
//If first argument is an array, use that, otherwise they probably passed each thing through as a separate arg, so use items as-is
if (items[0] instanceof Array) {
items = items[0];
}
Expand All @@ -202,12 +202,12 @@
el: self.$pillHTML
};

if (value['attr']) {
data['attr'] = value.attr;// avoid confusion with $.attr();
if (value.attr) {
data.attr = value.attr;
}

if (value['data']) {
data['data'] = value.data;
if (value.data) {
data.data = value.data;
}

items[i] = data;
Expand Down Expand Up @@ -303,8 +303,8 @@
$item.find('span:first').html(item.text);

// DOM attributes
if (item['attr']) {
$.each(item['attr'], function (key, value) {
if (item.attr) {
$.each(item.attr, function (key, value) {
if (key === 'cssClass' || key === 'class') {
$item.addClass(value);
} else {
Expand All @@ -314,7 +314,7 @@

}

if (item['data']) {
if (item.data) {
$item.data('data', item.data);
}

Expand Down

0 comments on commit 38e00ee

Please sign in to comment.