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

update_mapped_classes fixes #1017

Merged
merged 1 commit into from
Jan 6, 2017

Conversation

SylvainCorlay
Copy link
Member

@SylvainCorlay SylvainCorlay commented Jan 4, 2017

This is a proposal for a fix to #946 .

  1. The reason for that bug is when ProgressView.render is run, model.previous('bar_style') and model.get('bar_style') are both equal to info, so that the difference performed by update_classes is nil, and nothing gets applied.

    So what I did is create an extra set_bar_style which will make the difference with an empty list instead.

    For the non-mapped classes that can be applied, this is what the base DOMWidgetView was doing.

  2. I made class_map a static variable in all the widget views that use one.

  3. In the case of ButtonView, mapped classes and top-level element classes properties both edit the same class list, which causes conflicts. One way to solve this would be to move the button element down in the DOM. @jasongrout what do you think of this?

set_button_style() {
var view = this;
var buttons = this.buttongroup.querySelectorAll('button');
_.each(buttons, function(button) {
Copy link
Member

Choose a reason for hiding this comment

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

Use a () => {} function, and then just use this instead of view.

@jasongrout
Copy link
Member

One way to solve this would be to move the button element down in the DOM. @jasongrout what do you think of this?

Sure, why not?

@jasongrout
Copy link
Member

Other than the conflict and the (minor) comment, this looks good to me.

@SylvainCorlay SylvainCorlay merged commit 05c15a2 into jupyter-widgets:master Jan 6, 2017
@SylvainCorlay SylvainCorlay deleted the mapped-classes branch January 6, 2017 13:44
@jasongrout jasongrout modified the milestone: 6.0 Feb 28, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants