Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectHours doesn't use the configured instance of timepicker #40

Open
lookfirst opened this issue Mar 8, 2012 · 2 comments
Open

selectHours doesn't use the configured instance of timepicker #40

lookfirst opened this issue Mar 8, 2012 · 2 comments

Comments

@lookfirst
Copy link

There is a line in selectHours which is causing me a lot of grief....

$target = $(id)

The primary issue is that is supposed to be a pointer to the instance of the timepicker that is configured on a jquery element. In other words, I do something like this:

<div id="id1">
<input id="startDate" />
</div>

<div id="id2">
<input id="startDate" />
</div>
$('#startDate', '#id1').timepicker()
$('#startDate', '#id2').timepicker()

Instead of timepicker internalizing which element has been configured as a timepicker, it just internalizes the selector. It then uses the $target = $(id) line in selectHours() to find the right element. Not only is this inefficient, but it also prevents my code above from working.

I'm not even sure how to fix this as I'm guessing the problem is rampant in the codebase... I see it in selectMinutes() and a few other methods.

@fgelinas
Copy link
Owner

I tried to address your issue a few times and had to rollback every time because I could not get it to work properly.
You are right that this behaviour is deeply integrated in the code and not easily modified.

I suggest you fix this by not having two elements with the same ID as every ID in a document must be unique according to html specifications.

@lookfirst
Copy link
Author

@fgelinas Forget for a moment that I am using duplicate ID's. Just the fact that you're searching multiple times the entire DOM for the ID is a really broken design. It is as silly as someone writing jquery code that looks like this:

$('#myselector').data('foo')
$('#myselector').css('display', 'none')

When it should really be something like this:

$('#myselector').data('foo').css('display', 'none')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants