From 76a4ded1288a9573129fb07bf3ddb9763a8a09c5 Mon Sep 17 00:00:00 2001 From: Miles Tinsley Date: Sun, 6 Jan 2013 13:26:01 +0000 Subject: [PATCH] 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' --- AppKit/CPCompatibility.j | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/AppKit/CPCompatibility.j b/AppKit/CPCompatibility.j index 8a0e3c023..6f9c6f56f 100644 --- a/AppKit/CPCompatibility.j +++ b/AppKit/CPCompatibility.j @@ -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;