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

Watch disabled property of option/optgroup elements #4537

Closed

Conversation

letrunghieu
Copy link

@letrunghieu letrunghieu commented Aug 17, 2016

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • Support disabled property on optgroup elements
  • Watch the disabled property on optgroup and option elements so that changes of this property are respected.

Fix #3347, #2306

Demo: https://jsbin.com/moduda/3/edit?html,js,output

@md5
Copy link

md5 commented Sep 7, 2016

It looks like this doesn't cover the case when an already selected option is disabled.

@@ -203,6 +203,14 @@ define([
data = $.data($option[0], 'data');

if (data != null) {
// always update the value of `disabled` property of the option element
data.disabled = $option.prop('disabled');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the solution to this should be very similar, if not the same as, the solution to us handling the cached selected property on elements.

54154c3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a PR that is similar to the mentioned commit: #4818

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denilsonsa I don't think that #4818 handles optgroup elements. You'll notice that @letrunghieu's solution does a bit more. However, neither of these PRs have any tests yet 😦

@alexweissman
Copy link
Contributor

@letrunghieu are you still interested in working on this? I'd like to merge it, but a few things need to be addressed:

  1. Can you address @kevin-brown's review comment?
  2. Can you write some qunit test cases?
  3. Can you remove the changes in dist/ from the PR?

Thanks!

@letrunghieu
Copy link
Author

Hi @alexweissman I am sure interested in working on this issue :) I'll review the code.

@letrunghieu
Copy link
Author

Hi @kevin-brown , @alexweissman , could you review this PR again please?

@alexweissman
Copy link
Contributor

Looking good. Can we avoid the !! method of type coercion? It's a little bit obscure.

@letrunghieu
Copy link
Author

@alexweissman So how to we make sure that the type of the disabled variable is boolean?

@alexweissman
Copy link
Contributor

Is Boolean widely supported?

@denilsonsa
Copy link

Should be, as it is part of JavaScript since (basically) forever: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean

(Hi! I haven't contributed to this project yet; I just wanted to share this relevant link!)

@stale
Copy link

stale bot commented Mar 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jun 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Jun 27, 2019
@stale stale bot closed this Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants