Skip to content

Classes#1411

Closed
arschmitz wants to merge 36 commits into
jquery:masterfrom
arschmitz:classes
Closed

Classes#1411
arschmitz wants to merge 36 commits into
jquery:masterfrom
arschmitz:classes

Conversation

@arschmitz
Copy link
Copy Markdown
Member

This addes a new built in option to the widget factory classes which maps structural classes to theme classes. To make this possible it introduces three new documented widget methods _addClass, _removeClass, and _toggleClass.

Comment thread ui/widget.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

jQuery's add method order elements by DOM position, even when detached. I don't know the exact complexity of that method, but its very slow for more than a handful of elements. Is there a way to avoid using add completely?

If not, what are the odds for current containing more than 1, 10 and 100 elements?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Whenever .not() is used, a new jQuery instance is needed with no stack to avoid memory leaks. See _off() for an example.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can avoid the ordering slowness with (untested):

current = $( $.unique( current.get().concat( element.get() ) ) );

This would have decent parity with the required .not() handling too :-P

@jzaefferer
Copy link
Copy Markdown
Member

Since the empty default classes are gone, can you start a list somewhere that list all the properties for each classes option for each widget? We can then use that for the API docs.

Comment thread ui/widget.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this trying to clone a jQuery instance?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Extraneous space after =.

Comment thread ui/menu.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Existing issue, should probably address it here anyway: This call duplicates parts of refresh(), which is called later in this method. Maybe there is a reason for the duplication, but I guess that its just an oversight. If so, this line should be dropped.

@arschmitz arschmitz closed this in c192d40 Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
arschmitz added a commit that referenced this pull request Mar 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants