export const registCssFun = (Element) => {
  Element.registerFunction('css', function (key, value) {
    var self = this;
    if (BI.isObject(key)) {
      BI.each(key, (k, v) => {
        self.css(k, v);
      });
      return this;
    }
    key = BI.trim(BI.camelize(key));
    return css(this, key, value);
  });
};

const css = (elem, key, value) => {
  key = BI.trim(BI.camelize(key));
  if (BI.isNull(value)) {
    return elem.styles[key];
  }
  elem.styles[key] = value;
  return elem;
};