Browse files

cross browser testings

  • Loading branch information...
1 parent 1ae000b commit dd4930f258d7b1804a3469dcd563ca8b0f685612 @mcfedr committed Feb 3, 2012
Showing with 60 additions and 16 deletions.
  1. +21 −16 Source/Fx/Fx.CSS3.js
  2. +21 −0 Source/Fx/Fx.Morph.CSS3.js
  3. +18 −0 Source/Fx/Fx.Tween.CSS3.js
View
37 Source/Fx/Fx.CSS3.js
@@ -29,18 +29,20 @@ provides: [Fx.CSS3]
})();
if(prefix) {
+ var hasTransform = typeof document.documentElement.style[prefix + 'Transform'] != 'undefined';
+ prefix = prefix.toLowerCase();
return {
- transition: prefix + 'Transition',
- transitionProperty: prefix + 'TransitionProperty',
- transitionDuration: prefix + 'TransitionDuration',
- transitionTimingFunction : prefix + 'TransitionTimingFunction',
- transitionend: (prefix == 'Moz') ? 'transitionend' : (prefix == 'O' ? 'o' : prefix) + 'TransitionEnd',
- transform: typeof document.documentElement.style[prefix + 'Transform'] != 'undefined' ? '-' + prefix.toLowerCase() + '-transform' : null
+ transition: '-' + prefix + '-transition',
+ transitionProperty: '-' + prefix + '-transition-property',
+ transitionDuration: '-' + prefix + '-transition-duration',
+ transitionTimingFunction : '-' + prefix + '-transition-timing-function',
+ transitionend: (prefix == 'moz') ? 'transitionend' : prefix + 'TransitionEnd',
+ transform: hasTransform ? '-' + prefix + '-transform' : null
}
}
return false;
})();
-
+
Element.NativeEvents[css3Features.transitionend] = 2;
DOMEvent.implement({
@@ -203,15 +205,15 @@ provides: [Fx.CSS3]
return value.map(function(val){
val = String(val);
var found = false;
- Object.each(css3Parsers, function(parser, key){
+ Object.each(parsers, function(parser, key){
if (found) return;
var parsed = parser.parse(val);
if (parsed || parsed === 0) found = {value: parsed, parser: parser};
});
found = found || {value: val, parser: Fx.CSS.Parsers.String};
return found;
});
- },
+ }
};
Fx.CSS3Stop = {
@@ -244,7 +246,7 @@ provides: [Fx.CSS3]
}
};
- var css3Parsers = {
+ var parsers = {
Matrix: {
parse: function(val){
if(typeof val != 'string') {
@@ -281,17 +283,20 @@ provides: [Fx.CSS3]
},
compute: function(from, to, delta){
if(delta == 0) {
- return from.text;
+ return from
}
else if(delta == 1) {
- return to.text;
+ return to;
}
- return 'matrix(' + from.matrix.map(function(v, k) {
- return Fx.compute(v, to[k], delta).toFixed(2);
- }).join(', ') + ')';
+ var v = {
+ matrix: from.matrix.map(function(v, k) {
+ return Fx.compute(v, to[k], delta).toFixed(2);
+ })
+ };
+ v.text = 'matrix(' + v.matrix.join(', ') + ')';
},
serve: function(value) {
- return value;
+ return value ? value.text || value : null;
}
},
Color: {
View
21 Source/Fx/Fx.Morph.CSS3.js
@@ -40,6 +40,27 @@ provides: [Fx.Morph.CSS3]
return this.startCSS3(usedProps, from, to);
}
return this.parent(properties);
+ },
+
+ compute: function(fromX, toX, delta){
+ return Object.map(fromX, function(from, prop) {
+ var computed;
+ var to = toX[prop];
+ if(delta == 0) {
+ computed = from;
+ }
+ else if(delta == 1) {
+ computed = to;
+ }
+ else {
+ computed = [];
+ (Math.min(from[p].length, to.length)).times(function(i){
+ computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
+ });
+ }
+ computed.$family = Function.from('fx:css:value');
+ return computed;
+ });
}
});
View
18 Source/Fx/Fx.Tween.CSS3.js
@@ -33,6 +33,24 @@ provides: [Fx.Tween.CSS3]
return this.startCSS3([this.property], parsed.from, parsed.to);
}
return this.parent(property, from, to);
+ },
+
+ compute: function(from, to, delta){
+ var computed;
+ if(delta == 0) {
+ computed = from;
+ }
+ else if(delta == 1) {
+ computed = to;
+ }
+ else {
+ computed = [];
+ (Math.min(from[p].length, to.length)).times(function(i){
+ computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
+ });
+ }
+ computed.$family = Function.from('fx:css:value');
+ return computed;
}
});

0 comments on commit dd4930f

Please sign in to comment.