Ticket #11190 (closed bug: invalid)
$(exp).data() yields syntax error - unrecognized expression
| Reported by: | jasonburke@… | Owned by: | jasonburke@… |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I'm trying to use the data() function in assigning data to specific dom elements that is returned as json and I'm receiving the following error in Firebug:
""Syntax error, unrecognized expression: . data(elem=div#ui-datepicker-div.ui-datepicker✉, name=undefined, data=undefined, pvt=true)OmNzo9...p2TA.js (line 1666) _data(elem=div#ui-datepicker-div.ui-datepicker✉, name=undefined, data=undefined)OmNzo9...p2TA.js (line 1847) add(elem=div#ui-datepicker-div.ui-datepicker✉, types="mouseout", handler=function(), data=null, selector=undefined)OmNzo9...p2TA.js (line 2849) (?)()OmNzo9...p2TA.js (line 3718) each(object=jQuery(div#ui-datepicker-div.ui-datepicker✉), callback=function(), args=undefined)OmNzo9...p2TA.js (line 658) each(callback=function(), args=undefined)OmNzo9...p2TA.js (line 271) on(types="mouseout", selector=undefined, data=null, fn=function(), one=undefined)OmNzo9...p2TA.js (line 3717) bind(types="mouseout", data=function(), fn=undefined)OmNzo9...p2TA.js (line 3756) N(a=jQuery(div#ui-datepicker-div.ui-datepicker✉))cozmQY...4XXJ.js (line 488) M()cozmQY...4XXJ.js (line 487) M(d=function(), C=undefined)cozmQY...4XXJ.js (line 554) cozmQY8MS7QySFhOmPMMiatlibNLY61rwdkq7L64XXJ.js()cozmQY...4XXJ.js (line 554) [Break On This Error]
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,""
I've traced this down to the following line in jQuery 1.7.1:
Only defining an ID for JS objects if its cache already exists allows the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, isEvents = name === "events";
Change History
comment:2 Changed 17 months ago by dmethvin
- Owner set to jasonburke@…
- Status changed from new to pending
That's fine, just post a test case and we'll take a look.
comment:3 Changed 17 months ago by anonymous
This is the code I was trying to execute:
var assignData = function(data) {
for(var c = 0; c < data.length; c++) {
$('#'+data[c]rna_well?).data('well', data[c]);
}
}
I believe data is undefined in the scenario when this error occurs. I have this function wrapped inside of a module. Let me know if I can offer any further information.
comment:4 Changed 17 months ago by dmethvin
Please give us a fully working example, preferably on jsFiddle.net. Code snippets can't really be debugged.
comment:5 Changed 17 months ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
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!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

this is the first ticket I've submitted to jquery and I will come back later to properly fill out this report