LeaVerou / LeaVerou/HTML5-Progress-polyfill
Small Issue with borders in progress in polyfilled browsers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 178
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
A small bug appears when a border is applied to the progress bar. If the value of the progress bar is set to zero, the progress bar increases in width slightly, until the value is changed to a non-zero value. You can see what I mean here:
http://www.useragentman.com/tmp/progressPolyfill/test1.html
In order to fix this issue, I changed line 161 in your script from:
if(progress.position !== -1) {
progress.style.paddingRight = progress.offsetWidth *
(1-progress.position) + 'px';
}
to this:
if(progress.position !== -1) {
progress.style.paddingRight = progress.clientWidth *
(1-progress.position) + 'px';
}
(Note the change from offsetWidth to clientWidth). When this is applied, the jump in width doesn't happen anymore, as seen here:
http://www.useragentman.com/tmp/progressPolyfill/test1-fixed.html
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the script around line 161 and compare the reported offsetWidth and clientWidth behavior. Verify the change against the linked test1.html and test1-fixed.html cases; done means a zero-valued progress bar no longer grows slightly when a border is applied in polyfilled browsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100