assetgraph
Version:
An auto discovery dependency graph based optimization framework for web pages and applications
22 lines (17 loc) • 604 B
JavaScript
const HtmlRelation = require('./HtmlRelation');
class HtmlContentSecurityPolicy extends HtmlRelation {
inlineHtmlRelation() {
this.node.setAttribute('content', this.to.text);
this.from.markDirty();
}
attach(position, adjacentRelation) {
this.node = this.from.parseTree.createElement('meta');
this.node.setAttribute('http-equiv', 'Content-Security-Policy');
return super.attach(position, adjacentRelation);
}
}
Object.assign(HtmlContentSecurityPolicy.prototype, {
targetType: 'ContentSecurityPolicy',
_hrefType: 'inline'
});
module.exports = HtmlContentSecurityPolicy;