This function might be what you need, but it's just one of the solutions:
function replace_tag(from_tag,to_tag){
var eles = document.querySelectorAll(from_tag);
for (let i=0; i<eles.length; i++){
try{ // Avoid no-parent elements
let new_html = eles[i].outerHTML.replaceAll("<"+from_tag, "<"+to_tag);
new_html = new_html.replaceAll("/"+from_tag+">", "/"+to_tag+">");
eles[i].outerHTML = new_html;
}
catch (e){}
}
}
// Todo: Fix a bit for mixed-case tag
replace_tag("amp-img","img");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…