Skip to main content

Search and Top Navigation

#8480 closed bug (fixed)

Opened August 08, 2012 05:29PM UTC

Closed August 09, 2012 08:32PM UTC

Last modified December 06, 2012 08:08PM UTC

Datepicker 1.8.22 escaped id does not work

Reported by: jakecigar Owned by:
Priority: minor Milestone: 1.8.23
Component: ui.datepicker Version: 1.8.22
Keywords: Cc:
Blocked by: Blocking:
Description

This simple datepicker does not work. It works with a simple id. (it worked with 1.8.21)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Untitled Document</title>
		<link href="http://jquery-ui.googlecode.com/svn/tags/1.8.22/themes/pepper-grinder/jquery-ui.css"
		rel="stylesheet" type="text/css" />
		<script src="http://jquery-ui.googlecode.com/svn/tags/1.8.22/jquery-1.7.2.js"></script>
		<script src="http://jquery-ui.googlecode.com/svn/tags/1.8.22/ui/jquery-ui.js"></script>
		<script type="text/javascript">
			$(function () {
				$('#date\\\\[123\\\\]').datepicker();
			});
		</script>
		<style type="text/css">
			.ui-widget
			{
				font-size: .8em;
			}
		</style>
	</head>
	<body>
		<input type="text" id="date[123]" />
	</body>
</html>

http://forum.jquery.com/topic/datepicker-not-working-with-special-characters-in-id-field#14737000003533919

Attachments (0)
Change History (5)

Changed August 09, 2012 08:32PM UTC by Scott González comment:1

resolution: → fixed
status: newclosed

Datepicker: Unescape double escaped ids when handling events. Fixes #8480 - Datepicker 1.8.22 escaped id does not work.

Changeset: 30b579f598a3abdc9b0b7ad18bc76c8b5438d5ca

Changed August 09, 2012 08:32PM UTC by Scott González comment:2

Datepicker: Unescape double escaped ids when handling events. Fixes #8480 - Datepicker 1.8.22 escaped id does not work.

(cherry picked from commit 30b579f598a3abdc9b0b7ad18bc76c8b5438d5ca)

Changeset: b92965a78121534c113b1d717a75cee728548520

Changed August 09, 2012 08:32PM UTC by scottgonzalez comment:3

milestone: 1.9.01.8.23

Changed August 10, 2012 06:42PM UTC by crimsondr comment:4

_comment0: In the current fix you remove the double \\\\. But I think a better fix would be to modify this line: \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\\\\\$1'); // escape jQuery meta chars \ to \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars \ \ Looks like the double \\\\ is being added and then removed for no reason. Should just not add it in the first place. \ \ 1344624273249083
_comment1: In the current fix you remove the double \\\\. But I think a better fix would be to modify this line: \ \ {{{ \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\\\\\$1'); // escape jQuery meta chars \ }}} \ \ to \ \ {{{ \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars \ }}} \ \ \ Looks like the double \\\\ is being added and then removed for no reason. Should just not add it in the first place. \ \ 1344624334635229
_comment2: In the current fix you remove the double backslash. But I think a better fix would be to modify this line: \ \ {{{ \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\\\\\$1'); // escape jQuery meta chars \ }}} \ \ to \ \ {{{ \ var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars \ }}} \ \ \ Looks like the double \\\\ is being added and then removed for no reason. Should just not add it in the first place. \ \ 1344624348489118

In the current fix you remove the double backslash. But I think a better fix would be to modify this line:

var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\\\\\$1'); // escape jQuery meta chars

to

var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars

Looks like the double backslash is being added and then removed for no reason. Should just not add it in the first place.

Changed December 06, 2012 08:08PM UTC by tj.vantoll comment:5

#7779 is a duplicate of this ticket.