CSSFontFeatureValuesMap: entries() method
Limited availability
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.
Phương thức entries() của các thực thể CSSFontFeatureValuesMap trả về một đối tượng map iterator mới chứa các cặp [key, value] cho mỗi khai báo trong CSSFontFeatureValuesMap này theo thứ tự chèn.
Cú pháp
js
entries()
Tham số
Không có.
Giá trị trả về
Một đối tượng iterator có thể lặp mới.
Ví dụ
>Sử dụng cơ bản
Ví dụ sau gán các mục vào biến swashes rồi ghi ra hai giá trị đầu tiên. Ví dụ này sử dụng @swash nhưng cũng hoạt động với các khối giá trị tính năng khác.
CSS
css
@font-feature-values "MonteCarlo" {
@swash {
swishy: 1;
swashy: 2;
}
}
JavaScript
js
// lấy các quy tắc
const myRule = document.styleSheets[0].cssRules[0];
// lấy các mục của swash
const swashes = myRule.swash.entries();
console.log(swashes.next().value); // ghi ra ["swishy", [1]]
console.log(swashes.next().value); // ghi ra ["swashy", [2]]
Thông số kỹ thuật
| Specification |
|---|
| CSS Fonts Module Level 4> # cssfontfeaturevaluesmap> |