jquery-tagit icon indicating copy to clipboard operation
jquery-tagit copied to clipboard

jQuery 1.7.1 support?

Open gangster opened this issue 13 years ago • 2 comments

Hi, I tried using this plugin with jQuery 1.7.1 and encountered the following nastiness:

  Uncaught RangeError: Maximum call stack size exceeded
  Sizzle
  Sizzle
  jQuery.fn.extend.find
  (anonymous function)
  jQuery.event.dispatch
  jQuery.event.add.elemData.handle.eventHandle
  jQuery.event.trigger
  jQuery.fn.extend.trigger
  jQuery.extend.each
  jQuery.fn.jQuery.each
  jQuery.fn.extend.trigger
  jQuery.each.jQuery.fn.(anonymous function)
  (anonymous function)
  etc.
  etc.

Works fine with 1.6.2. Am I doing something wrong or is this a known issue or a new bug?

Thanks!

gangster avatar Feb 06 '12 23:02 gangster

If you comment out lines 157 to 165 this error goes away. Haven't quite worked out why those lines would be causing it yet though, will report back if I find out.

drcongo avatar May 30 '12 11:05 drcongo

You can replace the lines 157 to 165:

                e.bind("focusin", function(event) {
                    $(this)
                        .addClass("focused")
                        .find("input[type=text]")
                            .focus();
                }).bind("focusout", function(event) {
                    $(this).removeClass("focused");
                    input.val("");
                });

by those:

                e.bind("focusin", function(event) {

                    $(this)
                        .addClass("focused")
                        .find("input[type=text]")
                            .focus(function (event) {
                                    event.stopPropagation();
                                    }).focus();
                })
                .bind("focusout", function(event) {
                    $(this).removeClass("focused");
                });

That stops the event propagation to avoid resending the focus event (when the input is focused by line 160).

When the focus is out, the input should not be cleared, instead it should be cleared when we select a tag from the autocomplete:

after the line 258:

                        $(e).tagit("addTag", target.text());

add this line:

                        $(e).find("input[type=text]").val("");

arthursw avatar Jun 07 '12 10:06 arthursw