mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Button: Added rtl detection so corner classes would properly be applied to buttonsets. Fixed #6796. jQueryui - buttonset on rtl
This commit is contained in:
parent
c89bbc1839
commit
50a4186ef9
@ -67,4 +67,18 @@ test("buttonset", function() {
|
||||
ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
|
||||
});
|
||||
|
||||
test("buttonset (rtl)", function() {
|
||||
var parent = $("#radio1").parent();
|
||||
// Set to rtl
|
||||
parent.attr("dir", "rtl");
|
||||
|
||||
var set = $("#radio1").buttonset();
|
||||
ok( set.is(".ui-buttonset") );
|
||||
same( set.children(".ui-button").length, 3 );
|
||||
same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 );
|
||||
ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
|
||||
ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") );
|
||||
ok( set.children("label:eq(2)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") );
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
6
ui/jquery.ui.button.js
vendored
6
ui/jquery.ui.button.js
vendored
@ -352,6 +352,8 @@ $.widget( "ui.buttonset", {
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var ltr = this.element.css( "direction" ) === "ltr";
|
||||
|
||||
this.buttons = this.element.find( this.options.items )
|
||||
.filter( ":ui-button" )
|
||||
.button( "refresh" )
|
||||
@ -364,10 +366,10 @@ $.widget( "ui.buttonset", {
|
||||
})
|
||||
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
||||
.filter( ":first" )
|
||||
.addClass( "ui-corner-left" )
|
||||
.addClass( ltr ? "ui-corner-left" : "ui-corner-right" )
|
||||
.end()
|
||||
.filter( ":last" )
|
||||
.addClass( "ui-corner-right" )
|
||||
.addClass( ltr ? "ui-corner-right" : "ui-corner-left" )
|
||||
.end()
|
||||
.end();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user