Skip to content

Commit

Permalink
xoxco#186 - Avoid re-initializing tag fields that are already initial…
Browse files Browse the repository at this point in the history
…ized
  • Loading branch information
lucknerjb committed May 30, 2015
1 parent d5f153b commit 972800a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.tagsinput",
"version": "1.3.4",
"version": "1.3.5",
"main": ["src/jquery.tagsinput.js", "src/jquery.tagsinput.css"],
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.tagsinput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jQuery-Tags-Input",
"version": "1.3.4",
"version": "1.3.5",
"description": "",
"main": "jquery.tagsinput.js",
"directories": {
Expand Down
8 changes: 8 additions & 0 deletions src/jquery.tagsinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@
var uniqueIdCounter = 0;

this.each(function() {
// If we have already initialized the field, do not do it again
if (typeof $(this).attr('data-tagsinput-init') !== 'undefined') {
return;
}

// Mark the field as having been initialized
$(this).attr('data-tagsinput-init', true);

if (settings.hide) {
$(this).hide();
}
Expand Down

0 comments on commit 972800a

Please sign in to comment.