text: /* @flow */
  
  import {
    isDef,
    isUndef
  } from 'shared/util'
  
  import {
    concat,
    stringifyClass,
    genClassForVnode
  } from 'web/util/index'
  
  /**
   * 
   * @param {*} oldVnode 
   * @param {*} vnode 
   * 更新类名
   */
  function updateClass (oldVnode: any, vnode: any) {
    const el = vnode.elm
    const data: VNodeData = vnode.data
    const oldData: VNodeData = oldVnode.dat
  
    /**
     * 如果元素是没有配置class信息，就不需要更新直接返回
     */
    if (
      isUndef(data.staticClass) &&
      isUndef(data.class) && (
        isUndef(oldData) || (
          isUndef(oldData.staticClass) &&
          isUndef(oldData.class)
        )
      )
    ) {
      return
    }
  
    /**
     * 获取新的class，会从组件占位节点，组件根节点，普通节点上找class然后合并
     */
    let cls = genClassForVnode(vnode)
  
    // handle transition classes
    const transitionClass = el._transitionClasses
    if (isDef(transitionClass)) {
      cls = concat(cls, stringifyClass(transitionClass))
    }
  
    /**
     * 如果新旧class不一样，更新旧值同时缓存
     */
    // set the class
    if (cls !== el._prevClass) {
      el.setAttribute('class', cls)
      el._prevClass = cls
    }
  }
  
  export default {
    create: updateClass,
    update: updateClass
  }
  