UNPKG

assetgraph

Version:

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

20 lines (14 loc) 521 B
const HtmlRelation = require('./HtmlRelation'); class HtmlInlineScriptTemplate extends HtmlRelation { inlineHtmlRelation() { this.node.textContent = this.to.text; this.from.markDirty(); } attach(position, adjacentRelation) { this.node = this.from.parseTree.createElement('script'); this.node.setAttribute('type', this.to.contentType); return super.attach(position, adjacentRelation); } } HtmlInlineScriptTemplate.prototype._hrefType = 'inline'; module.exports = HtmlInlineScriptTemplate;