Side navigation
#10664 closed bug (invalid)
Opened November 04, 2011 11:36AM UTC
Closed November 04, 2011 01:11PM UTC
Last modified March 14, 2012 07:49AM UTC
$.data throws "string.replace is not a function" on invalid input
Reported by: | rodneyrehm | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | unfiled | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$.data($(document.body), {test: 2}, 'yadda');
leads to »string.replace is not a function« on line 622. The given arguments (seeing name={} value='yadda') don't make much sense. $.data() should react accordingly. Either ignore 'yadda' or throw an error of its own. Identifying errors like the above is cumbersome.
A simple return; after Lines 1755 and 1773 could suffice.
Attachments (0)
Change History (3)
Changed November 04, 2011 01:11PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed November 04, 2011 01:35PM UTC by comment:2
priority: | undecided → low |
---|
Changed November 04, 2011 09:45PM UTC by comment:3
I feel the need to point out that there is a MUCH bigger error here...
$.data( $(document.body) )will store data on the jQuery collection object, not the DOM element underneath it. I think you might of meant
$.data( document.body, .... )
True, but catching even a small subset of incorrect invalid arguments being passed to jQuery's methods would expand the code significantly. We aren't going to head down that road.