Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#10664 closed bug (invalid)

$.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.

Change History (3)

comment:1 Changed 8 years ago by dmethvin

Resolution: invalid
Status: newclosed

Identifying errors like the above is cumbersome.

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.

comment:2 Changed 8 years ago by Rick Waldron

Priority: undecidedlow

comment:3 Changed 8 years ago by gnarf

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, .... )

Note: See TracTickets for help on using tickets.