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

Selectmenu: Add classes option #8309

Conversation

@gabrielschulhof
Copy link
Contributor

gabrielschulhof commented Oct 17, 2015

No description provided.

@arschmitz
Copy link
Member

arschmitz commented Oct 18, 2015

@gabrielschulhof were you wanting a review of this

@gabrielschulhof gabrielschulhof force-pushed the gabrielschulhof:7731-selectmenu-classes-option branch 2 times, most recently from cd1e657 to e7f778d Nov 5, 2015
@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Nov 10, 2015

@arschmitz I've made a few more changes and I could use a review although I'm fairly certain it's not ready to go yet, but it'll be good to have another set of eyes on it so I have a clear list of what remains to be done. TIA!

@@ -79,16 +94,24 @@ return $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
}

if ( event.type === "vclick" ||
event.keyCode && ( event.keyCode === $.mobile.keyCode.ENTER || event.keyCode === $.mobile.keyCode.SPACE ) ) {
event.keyCode &&
( event.keyCode === $.mobile.keyCode.ENTER ||

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

use $.ui.keyCode this is deprecated


this._decideFormat();
if ( this.menuType === "overlay" ) {
this.button.attr( "href", "#" + this.popupId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );
this.button
.attr( "href", "#" + this.popupId )

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

is popupId escaped elsewhere?

This comment has been minimized.

Copy link
@gabrielschulhof

gabrielschulhof Dec 22, 2015

Author Contributor

No, and it doesn't need to be, because I'm not constructing a selector with it.

this.button.attr( "href", "#" + this.popupId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );
this.button
.attr( "href", "#" + this.popupId )
.attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

ns is deprecated move determining this to backcompat and make an extension point

} else {
this.button.attr( "href", "#" + this.dialogId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
this.button
.attr( "href", "#" + this.dialogId )

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

same as above is this escaped

this.button.attr( "href", "#" + this.dialogId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
this.button
.attr( "href", "#" + this.dialogId )
.attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

move to backcompat

"<div class='ui-title'></div>" +
"</div>" +
"<div class='ui-content'></div>" +
menuPage = $( "<div data-" + $.mobile.ns + "role='dialog'>" +

This comment has been minimized.

Copy link
@arschmitz

arschmitz Nov 19, 2015

Member

move to backcompat


// Custom selects cannot exist inside popups, so revert the "nativeMenu" option to true if
// a parent is a popup
o.nativeMenu = o.nativeMenu || ( this.element.parents( ":jqmData(role='popup'),:mobile-popup" ).length > 0 );
o.nativeMenu = o.nativeMenu ||
( this.element.parents( ":jqmData(role='popup'),:mobile-popup" ).length > 0 );

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

dont use jqmdata its deprecated.

var self = this,
$window = this.window,
selfListParent = self.list.parent(),
var $window = this.window,

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

remove hungarian notation


// For WebOS/Opera Mini (set lastscroll using button offset)
if ( scrollTop === 0 && buttonOffset > screenHeight ) {
self.thisPage.one( "pagehide", function() {

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

pagehide is deprecated

$( this ).jqmData( "lastScroll", buttonOffset );
} );
}

self.menuPage.one( {
this.menuPage.one( {
pageshow: $.proxy( this, "_focusMenuItem" ),
pagehide: $.proxy( this, "close" )

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

use page container events

if ( needPlaceholder &&
( !option.getAttribute( "value" ) ||
text.length === 0 ||
$option.jqmData( "placeholder" ) ) ) {

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

dont use jqmdata

@@ -320,4 +334,6 @@ return $.widget( "mobile.selectmenu", $.extend( {
}
}, $.mobile.behaviors.formReset ) );

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

use UI form reset and also $.widget now supports mixins via passing an array

// suffix. See https://github.com/jquery/jquery-mobile/issues/3577
// if ( $el[0].className.length ) {
// classes = $el[0].className;
// }

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

this is no longer relavent

classes += " ui-mini";
}
this._removeClass( this.element, null, "ui-button-left ui-button-right" );
this.select = this.element;

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

whats the point of this.select if its always this.element?

}
},

_create: function() {
var options = this.options,
iconpos = options.icon ?
( options.iconpos || this.select.jqmData( "iconpos" ) ) : false;

This comment has been minimized.

Copy link
@arschmitz

arschmitz Dec 3, 2015

Member

dont use jqmData

@arschmitz
Copy link
Member

arschmitz commented Dec 3, 2015

Looking good done for now

@gabrielschulhof gabrielschulhof force-pushed the gabrielschulhof:7731-selectmenu-classes-option branch from 15f9447 to 33a5648 Jun 18, 2016
@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Jun 19, 2016

@arschmitz we have a load order race condition in kitchensink which seems to reliably manifest itself with core 1.9.1 in this PR. Aside from that it should be golden. I'll try to look into it whenever I get a chance.

@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Jun 19, 2016

@arschmitz nm, using a $.Deferred(). Lessee...

@gabrielschulhof
Copy link
Contributor Author

gabrielschulhof commented Jun 19, 2016

Yaaaay! Tests are now no worse than 1.5-dev!

@arschmitz
Copy link
Member

arschmitz commented Jun 22, 2016

👍

gabrielschulhof added a commit that referenced this pull request Jun 23, 2016
@apsdehal
Copy link
Member

apsdehal commented Jun 23, 2016

Awesome! @gabrielschulhof landed this in 1.5-dev.

@apsdehal apsdehal closed this Jun 23, 2016
arschmitz added a commit to arschmitz/jquery-mobile that referenced this pull request Jul 4, 2016
arschmitz added a commit that referenced this pull request Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.