assetgraph
Version:
An auto discovery dependency graph based optimization framework for web pages and applications
31 lines (25 loc) • 656 B
JavaScript
const SvgRelation = require('./SvgRelation');
class SvgInlineEventHandler extends SvgRelation {
inline() {
super.inline();
this.node.setAttribute(
this.attributeName,
this.to.text.replace(/^function[^{]*\{|};?\s*$/g, '')
);
this.from.markDirty();
return this;
}
attach() {
throw new Error('SvgInlineEventHandler.attach: Not supported.');
}
detach() {
this.node.removeAttribute(this.attributeName);
this.node = undefined;
return super.detach();
}
}
Object.assign(SvgInlineEventHandler.prototype, {
targetType: 'JavaScript',
_hrefType: 'inline'
});
module.exports = SvgInlineEventHandler;