Skip to content

Commit

Permalink
Support bg-position for each linear-gradient in IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Johnston committed Jul 3, 2011
1 parent 8aa170f commit 280945a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sources/IE9BackgroundRenderer.js
Expand Up @@ -28,7 +28,8 @@ PIE.IE9BackgroundRenderer = PIE.RendererBase.newRenderer( {
if ( images ) {
while( img = images[ i++ ] ) {
bg.push( img.imgType === 'linear-gradient' ?
'url(data:image/svg+xml,' + escape( this.getGradientSvg( img ) ) + ') ' + ( img.imgRepeat || '' ) :
'url(data:image/svg+xml,' + escape( this.getGradientSvg( img ) ) + ') ' +
( img.imgRepeat || '' ) + ' ' + this.bgPositionToString( img.bgPosition ) :
img.origString
);
}
Expand All @@ -42,6 +43,12 @@ PIE.IE9BackgroundRenderer = PIE.RendererBase.newRenderer( {
}
},

bgPositionToString: function( bgPosition ) {
return bgPosition ? bgPosition.tokens.map(function(token) {
return token.tokenValue;
}).join(' ') : '';
},

getGradientSvg: function( info ) {
var el = this.targetElement,
bounds = this.boundsInfo.getBounds(),
Expand Down

0 comments on commit 280945a

Please sign in to comment.