Open davidfurlong opened 5 years ago
@davidfurlong, you can do something like this
if
with rel, for remove rel
attr before href(browser will ignore second attr with the same name)
onTagAttr(tag, name, value, isWhiteAttr) {
if (!isWhiteAttr) return;
if (tag === 'a') {
if (name === 'rel') return '';
if (name === 'href') {
return `href="${xss.escapeAttrValue(value)}" rel="nofollow"`;
}
}
},
I want to make sure that
a
tags have arel='nofollow'
attr. Perhaps this is beyond the scope of this library. HoweveronTagAttr
andsafeAttrValue
seem to only work in terms of removing specifiedattrs
. If this attr isn't specified, it won't get fired. Thx & feel free to close if you want