如何将元素或文本节点标记为 "inert"?

How do you mark an element or text node as "inert"?

我刚刚偶然发现了 W3C HTML5 规范的第 7.2 章,其中提到

A node (in particular elements and text nodes) can be marked as inert.

来源:http://www.w3.org/TR/html5/single-page.html#inert-subtrees

不幸的是,规范没有说明如何做。有人知道吗?

我已经尝试将 "inert[='true']" 属性设置为一个元素...不起作用。

在我看来,因为这可能是一个 HTML5 功能,到目前为止没有人愿意实施或使用...... caniuse.com 甚至不知道......但也许我错了吗?

惰性属性似乎已从标准中删除。 Early 2014。关于它的帖子在网上似乎已经枯竭,因此可以安全地假设我们将无法使用它。

属性inertexists in HTML 5.1

HTML 5.1 现已发展为 W3C 推荐,这实质上是对该提案已准备好部署到 public 的认可,因此我们应该会看到主要的浏览器制造商开始实施建议,如果他们还没有这样做的话。

同时 caniuse has no information on browser support for the inert subtree yet, but I have raised an issue asking for it to be added

我写了一个 quick fiddle 可以让你看看你的浏览器是否支持它(尽管 Chromium/Chrome/Safari 和 FF 在撰写本文时不支持)。

在 Google Chrome 开发者频道上有一个 polyfill that could mimic the inert behavior to a node and its corresponding subtree. There is also a YouTube video 展示了这个 polyfill 的作用,并展示了这个行为的力量和用途。

在 buzgilla 上有一个 excellent response 解释了为什么它没有也不会在 Firefox 中作为属性实现。

There's no such attribute. If we implement this concept it'll be as part of <dialog>.

真是令人困惑,pointer-events 的这个属性在很多情况下都是完美且有用的