Skip to content

Commit

Permalink
bugfix: when clicking anywhere on the screen there was an error in th…
Browse files Browse the repository at this point in the history
…e console
  • Loading branch information
yairEO committed Aug 27, 2019
1 parent 416b49f commit 70bfa37
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ the same values that appear between `[[` & `]]`.

A Tagify React component is exported as `<Tags>` from [`react.tagify.js`](https://github.com/yairEO/tagify/blob/master/dist/react.tagify.js):

Check the [**codepen demo**](https://codepen.io/vsync/project/editor/ARaJye) for a live React integration example
Check the [**live demo**](https://codesandbox.io/s/tagify-react-wrapper-6vd3i) for a live React integration example


## Angular
Expand Down
4 changes: 2 additions & 2 deletions dist/jQuery.tagify.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/tagify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Tagify (v 2.25.1)- tags input component
* Tagify (v 2.25.3)- tags input component
* By Yair Even-Or
* Don't sell this code. (c)
* https://github.com/yairEO/tagify
Expand Down Expand Up @@ -1277,11 +1277,11 @@ Tagify.prototype = {
var value, listItemElm;
if (e.button != 0 || e.target == this.DOM.dropdown) return; // allow only mouse left-clicks

listItemElm = e.target.closest(".tagify__dropdown__item"); // make sure the list item belongs to this context of the Tagify instance (and not some other instance's manual suggestions list)

if (listItemElm.parentNode !== this.DOM.dropdown) return;
listItemElm = e.target.closest(".tagify__dropdown__item");

if (listItemElm) {
// make sure the list item belongs to this context of the Tagify instance (and not some other instance's manual suggestions list)
if (listItemElm.parentNode !== this.DOM.dropdown) return;
value = this.suggestedListItems[this.getNodeIndex(listItemElm)] || this.input.value;
this.addTags([value], true);
setTimeout(function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/tagify.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/tagify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,11 +1302,12 @@ Tagify.prototype = {

listItemElm = e.target.closest(".tagify__dropdown__item");

// make sure the list item belongs to this context of the Tagify instance (and not some other instance's manual suggestions list)
if( listItemElm.parentNode !== this.DOM.dropdown )
return

if( listItemElm ){
// make sure the list item belongs to this context of the Tagify instance (and not some other instance's manual suggestions list)
if( listItemElm.parentNode !== this.DOM.dropdown )
return

value = this.suggestedListItems[this.getNodeIndex(listItemElm)] || this.input.value;
this.addTags([value], true);

Expand Down

0 comments on commit 70bfa37

Please sign in to comment.