diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 25b911a87..cc754d875 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -53,7 +53,7 @@ iD.Map = function() { class_fill = iD.Style.styleClasses('stroke'), class_area = iD.Style.styleClasses('area'), class_casing = iD.Style.styleClasses('casing'), - transformProp = iD.util.prefix(['webkit', 'ms', 'Moz']) + 'transform', + transformProp = iD.util.prefixProperty('Transform'), support3d = (function() { // test for translate3d support. Based on https://gist.github.com/3794226 by lorenzopolidori and webinista var el = document.createElement('div'), diff --git a/js/id/util.js b/js/id/util.js index 46ff08448..817958f04 100644 --- a/js/id/util.js +++ b/js/id/util.js @@ -72,6 +72,15 @@ iD.util.prefix = function(browsers) { return ''; })(browsers); }; +iD.util.prefixProperty = function(property) { + prefixes = ['webkit', 'ms', 'Moz', 'O']; + return (function prefixMatch(p) { // via mbostock + var i = -1, n = p.length, s = document.body.style; + if (property.toLowerCase() in s) return property.toLowerCase(); + while (++i < n) if (p[i] + property in s) return '-' + p[i].toLowerCase() + '-' + property.toLowerCase(); + return ''; + })(prefixes); +}; iD.util.geo = {};