CSSFontFeatureValuesMap: values() 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 values() 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
values()
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 giá trị vào biến swashValues 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 giá trị của swash
const swashValues = myRule.swash.values();
console.log(swashValues.next().value); // ghi ra [1]
console.log(swashValues.next().value); // ghi ra [2]
Thông số kỹ thuật
| Specification |
|---|
| CSS Fonts Module Level 4> # cssfontfeaturevaluesmap> |