Skip to main content

Bug Tracker

Side navigation

#10403 closed bug (invalid)

Opened October 02, 2011 07:54PM UTC

Closed October 17, 2011 07:48AM UTC

Last modified April 09, 2012 10:15PM UTC

elem.ownerDocument.defaultView throws an "Undefined" Error

Reported by: mppatterson15@gmail.com Owned by: mppatterson15@gmail.com
Priority: low Milestone: None
Component: css Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:
Description

Hi all, please forgive my lack of familiarity with the jQuery code, but I have found a possible bug when trying to use the NivoSlider Plugin. Although I encountered this bug when trying to use the plugin, I believe the error lies in the jQuery code.

[[BR]

When initializing NivoSlider, I received the following error:

Uncaught TypeError: Cannot read property 'defaultView' of undefined

After digging through the jQuery code, I narrowed the issue down to line 6566:

if ( !(defaultView = elem.ownerDocument.defaultView) ) {
    return undefined;
}

I assumed that it was trying to obtain ''defaultView'' from elem.ownerDocument, even though "elem" or "elem.ownerDocument" may not exist. I changed the condition to the following:

if ( typeof elem === 'undefined' || typeof elem.ownerDocument === 'undefined' || !(defaultView = elem.ownerDocument.defaultView) ) {
      return undefined;
}       

... and everything works as expected. No errors, and the plugin works perfectly. I do not consider my code to be an elegant solution, but it may point you in the right direction if you determine this to be an error with jQuery.

Worth noting is that the error appeared in Chrome 14.0.835.186, but not in Firefox 3.6.10. I did not test in any version of IE.

Thank you for your time, and thank you for such an amazing library. P.S: the copyright on jquery.com says "2010" - may want to fix that.

Attachments (0)
Change History (7)

Changed October 02, 2011 07:58PM UTC by timmywil comment:1

component: unfiledcss
owner: → mppatterson15@gmail.com
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed October 17, 2011 07:48AM UTC by trac-o-bot comment:2

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed October 18, 2011 03:03PM UTC by geoff@j2e.com comment:3

Replying to [comment:2 trac-o-bot]:

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

This is the same as Ticket #6865 and ticket #7836, all of which have been closed. YET IT HAS JUST TRAPPED IN MY CODE, so I think all these tickets are valid, and the test should make sure elem.ownerDocument is valid before dereferencing it.

Changed October 22, 2011 11:28AM UTC by mail.dwat001@gmail.com comment:4

I too am getting an error on this line. I am not using any jquery plugins.

jQuery Version:

jQuery 1.6.3 (same line of code, not sure if same line number)

jQuery 1.6.4

Browsers:

Firefox 6.0.2 & 7.0.1

IE 9.0.8112

Chrome 14.0.835

Error message:

elem.ownerDocument is undefined

if ( !(defaultView = elem.ownerDocument.defaultView) ) {

jquery-1.6.4.js (line 6566)

This can be reproduced at the following URL

http://jsfiddle.net/dwat001/SYQJA/19/show/

Steps to reproduce:

Navigate to http://jsfiddle.net/dwat001/SYQJA/19/show/

click on a marker

Mouse over photo in bottom of infoWindow

Wait for larger photo to load & animate to full size,

move mouse out of larger photo

ERROR

I hope that gives you enough information to investigate this bug further.

Changed October 22, 2011 11:57AM UTC by mail.dwat001@gmail.com comment:5

Follow up, I have just tried on jQuery version Edge and got a different error, I'm not sure this is before or after the above line of code is executed

The error I got was on line 1821

invalid 'in' operand thisCache

} else if ( name in thisCache ) {

Surrounding code:

Support space separated names

if ( jQuery.isArray( name ) ) {

name = name;

} else if ( name in thisCache ) {

name = [ name ];

} else {

split the camel cased version by spaces

the variable thisCache === true

This is occurring IE,Chrome and Firefox

http://jsfiddle.net/dwat001/SYQJA/20/show/

Changed April 09, 2012 10:03PM UTC by anonymous comment:6

What a bullshit: some user took the effort to log this bug, with a patch included and then the issue just gets auto-snubbed like that. Shame on you guys! I guess I will have to apply the patch myself to a local copy of the library. Thanks to the original poster for the detailed defect description.

Changed April 09, 2012 10:15PM UTC by dmethvin comment:7

Honestly, guys. This is a bug tracker. Don't send us your broken code and then ask us to debug it, blaming jQuery for whatever programming mistake you have made. The test case above has this code:

    $("#floating-image").mouseleave( function(image){
        $(image)
            .stop()

An event handler is passed an event object as its first argument. Using the name image ***does not magically turn it into an image***.