Describe the bug
When attempting to add a @font-face CSS rule using happy-dom, I encounter a HierarchyRequestError indicating that the CSS rule is invalid. The issue occurs when running the following code:
To Reproduce
index.js
import { Window } from 'happy-dom';
const window = new Window({
url: 'https://localhost:8080',
});
const document = window.document;
const styleEl = document.createElement('style');
// Append <style> element to <head>
document.head.appendChild(styleEl);
const styles = `
@font-face {
font-family: "Ionicons";
src: url("~react-native-vector-icons/Fonts/Ionicons.ttf");
`;
styleEl.sheet?.insertRule(styles, 0);
// Close window
await window.happyDOM.close();
Describe the bug When attempting to add a
@font-face
CSS rule using happy-dom, I encounter a HierarchyRequestError indicating that the CSS rule is invalid. The issue occurs when running the following code:To Reproduce
index.js
package.json
Run
node index.js
Expected behavior The
@font-face
rule should be successfully added to the document's stylesheet without any errors.Actual Behavior:
The following error is thrown:
Device:
Additional context
Personally, I don't care about font issues on happy-dom.