Divide-by-zero error in linear-gradient code #30

Closed
lojjic opened this Issue Jul 15, 2010 · 6 comments

Comments

Projects
None yet
3 participants
Owner

lojjic commented Jul 15, 2010

See forum posting http://css3pie.com/forum/viewtopic.php?f=3&t=4 -- there is a divide-by-zero error when the element has dimensions of zero.

We should probably avoid performing any rendering whatsoever when the element has no dimensions.

Owner

lojjic commented Jul 18, 2010

Also see issue #39 -- this error is reproducible by setting a PIE element's ancestor to display:none.

This issue shouldn't be closed as the error still occurs (and is particularly irritating).

Owner

lojjic commented Nov 25, 2010

You're using the most recent code from GitHub and still seeing this? Can you post a testcase?

hdaley commented Jan 29, 2011

Problem occurring also at line 3133 of the uncompressed .htc when applied to element with no dimensions (display: none)

hdaley commented Jan 29, 2011

Plastered over with the following kludge replacement for line 3133; works in my situation but not sure if would work generally:

if (w > 0 && h > 0) {fill.position = (0.5 / w) + ',' + (0.5 / h)} else {fill.position = '0,0'};

Owner

lojjic commented Jan 29, 2011

This has already been fixed in the latest code: a76770d

@gucong3000 gucong3000 pushed a commit to gucong3000/PIE that referenced this issue Apr 22, 2016

Jason Johnston Don't perform any rendering of backgrounds if the element has a width…
… or height of zero; this prevents a divide-by-zero error in the background-image position calculation and has a performance benefit as well. Fixes issue #30.
bccd249

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment