* Auto detect the appropriate prefix for a CSS property. * https://gist.github.com/paulirish/523692 * * @param {String} prop * @return {String}
(prop)
| 5322 | */ |
| 5323 | |
| 5324 | function prefix(prop) { |
| 5325 | prop = hyphenate(prop); |
| 5326 | var camel = camelize(prop); |
| 5327 | var upper = camel.charAt(0).toUpperCase() + camel.slice(1); |
| 5328 | if (!testEl) { |
| 5329 | testEl = document.createElement('div'); |
| 5330 | } |
| 5331 | var i = prefixes.length; |
| 5332 | var prefixed; |
| 5333 | if (camel !== 'filter' && camel in testEl.style) { |
| 5334 | return { |
| 5335 | kebab: prop, |
| 5336 | camel: camel |
| 5337 | }; |
| 5338 | } |
| 5339 | while (i--) { |
| 5340 | prefixed = camelPrefixes[i] + upper; |
| 5341 | if (prefixed in testEl.style) { |
| 5342 | return { |
| 5343 | kebab: prefixes[i] + prop, |
| 5344 | camel: prefixed |
| 5345 | }; |
| 5346 | } |
| 5347 | } |
| 5348 | } |
| 5349 | |
| 5350 | // xlink |
| 5351 | var xlinkNS = 'http://www.w3.org/1999/xlink'; |