UNPKG

assetgraph

Version:

An auto discovery dependency graph based optimization framework for web pages and applications

30 lines (24 loc) 695 B
const HtmlRelation = require('./HtmlRelation'); class HtmlKnockoutContainerless extends HtmlRelation { inlineHtmlRelation() { this.node.nodeValue = `${ this.to.isPretty ? ' ' : '' }ko ${this.to.text.replace(/^\(\{\s*|\s*\}\);?$/g, '')}${ this.to.isPretty ? ' ' : '' }`; this.from.markDirty(); } attach() { throw new Error('HtmlKnockoutContainerless.attach: Not supported.'); } detach() { this.node.parentNode.removeChild(this.node); this.node = undefined; return super.detach(); } } Object.assign(HtmlKnockoutContainerless.prototype, { targetType: 'JavaScript', _hrefType: 'inline' }); module.exports = HtmlKnockoutContainerless;