Permalink
Browse files

Merge pull request #79 from michalbednarski/gh-pages

Fix dynamic-dom plugin to correctly choose prefixed properties
  • Loading branch information...
2 parents eb60165 + 07d824b commit b49dbeb52096ebac5af1553638a9c6caf8823e69 @LeaVerou committed Jun 10, 2012
Showing with 22 additions and 11 deletions.
  1. +22 −11 plugins/prefixfree.dynamic-dom.js
@@ -54,18 +54,29 @@ if(!self) {
if(window.CSSStyleDeclaration) {
for(var i=0; i<self.properties.length; i++) {
var property = StyleFix.camelCase(self.properties[i]),
- prefixed = self.prefixProperty(property),
+ prefixed = self.prefixProperty(property, true),
proto = CSSStyleDeclaration.prototype,
- getter = (function(prefixed) {
- return function() {
- return this[prefixed];
- }
- })(prefixed),
- setter = (function(prefixed) {
- return function(value) {
- this[prefixed] = value;
- }
- })(prefixed);
+ getter,
+ setter;
+
+ // Lowercase prefix for IE
+ if(!(prefixed in proto)) {
+ prefixed = prefixed.charAt(0).toLowerCase() + prefixed.slice(1);
+ if(!(prefixed in proto)) {
+ continue;
+ }
+ }
+
+ getter = (function(prefixed) {
+ return function() {
+ return this[prefixed];
+ }
+ })(prefixed);
+ setter = (function(prefixed) {
+ return function(value) {
+ this[prefixed] = value;
+ }
+ })(prefixed);
if(Object.defineProperty) {
Object.defineProperty(proto, property, {

0 comments on commit b49dbeb

Please sign in to comment.