Penar Musaraj 005e1ecb9b
FEATURE: Update Font Awesome to v5.4.1 and SVGs (#6557)
* First take on subsetting svg icons

* FontAwesome 5 svg subset WIP

* Include icons from plugins/badges into svg sprite subset

* add svg icon support to themes

* Add spec for SvgSprite

* Misc. SVG icon fixes

* Use FA5 svgs in local-dates plugin

* CSS adjustments, fix SVG icons in group flair

* Use SVG icons in poll plugin

* Add SVG icons to /wizard
2018-11-07 13:05:43 -05:00

43 lines
965 B
JavaScript

// FROM: https://github.com/Matt-Esch/virtual-dom
// License: MIT
function AttributeHook(namespace, value) {
if (!(this instanceof AttributeHook)) {
return new AttributeHook(namespace, value);
}
this.namespace = namespace;
this.value = value;
}
AttributeHook.prototype.hook = function(node, prop, prev) {
if (
prev &&
prev.type === "AttributeHook" &&
prev.value === this.value &&
prev.namespace === this.namespace
) {
return;
}
node.setAttributeNS(this.namespace, prop, this.value);
};
AttributeHook.prototype.unhook = function(node, prop, next) {
if (
next &&
next.type === "AttributeHook" &&
next.namespace === this.namespace
) {
return;
}
var colonPosition = prop.indexOf(":");
var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop;
node.removeAttributeNS(this.namespace, localName);
};
AttributeHook.prototype.type = "AttributeHook";
export default AttributeHook;