Search and Top Navigation
#9105 closed bug (notabug)
Opened February 20, 2013 08:42AM UTC
Closed February 20, 2013 12:53PM UTC
Last modified April 25, 2013 12:13PM UTC
Datepicker should not rely on unique element id
Reported by: | obbe | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.datepicker | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The datepicker currently does not work correctly if applied to an element with a non-unique id.
The picker will open as intended, but when date is clicked it may end up in the wrong input element. In some cases nothing at all will happen, expect for console error "s is undefined" ("inst is undefined") when non-minified.
A simple web search for "datepicker non-unique id" will reveal that this is a common problem. It is hard to debug this scenario since non-unique element id does not in itself cause a visible error message, and the message generated from the datepicker is not helpful to discover the true problem.
The datepicker control should be changed so that it does not fail in the presence of non-unique element ids.
If the consensus is that the datepicker should insist on having a unique element id, then it should at least be changed to emit a clear console error, either when being added or when being opened. This would improve developer usability, given that it's now a hard problem to debug.
Attachments (0)
Change History (5)
Changed February 20, 2013 12:53PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
Changed February 20, 2013 01:30PM UTC by comment:2
And yet duplicate ids happens very easily and is hard to debug. Please share your thoughts on the possibility of a warning message to improve on developer usability.
Is the current behavior consistent with the goals of "and a bit of common sense to create a robust and flexible set of UI widgets" and "intuitive API", as described at: http://wiki.jqueryui.com/w/page/12138130/Vision%20and%20Goals
Changed February 20, 2013 04:49PM UTC by comment:3
And yet duplicate ids happens very easily and is hard to debug. Please share your thoughts on the possibility of a warning message to improve on developer usability.
It doesn't matter how common it is. It's invalid. If you want something to yell at you about your code, use a validator. Validating your HTML is not jQuery or jQuery UI's responsibility.
Is the current behavior consistent with the goals of "and a bit of common sense to create a robust and flexible set of UI widgets" and "intuitive API", as described at: http://wiki.jqueryui.com/w/page/12138130/Vision%20and%20Goals
Absolutely. Robust does not mean works with invalid input.
Changed April 25, 2013 12:13PM UTC by comment:5
Replying to [comment:1 scott.gonzalez]:
It's invalid to ever have duplicate IDs in a document.
But how does it affect the datepicker??
It's invalid to ever have duplicate IDs in a document.