CSSFontFeatureValuesMap: clear() method
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.
Phương thức clear() của giao diện CSSFontFeatureValuesMap xóa tất cả các khai báo trong CSSFontFeatureValuesMap.
Cú pháp
js
clear()
Tham số
Không có.
Giá trị trả về
Không có (undefined).
Ví dụ
>Sử dụng cơ bản
Ví dụ sau xóa tất cả các khai báo trong khối tính năng @swash. 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];
console.log(myRule.swash.size); // ghi ra 2
myRule.swash.clear();
console.log(myRule.swash.size); // ghi ra 0
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| CSS Fonts Module Level 4> # cssfontfeaturevaluesmap> |