Skip to content
This repository
Browse code

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.
  • Loading branch information...
commit bccd24949d71af344ae4b5ebad32fae39910ebdc 1 parent 4a4246b
Jason Johnston authored

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. +5 3 sources/BackgroundRenderer.js
8 sources/BackgroundRenderer.js
@@ -16,11 +16,13 @@ PIE.BackgroundRenderer = PIE.RendererBase.newRenderer( {
16 16 },
17 17
18 18 isActive: function() {
19   - var si = this.styleInfos;
20   - return si.borderImageInfo.isActive() ||
  19 + var si = this.styleInfos,
  20 + el = this.element;
  21 + return el.offsetWidth && el.offsetHeight && (
  22 + si.borderImageInfo.isActive() ||
21 23 si.borderRadiusInfo.isActive() ||
22 24 si.backgroundInfo.isActive() ||
23   - ( si.boxShadowInfo.isActive() && si.boxShadowInfo.getProps().inset );
  25 + ( si.boxShadowInfo.isActive() && si.boxShadowInfo.getProps().inset ) );
24 26 },
25 27
26 28 updateSize: function() {

0 comments on commit bccd249

Please sign in to comment.
Something went wrong with that request. Please try again.