Improved support for converting CSS properties to their JS equivalent in CPBrowserStyleProperty

For example, the following CSS property names all resolve to the same correct JS equivalent for the current browser:

 * CPBrowserStyleProperty('TransformOrigin') -> 'WebkitTransformOrigin'
 * CPBrowserStyleProperty('transform-origin') -> 'WebkitTransformOrigin'
This commit is contained in:
Miles Tinsley
2013-01-06 13:26:01 +00:00
parent 8d68e805f4
commit 76a4ded128
+9 -2
View File
@@ -310,11 +310,18 @@ function CPBrowserStyleProperty(aProperty)
break;
default:
var prefixes = ["Webkit", "Moz", "O", "ms"],
capProperty = [aProperty capitalizedString];
strippedProperty = aProperty.split('-').join(' '),
capProperty = [strippedProperty capitalizedString].split(' ').join('');
for (var i = 0; i < prefixes.length; i++)
{
if (prefixes[i] + capProperty in testElement.style)
// First check if the property is already valid without being formatted, otherwise try the capitalized property
if (prefixes[i] + aProperty in testElement.style)
{
r = prefixes[i] + aProperty;
break;
}
else if (prefixes[i] + capProperty in testElement.style)
{
r = prefixes[i] + capProperty;
break;