无法在类似浏览器的源代码中获取已解析的Unicode字符
HTML文件和as
 
是一个空格,那么我们可以使用此变通方法,因为任何标题的单词之间都有空格。
<section id="theSection" title="The section">The section</section>
<script>
console.log(document.getElementById('theSection').title.split(' ').join(' '));
</script>
我知道这是愚蠢的回答,
但是,如果真的打算处理空间unicode,那么点击包含以下内容的url
<section id="theSection" title="The section">The section</section>
具有
fetch(url)
如下所示:
fetch('stackoverflow.com')
.then(async (res) => {
const text = await res.text();
// process the text with any unicode charachter as it is now 100% string
}
);
现在,源HTML文件是一个字符串。在您的示例中,最好将字符串上的javascript与正则表达式一起使用,以查找您希望在html源代码中处理的内容。