How to use the css-vendor.supportedValue function in css-vendor

To help you get started, we’ve selected a few css-vendor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ianobermiller / nuclearmail / src / js / Cesium.js View on Github external
Object.keys(style).filter(key => key.indexOf(':') !== 0).forEach(key => {
    var value = style[key];

    // Have to go back and forth because cssVendor only accepts hyphenated
    var newKey = cssVendor.supportedProperty(hyphenateStyleName(key));
    if (newKey === false) {
      // Ignore unsupported properties
      console.warn('Unsupported CSS property ' + key);
      return;
    }
    newKey = camelizeStyleName(newKey);
    var newValue = cssVendor.supportedValue(newKey, value);
    if (newValue === false) {
      // Allow unsupported values, since css-vendor will say something like:
      // `solid 1px black` is not supported because the browser rewrites it to
      // `1px solid black`. css-vendor should be smarter about this.
      newValue = value;
    }
    newStyle[newKey] = newValue;
  });
  return newStyle;
github cssinjs / jss / packages / jss-plugin-vendor-prefixer / src / index.js View on Github external
function prefixStyle(style) {
    for (const prop in style) {
      const value = style[prop]
      if (prop === 'fallbacks' && Array.isArray(value)) {
        style[prop] = value.map(prefixStyle)
        continue
      }
      let changeProp = false
      const supportedProp = vendor.supportedProperty(prop)
      if (supportedProp && supportedProp !== prop) changeProp = true

      let changeValue = false
      const supportedValue = vendor.supportedValue(supportedProp, toCssValue(value))
      if (supportedValue && supportedValue !== value) changeValue = true

      if (changeProp || changeValue) {
        if (changeProp) delete style[prop]
        style[supportedProp || prop] = supportedValue || value
      }
    }

    return style
  }
github cssinjs / jss / packages / jss-plugin-vendor-prefixer / src / index.js View on Github external
function onChangeValue(value, prop) {
    return vendor.supportedValue(prop, toCssValue(value)) || value
  }
github tuchk4 / rockey / packages / rockey / lib / plugins / vendorPrefix.js View on Github external
Object.keys(styles).forEach(prop => {
      const supportedProp = vendor.supportedProperty(prop);

      const value = styles[prop].toString();
      const isImportant = value.indexOf('!important') !== -1;
      const supportedValue = vendor.supportedValue(
        supportedProp,
        isImportant
          ? styles[prop].replace('!important', '').trim()
          : styles[prop]
      );

      if (supportedValue && supportedProp) {
        if (supportedProp !== prop) {
          deletions.push(prop);
        }

        styles[supportedProp] =
          supportedValue + (isImportant ? ' !important' : '');
      } else {
        deletions.push(prop);
        reporter(
github ant-design / ant-design-mobile / components / style-sheet / index.web.tsx View on Github external
export function create(styles) {
  const ret = {};
  for (const s in styles) {
    if (styles.hasOwnProperty(s)) {
      const style = styles;
      const ret2 = {};
      for (let property in style) {
        if (style.hasOwnProperty(property)) {
          let value = style[property];
          property = supportedProperty(property) || property;
          if (typeof value === 'string') {
            value = supportedValue(property, value) || value;
          }
          ret2[property] = value;
        }
      }
      ret[s] = ret2;
    }
  }
  return ret;
}

css-vendor

CSS vendor prefix detection and property feature testing.

MIT
Latest version published 5 years ago

Package Health Score

74 / 100
Full package analysis