#7238 closed bug (fixed)
Problem with accordion slide animation fixed width calculation
Reported by: | ts2do | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.8.17 |
Component: | ui.accordion | Version: | 1.8.11 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The affected code is as follows according to the master branch in github:
s.width( parseInt( s.parent().width(), 10 ) - parseInt( s.css( "paddingLeft" ), 10 ) - parseInt( s.css( "paddingRight" ), 10 ) - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 ) - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
The problem lies in parsing the paddings and border widths as integers. Both of these elements can be defined using units other than px, allowing the call to .css()
to return a floating value (e.g. 30.8px in my own project). Because of the truncation from parseInt, the width ends up being larger than the actual static width.
Here's the fix:
s.width( s.parent().width() - parseFloat( s.css( "paddingLeft" ) ) - parseFloat( s.css( "paddingRight" ) ) - ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 ) - ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) );
I also removed the first parseInt because .width()
already returns a numeric value.
Change History (5)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Accordion: Fixed #7238 - Problem with accordion slide animation fixed width calculation
Changeset: 124cf3cc6c9bf182563e2fe0663cdde497700f7b
comment:3 Changed 11 years ago by
Merge pull request #517 from MGaetan89/bug_7238
Accordion: Fixed #7238 - Problem with accordion slide animation fixed wid
Changeset: 900514ad0f1d54291dcbd105df44d4c766e813bd
comment:4 Changed 11 years ago by
Accordion: Fixed #7238 - Problem with accordion slide animation fixed width calculation (cherry picked from commit 124cf3cc6c9bf182563e2fe0663cdde497700f7b)
Changeset: 9a87c1a72ea298170f4b9bffcecdb4d80ee4b5cc
comment:5 Changed 11 years ago by
Milestone: | 1.9 → 1.8.17 |
---|
I've submitted your fix as a pull request on GitHub : https://github.com/jquery/jquery-ui/pull/517