jQuery 1.8.1 Error on row deletion when row attribute contains invalid characters for jQuery selectors #1

Closed
opened 2012-09-07 08:28:45 -07:00 by HallyM · 1 comment
HallyM commented 2012-09-07 08:28:45 -07:00 (Migrated from github.com)

I recently moved from jQuery 1.7.2 to 1.8.1.
pgrid was working fine in the previous version, but now it triggers an error when I try to delete rows:
"Uncaught Error: Syntax error, unrecognized expression: .xyz" (where xyz is the row's title attribute and contains characters that are invalid for a jQuery selector)

The issue is located in jquery.pgrid.js here:
466: pgrid.mark_for_delete_recursively = function(jq_rows) {
...
470: var cur_title = cur_row.attr("title");
...
472: cur_row.siblings("."+pgrid.pgrid_child_prefix+cur_title).each(function(){

The row's title attribute is likely a multiword string or some other humanly readable value (mine was a court case file number in this form: "1223/45/6789"), so it will usually contain some characters that are invalid as a jQuery selector. Thus, the selector in cur_row.siblings will trigger an error in jQuery 1.8.1 whenever one tries to delete a row which has an invalid title attribute (set by pgrid_add key).

My workaround was to edit jquery.pgrid.js and make cur_title a hardcoded string like:
470: var cur_title = "thisrow";

The same error might also be triggered in other cases when cur_row.attr("title") is used.

P.S. the issue is mentioned in jQuery's bugtracker: http://bugs.jquery.com/ticket/12442

I recently moved from jQuery 1.7.2 to 1.8.1. pgrid was working fine in the previous version, but now it triggers an error when I try to delete rows: "Uncaught Error: Syntax error, unrecognized expression: .xyz" (where xyz is the row's title attribute and contains characters that are invalid for a jQuery selector) The issue is located in jquery.pgrid.js here: 466: pgrid.mark_for_delete_recursively = function(jq_rows) { ... 470: var cur_title = cur_row.attr("title"); ... 472: cur_row.siblings("."+pgrid.pgrid_child_prefix+cur_title).each(function(){ The row's title attribute is likely a multiword string or some other humanly readable value (mine was a court case file number in this form: "1223/45/6789"), so it will usually contain some characters that are invalid as a jQuery selector. Thus, the selector in cur_row.siblings will trigger an error in jQuery 1.8.1 whenever one tries to delete a row which has an invalid title attribute (set by pgrid_add key). My workaround was to edit jquery.pgrid.js and make cur_title a hardcoded string like: 470: var cur_title = "thisrow"; The same error might also be triggered in other cases when cur_row.attr("title") is used. P.S. the issue is mentioned in jQuery's bugtracker: http://bugs.jquery.com/ticket/12442
hperrin commented 2022-12-11 11:14:51 -08:00 (Migrated from github.com)

Archiving repo.

Archiving repo.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sciactive/pgrid#1
No description provided.