Skip to content

jQuery UI: Article on the classes option #727

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

Closed
wants to merge 2 commits into from

Conversation

scottgonzalez
Copy link
Member

This is an update to #574 based on the feedback on that PR.

Copy link
Member

@arschmitz arschmitz left a comment

Choose a reason for hiding this comment

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

Over all this looks good to me. Wondering if it's worth adding examples of retrieving current value and setting a value ( other then null ) after init. These are not any different then other widgets but just for the sake of completeness of the article.

I'm fine either way just throwing this out there.


There are two changes to note here. The first is the specification of the `classes` property in the `options` object. This configures the default mapping of structural class names to presentational class names. Here the structural `custom-red-box` class name is mapped to a presentational `ui-corner-all` class name.

The second thing to note is the use of the widget factory's new `_addClass()` and `_removeClass()` methods. The methods are shorthands that accept a structural class name and apply it, and its associated presentational class names, to an element. You can specify the element by passing it as the first argument of `_addClass()`/`_removeClass()` (or `_toggleClass()`, which hasn't been mentioned yet, but it also available), or you can omit the element as this example does, in which case the classes are applied to or removed from the widget's main element (`this.element`). For more examples of how these methods work, refer to the API documentation of [`_addClass()`]((http://api.jqueryui.com/jquery.widget/#method-_addClass), [`_removeClass()`]((http://api.jqueryui.com/jquery.widget/#method-_removeClass), and [`_toggleClass()`]((http://api.jqueryui.com/jquery.widget/#method-_toggleClass).
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't exist in the article. I removed this whole section.

@agcolom
Copy link
Member

agcolom commented Sep 15, 2016

Sorry for the comments on text that has now been removed!

@scottgonzalez
Copy link
Member Author

I merged as is, since @arschmitz approved. We can always add more, but I want to get our release announced ASAP.

@scottgonzalez scottgonzalez deleted the classes branch September 15, 2016 14:21
@arschmitz
Copy link
Member

👍 💯

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

Successfully merging this pull request may close these issues.

5 participants