script pour lister les font-faces
This commit is contained in:
13
fr/script.js
13
fr/script.js
@@ -41,6 +41,19 @@ function change_font()
|
|||||||
let content = Array.from(document.styleSheets);
|
let content = Array.from(document.styleSheets);
|
||||||
console.log(content);
|
console.log(content);
|
||||||
*/
|
*/
|
||||||
|
// get all the styleSheets
|
||||||
|
const styleSheets = Array.from(document.styleSheets);
|
||||||
|
|
||||||
|
styleSheets.forEach(styleSheet => {
|
||||||
|
const cssRules = styleSheet.cssRules;
|
||||||
|
|
||||||
|
// all the font-faces rules
|
||||||
|
const rulesFontFace = cssRules.filter(rule => rule.cssText.startsWith('@font-face'));
|
||||||
|
|
||||||
|
rulesFontFace.forEach(fontFace => {
|
||||||
|
console.log(fontFace); // CSSFontFaceRule object
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user