jQuery 1.8.1 Error on row deletion when row attribute contains invalid characters for jQuery selectors #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
Archiving repo.