这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
type
只读特性在
CSSPseudoElement
interface returns the type of the pseudo-element as a string, represented in the form of a
CSS selector
.
var typeOfPseudoElement = cssPseudoElement.type;
A
CSSOMString
containing one of the following values:
The example below demonstrates the relationship between
CSSPseudoElement.type
and
Element.pseudo()
:
const myElement = document.querySelector('q');
const mySelector = '::after';
const cssPseudoElement = myElement.pseudo(mySelector);
const typeOfPseudoElement = cssPseudoElement.type;
console.log(mySelector === typeOfPseudoElement); // Outputs true
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Pseudo-Elements Level 4
The definition of 'type' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
type
|
Chrome No | Edge No |
Firefox
75
Disabled
|
IE No | Opera No | Safari No | WebView Android No | Chrome Android No |
Firefox Android
63
Disabled
|
Opera Android No | Safari iOS No | Samsung Internet Android No |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。
CSSPseudoElement
element
type