<script> 和 <style> 元素的 innerText 在任何浏览器中都应该为空。HTML 规范中写明,innerText 返回已渲染的文本,而这两元素都是 display: none。Returns the element's text content "as rendered". 参阅:The innerText getter and setter - HTML Standard但 textContent 也获取不到就不清楚为什么了。
<script>和<style>元素的innerText在任何浏览器中都应该为空。HTML 规范中写明,innerText返回已渲染的文本,而这两元素都是display: none。但
textContent也获取不到就不清楚为什么了。