Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#8480 closed bug (fixed)

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

Change History (5)

comment:1 Changed 11 years ago by Scott González

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

comment:2 Changed 11 years ago by Scott González

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

comment:3 Changed 11 years ago by Scott González

Milestone: 1.9.01.8.23

comment:4 Changed 11 years ago by crimsondr

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.

Last edited 11 years ago by crimsondr (previous) (diff)

comment:5 Changed 10 years ago by tj.vantoll

#7779 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.