Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#8314 closed bug (invalid)

acceptData does not check if elem is defined

Reported by: dcz Owned by:
Priority: low Milestone: 1.next
Component: data Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

Hello, I had posted this topic (with no luck) : http://forum.jquery.com/topic/resizable-and-datepick

And the same thing happens with 1.5 : http://jsfiddle.net/wesEy/4/

The same "fix" applies to, eg add :

        if (!elem) return false;

after :

        // A method for determining if a DOM node can handle the data expando
        acceptData: function( elem ) {

Also, it does not seem to be wrong to return false, using : #!js

if (!elem) return true;

}}}

will also throw an error a little later (which seems to mean that indeed no data could be accepted from this null element.

I know the issue seems related to datepicker (I did not find other test cases), but it seems rather sane to me to perform the test on elem in this method.

Regards,

dcz

Change History (3)

comment:1 Changed 9 years ago by jitter

Component: unfileddata
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

I took a quick look at your test case. This is not a jQuery bug. It's a bug in the jQuery plugin you use. It makes incorrect use of the jQuery.data() method, the documentation reads:

element The DOM element to associate with the data.

undefined is not a DOM element.

So garbage in, garbage out. File a ticket with the plugin author.


The big red box on the "New Ticket" page rather clearly states:

For all other jQuery plugins:

This is NOT the correct form! Please use the Plugins site to report your bug to its author.

This tracker you submitted your bug on. is for jQuery core bugs only. Bug reports for plugins should be filed on the plugin site or directly to the respective authors of those plugins. You can also try posting to the correct subforum in the jQuery Forum or in the #jquery irc channel on freenode

comment:2 Changed 9 years ago by dcz

I perfectly get your point about jquery not being necessarily the guilty one, but unfortunately, I could not find out where this guilty call was made in the first place. The funny thing being everything still works despite the error thrown. I contacted datepicker author and also posted in the ui forum with the success you know.

Though, since the fix I found for this was in jquery and since it did not seemed insane to me to add this small line of sanity check, I decided that it was still worth reporting here.

comment:3 in reply to:  2 Changed 9 years ago by jitter

Replying to dcz:

..., but unfortunately, I could not find out where this guilty call was made in the first place.

Not sure what you mean by that. Any debugger in a recent browser will point out directly where the bug happened + stacktrace http://i.imgur.com/XEALR.jpg

Note: See TracTickets for help on using tickets.