HTMLStyleElement: blocking 屬性
HTMLStyleElement 介面的 blocking 屬性是一個字串,指示在獲取關鍵子資源時應阻止某些操作。
它反映了 <style> 元素的 blocking 屬性。
值
一個字串。必須是以空格分隔的下面列出的 blocking tokens 的列表,用於指示要阻止的操作
render-
阻止在螢幕上渲染內容。
注意:只有文件
<head>中的style元素才可能阻止渲染。預設情況下,當瀏覽器在解析過程中發現<head>中的style元素時,它會阻止渲染。如果此類style元素是透過指令碼動態新增的,您還必須將blocking = "render"設定為才能阻止渲染。
示例
html
<style id="el" blocking="render">
p {
color: blue;
}
</style>
js
const el = document.getElementById("el");
console.log(el.blocking); // Output: "render"
規範
| 規範 |
|---|
| HTML # dom-style-blocking |
瀏覽器相容性
載入中…