hailwood / jQuery-Tagit

The Jquery Tagit Plugin transforms an html unordered list into a unique tagging plugin.
264 stars 109 forks source link

Bug: _pasteMetaKeypressed is undefined #44

Closed sfmskywalker closed 12 years ago

sfmskywalker commented 12 years ago

There seems to be a bug in the keyup event handler that I only noticed in IE (other browsers seem to ignore this error). It happens when I backspace tags:

_"pasteMetaKeyPress is undefined".

It looks like this is the problematic code:

this.input.keyup(function (e) {

                if (_pasteMetaKeyPressed && (e.which == 91 || e.which == 86))
                    $(this).blur();

                // timeout for the fast copy pasters
                window.setTimeout(function () {
                    _pasteMetaKeyPressed = e.metaKey;
                }, 250);
            });

Since _pasteMetaKeyPressed is a member of the "self" variable", It can be fixed like this:

this.input.keyup(function (e) {

                if (self._pasteMetaKeyPressed && (e.which == 91 || e.which == 86))
                    $(this).blur();

                // timeout for the fast copy pasters
                window.setTimeout(function () {
                    self._pasteMetaKeyPressed = e.metaKey;
                }, 250);
            });
hailwood commented 12 years ago

As far as I am aware this has been fixed,

sfmskywalker commented 12 years ago

You're right, thanks!