UNPKG

angular2-data-table

Version:

angular2-data-table is a Angular2 component for presenting large and complex data.

34 lines (27 loc) 889 B
import { camelCase } from './camel-case'; let cache = {}; let testStyle = document.createElement('div').style; // Get Prefix // http://davidwalsh.name/vendor-prefix const prefix = (function () { const styles = window.getComputedStyle(document.documentElement, ''); const pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/))[1]; const dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1]; return { dom, lowercase: pre, css: `-${pre}-`, js: pre[0].toUpperCase() + pre.substr(1) }; })(); export function getVendorPrefixedName(property: string) { const name = camelCase(property); if(!cache[name]) { if(testStyle[prefix.css + property] !== undefined) { cache[name] = prefix.css + property; } else if(testStyle[property] !== undefined) { cache[name] = property; } } return cache[name]; }