Side navigation
#8314 closed bug (invalid)
Opened February 18, 2011 07:56AM UTC
Closed February 18, 2011 01:12PM UTC
Last modified March 14, 2012 11:55AM UTC
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 :
#!js if (!elem) return false;
after :
#!js // 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
Attachments (0)
Change History (3)
Changed February 18, 2011 01:12PM UTC by comment:1
component: | unfiled → data |
---|---|
priority: | undecided → low |
resolution: | → invalid |
status: | new → closed |
Changed February 18, 2011 04:15PM UTC by comment:2
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.
Changed February 18, 2011 05:36PM UTC by comment:3
Replying to [comment:2 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
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 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