⌈⌋ ⎇ branch:  Bitrhythm


Artifact Content

Artifact 007e15d81a835f119a7c2d83a7c311896cb0204b4de687dddbb326be2d5c8c0f:


import { XLINK_NS, XLINK_REGEX } from './../../global-variables'
/**
 * Set any DOM attribute
 * @param { Object } dom - DOM node we want to update
 * @param { String } name - name of the property we want to set
 * @param { String } val - value of the property we want to set
 */
export default function setAttribute(dom, name, val) {
  const xlink = XLINK_REGEX.exec(name)
  if (xlink && xlink[1])
    dom.setAttributeNS(XLINK_NS, xlink[1], val)
  else
    dom.setAttribute(name, val)
}