CSS Containment(contain:layout)在Chrome 62上不起作用

Kot*_*iya 5 html css google-chrome css-contain

我正在尝试使用CSS Containment(contain: layout),但在Chrome 62上似乎无法正常工作。

我想知道正确的使用方式contain: layout或我的误解。

代码在这里:

index.html:

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="utf-8">
    <title>CSS Containment</title>
    <script src="main.js" defer></script>
</head>
<body>
    <div id="container" style="contain: layout; height: 300px; width: 300px">
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

main.js:

const container = document.querySelector('#container');

setTimeout(() => {
    const elem = document.createElement('div');
    elem.textContent = 'content';
    container.appendChild(elem);
}, 100);
Run Code Online (Sandbox Code Playgroud)

我希望#container元素在之后呈现为布局根appendChild(elem),但是Chrome开发工具显示该根仍然是#document。

屏幕截图在这里。

另一方面,contain: layout size还是contain: strict正常工作,则意味着#container成为布局根。

其他浏览器尚不支持CSS包含,因此我无法确定它是特定于Chrome还是基于规范。

如果您有任何想法,请帮忙。