Search and Top Navigation
#10145 closed bug (fixed)
Opened July 08, 2014 06:49PM UTC
Closed July 29, 2014 05:18PM UTC
Last modified July 29, 2014 05:18PM UTC
Selectmenu: Incorrect size when original select has CSS width 100%
Reported by: | spjonez | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.1 |
Component: | ui.selectmenu | Version: | 1.11.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Select list does not use the correct size when placed in an inline-block container with a specific width and the original select is set to width 100%.
Fiddle: http://jsfiddle.net/Mwzhs/
Attachments (0)
Change History (5)
Changed July 08, 2014 08:16PM UTC by comment:1
_comment0: | To fix this bug make the following two changes: \ \ Move lines 82/83 to under this._setOption( "width", this.options.width ); currently the box is hidden before the width is calculated so outerWidth reports an incorrect size. \ \ In the original there is a slight difference in this code, the set is this.button.width and in 1.11 it's outerWidth. I tested both versions and it's a few pixels off with outerWidth. \ \ if ( key === "width" ) { \ if ( !value ) { \ value = this.element.outerWidth(); \ } \ this.button.outerWidth( value ); \ } \ → 1404850743820054 |
---|---|
_comment1: | To fix this bug make the following two changes: \ \ Move lines 82/83 to under this._setOption( "width", this.options.width ); currently the box is hidden before the width is calculated so outerWidth reports an incorrect size. \ \ In the original there is a slight difference in this code, the original used this.button.width and in 1.11 it's outerWidth. I tested both versions and it's a few pixels off with outerWidth. It should be this: \ \ if ( key === "width" ) { \ if ( !value ) { \ value = this.element.outerWidth(); \ } \ \ this.button.width( value ); //change from outerWidth to width \ } \ → 1404850782615239 |
_comment2: | To fix this bug make the following two changes: \ \ Move lines 82/83 under this._setOption( "width", this.options.width ); currently the box is hidden before the width is calculated so outerWidth reports an incorrect size. \ \ In the original there is a slight difference in this code, the original used this.button.width and in 1.11 it's outerWidth. I tested both versions and it's a few pixels off with outerWidth. It should be this: \ \ if ( key === "width" ) { \ if ( !value ) { \ value = this.element.outerWidth(); \ } \ \ this.button.width( value ); \ → 1404850860532118 |
_comment3: | To fix this bug make the following two changes: \ \ Move lines 82/83 under this._setOption( "width", this.options.width ); currently the box is hidden before the width is calculated so outerWidth reports an incorrect size. \ \ In the original there is a slight difference in this code, the original set this.button.width and in 1.11 it sets outerWidth. I tested both versions and it's a few pixels off with outerWidth. It should be this: \ \ if ( key === "width" ) { \ if ( !value ) { \ value = this.element.outerWidth(); \ } \ \ this.button.width( value ); \ } → 1404851067161817 |
Changed July 10, 2014 01:04PM UTC by comment:2
status: | new → open |
---|---|
summary: | Incorrect size when original select has CSS width 100% → Selectmenu: Incorrect size when original select has CSS width 100% |
This seems reasonable to me as calling
.width()and
.outerWidth()on the original
<select>element in this test case both return 300.
Changed July 29, 2014 02:41PM UTC by comment:3
Changed July 29, 2014 05:18PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | open → closed |
Selectmenu: Properly set width for button
Fixes #10145
Closes gh-1296
Changeset: 45e13ed208b3533e91d008789d61e5138501428a
Changed July 29, 2014 05:18PM UTC by comment:5
milestone: | none → 1.11.1 |
---|
To fix this bug make the following two changes:
Move lines 82/83 under this._setOption( "width", this.options.width ); currently the original element is hidden before the width is calculated so outerWidth reports an incorrect size.
In the original there is a slight difference in this code, the original set this.button.width and in 1.11 it sets outerWidth. I tested both versions and it's a few pixels off with outerWidth. It should be this:
if ( key === "width" ) {
if ( !value ) {
value = this.element.outerWidth();
}
this.button.width( value );
}