Sha256: 26f14a40b67236adbcaf9be910064667414902c6b9e5afdb5c0cb1b26902cdda
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
// xlink var xlinkNS = 'http://www.w3.org/1999/xlink' var xlinkRE = /^xlink:/ var inputProps = { value: 1, checked: 1, selected: 1 } module.exports = { priority: 850, update: function (value) { if (this.arg) { this.setAttr(this.arg, value) } else if (typeof value === 'object') { this.objectHandler(value) } }, objectHandler: function (value) { // cache object attrs so that only changed attrs // are actually updated. var cache = this.cache || (this.cache = {}) var attr, val for (attr in cache) { if (!(attr in value)) { this.setAttr(attr, null) delete cache[attr] } } for (attr in value) { val = value[attr] if (val !== cache[attr]) { cache[attr] = val this.setAttr(attr, val) } } }, setAttr: function (attr, value) { if (inputProps[attr] && attr in this.el) { if (!this.valueRemoved) { this.el.removeAttribute(attr) this.valueRemoved = true } this.el[attr] = value } else if (value != null && value !== false) { if (xlinkRE.test(attr)) { this.el.setAttributeNS(xlinkNS, attr, value) } else { this.el.setAttribute(attr, value) } } else { this.el.removeAttribute(attr) } } }
Version data entries
3 entries across 3 versions & 1 rubygems