CSSPseudoElement: thuộc tính type
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Thuộc tính chỉ đọc type của giao diện CSSPseudoElement trả về loại pseudo-element dưới dạng chuỗi, được biểu thị dưới dạng bộ chọn CSS.
Giá trị
Một chuỗi chứa một trong các giá trị sau:
Ví dụ
Ví dụ dưới đây minh họa mối quan hệ giữa CSSPseudoElement.type và Element.pseudo():
js
const myElement = document.querySelector("q");
const mySelector = "::after";
const cssPseudoElement = myElement.pseudo(mySelector);
const typeOfPseudoElement = cssPseudoElement.type;
console.log(mySelector === typeOfPseudoElement); // Outputs true
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| CSS Pseudo-Elements Module Level 4> # dom-csspseudoelement-type> |