Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

'Member not found' error in jquery 1.4.4 when a left click is done on an element with a RightClick qtip event mapped to it #38

Closed
danoman7 opened this issue Jan 10, 2011 · 20 comments
Assignees
Labels

Comments

@danoman7
Copy link

I don't know if this is a defect with qtip2 or jquery. I get this error when I am in IE8. I don't see an obvious error show up in Chrome or FireFox but I don't know those browsers well enough to say there isn't an error.

But given the code that is bombing in jquery seems to be an else clause for IE I assume there is no error raised in those browsers. Below is the segment from jquery that raises the error. I put a comment in [] to show where the error is. In the unminified jquery 1.4.4 it errors on line 2442 character 4

I tend to think it is a jquery defect but I know they always want a streamlined jsfiddle with no plug-ins and I don't know how to trigger this error without qtip2.

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;

    var e = this.originalEvent;
    if ( !e ) {
        return;
    }

    // if preventDefault exists run it on the original event
    if ( e.preventDefault ) {
        e.preventDefault();

    // otherwise set the returnValue property of the original event to false (IE)
    } else {
        e.returnValue = false;  [Danoman2: This is the line that gives the error]
    }
},

Here is a full screen jsfiddle and the share link. It is just a single div with a RightClick qtip tied to it.

http://jsfiddle.net/danoman7/NFy2W/embedded/result/

http://jsfiddle.net/danoman7/NFy2W/

@danoman7
Copy link
Author

I forgot to mention I ran into this because a prototype I am building has a DIV element that has a mouseover qtip, then a RightClick qtip and is also selectable.

I was super excited when I figured out how to get RightClick working, and have it hide the mouseover qtip (although not perfectly yet) when it was invoked.

But then when I tried to LeftClick on the DIVI to select it I got the error above. :(

So I created a watered down prototype that is only the RightClick qtip to pinpoint what is happening for this defect submission.

@Craga89
Copy link
Contributor

Craga89 commented Jan 18, 2011

http://jsfiddle.net/fDavN/107/

This seems to be working fine for me in all browsers...?

@danoman7
Copy link
Author

Hey Craig.

I sent an email directly to you on this. I can't see a way of adding attachments at GitHub so I used email to send you screen grabs of what I am seeing.

@Craga89
Copy link
Contributor

Craga89 commented Apr 4, 2011

This seems to be fixed now, woo :)

@Craga89 Craga89 closed this as completed Apr 4, 2011
@danoman7
Copy link
Author

danoman7 commented Apr 4, 2011

Thanks Craig!

@andymcintosh
Copy link

I am still able to reproduce this error here http://jsfiddle.net/fDavN/107/ in IE 7. Are there any known work arounds?

@Craga89
Copy link
Contributor

Craga89 commented May 23, 2011

Does this occur in the later jQuery versions or just 1.4.4?

@unco
Copy link

unco commented Jun 6, 2011

This should be reopened.. this is occurring for me too. Only in IE 1.8 (im using jquery 1.5.*)

@Craga89
Copy link
Contributor

Craga89 commented Jun 7, 2011

I'm not seeing this on any of me IE installs... are you sure the error you're referring to isn't from the jsfiddle page itself? As I get do get errors when running it in the results pane, but none running it directly: http://jsfiddle.net/fDavN/107/show/result/

@unco
Copy link

unco commented Jun 7, 2011

Hi Craig, yes I'm sure its not from the jsfiddle site.. this is a local (non public) server using the google hosted jquery 1.5 and the error only occurs for me in IE8. I was trying not to display empty titles via the config but in the end I avoided the problem by altering the toggle function to set state to false and type to hide if the title was empty.

@Craga89
Copy link
Contributor

Craga89 commented Jun 7, 2011

Does the error occur on the results page I listed?

@unco
Copy link

unco commented Jun 7, 2011

yes.. right click works as expected left click breaks with the message something similar to 'member not found'

@Craga89
Copy link
Contributor

Craga89 commented Jun 7, 2011

This seems to be an issue with how jQuery handles nested event.originalEvent. It's fixed in 1.6 but the easiest way around it is to use a try/catch block. See: http://jsfiddle.net/XHCXb/15/

The tutorial on right-click detection has been updated with the new code.

@unco
Copy link

unco commented Jun 7, 2011

Am I reading that right in that there is no preventDefault solution for IE8 then til jquery 1.6.. I should stay with my hack?

@Craga89
Copy link
Contributor

Craga89 commented Jun 7, 2011

Oh preventDefault() does work, it's just that when you have multiple nested originalEvent properties inside your custom events, it causes a problem since jQuery <1.6 assumes all originalEvent objects are primary event objects and tries to set returnValue property for it, even though it might not be there, hence the "Member not found" error!

Try try/catch just stops it throwing an error when setting a deeply nested object property, but still actually prevents the default action:)

@ptquang86
Copy link

jquery 1.7.2 + qtip2 Mon Jun 18 08:09:07.0000000000 2012
still got this error on IE8

@aphofstede
Copy link

Same in 1.7.2. Code:

        var _s = $('#group_filter');
        var _to;
        _s.change(function(event){
            clearTimeout(_to);
            _to = setTimeout(function(){
                event.preventDefault();
                // Do stuff
            }, 2000 );
            return false;
        });

@sattes-faction
Copy link

Can reproduce this error in IE8, jQuery 1.8.2 and qTip version of today:

    $.fn.qtip.defaults = $.extend(true, {}, $.fn.qtip.defaults, {
        events: {
            // only show tooltips if title or copyright exists
            show: function(event, api) {
                if (api.elements.target.data('title') === '') {
                    event.preventDefault();
                }
            }
        }, ...

Maybe this is related to this jQuery bug.

The jQuery error handler preventDefault is called twice. At the first call everything is fine, but at the second call (because it's bubbling up somewhere?) the event object is missing some of its properties which then raises this error.

@Craga89
Copy link
Contributor

Craga89 commented Oct 17, 2012

The best way to get around this is so simply try/catch it, until jQuery core fix it

@sattes-faction
Copy link

I now solved it with a more narrow element selection:

$('.tooltip[data-title!=""]').qtip();

This made the show event unnecessary then.

@ghost ghost assigned Craga89 Nov 27, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants