Standard judges browser support

https://github.com/standard/standard
 
// Judging browser support, please note that standard only supports IOS system 
// https://github.com/standard/standard 
let elementStyle = document.createElement ('div' ) .style 
let vendor = (() => { 
  let transformNames = { 
    webkit: 'webkitTransform' , 
    Moz: 'MozTransform' , 
    O: 'OTransform' , 
    ms: 'msTransform' , 
    standard: 'transform' 
  } 

  for (let key in transformNames) {
     if (elementStyle [transformNames [key] ]! == undefined) {
      return key
    }
  }

  return false
})()
// If the standard style is supported, the description is the IOD system, return CSS style 
export function prefixStyle (style) {
   if (vendor === false ) {
     return  false 
  } 

  if (vendor === 'standard' ) {
     return style 
  } 

// The charAt () method is used to return the character at the specified index. The index range is from 0 to length ()-1. 
// The toUpperCase () method is used to convert the string to uppercase. 
  return vendor + style.charAt (0) .toUpperCase () + style.substr (1 ) 
}

 

Guess you like

Origin www.cnblogs.com/marquess/p/12681853.html