Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
(1) Only target IE6. (2) Don't cache the result of isPngFix() as the …
Browse files Browse the repository at this point in the history
…caller already gets cached. (3) Don't use a regexp to parse the value. (4) Use PIE.CSS_PREFIX.
  • Loading branch information
Felix Gnass authored and lojjic committed Sep 20, 2010
1 parent d8e2f5a commit 6212f97
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sources/BackgroundStyleInfo.js
Expand Up @@ -272,19 +272,22 @@ PIE.BackgroundStyleInfo = PIE.StyleInfoBase.newStyleInfo( {
} ), } ),


/** /**
* Tests if style.PiePngFix or the -pie-png-fix property is set to true/on. * Tests if style.PiePngFix or the -pie-png-fix property is set to true in IE6.
*/ */
isPngFix: PIE.StyleInfoBase.cacheWhenLocked( function() { isPngFix: function() {
if (PIE.ieVersion > 6) {
return false;
}
var el = this.targetElement; var el = this.targetElement;
var val = (el.style.PiePngFix || el.currentStyle.getAttribute( 'pie-png-fix' )); var val = (el.style.PiePngFix || el.currentStyle.getAttribute( PIE.CSS_PREFIX + 'png-fix' ));
return /^(true|on)$/i.test(val); return val === true || val == 'true';
} ), },


/** /**
* The isActive logic is slightly different, because getProps() always returns an object * The isActive logic is slightly different, because getProps() always returns an object
* even if it is just falling back to the native background properties. But we only want * even if it is just falling back to the native background properties. But we only want
* to report is as being "active" if either the -pie-background override property is present * to report is as being "active" if either the -pie-background override property is present
* and parses successfully or '-pie-png-fix' is set to true/on. * and parses successfully or '-pie-png-fix' is set to true in IE6.
*/ */
isActive: PIE.StyleInfoBase.cacheWhenLocked( function() { isActive: PIE.StyleInfoBase.cacheWhenLocked( function() {
return (this.getCss3() || this.isPngFix()) && !!this.getProps(); return (this.getCss3() || this.isPngFix()) && !!this.getProps();
Expand Down

0 comments on commit 6212f97

Please sign in to comment.