Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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 with 5 additions and 3 deletions.
  1. +5 −3 sources/BackgroundRenderer.js
View
8 sources/BackgroundRenderer.js
@@ -16,11 +16,13 @@ PIE.BackgroundRenderer = PIE.RendererBase.newRenderer( {
},
isActive: function() {
- var si = this.styleInfos;
- return si.borderImageInfo.isActive() ||
+ var si = this.styleInfos,
+ el = this.element;
+ return el.offsetWidth && el.offsetHeight && (
+ si.borderImageInfo.isActive() ||
si.borderRadiusInfo.isActive() ||
si.backgroundInfo.isActive() ||
- ( si.boxShadowInfo.isActive() && si.boxShadowInfo.getProps().inset );
+ ( si.boxShadowInfo.isActive() && si.boxShadowInfo.getProps().inset ) );
},
updateSize: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.