UNPKG

591 BJavaScriptView Raw
1
2const STYLE = document.createElement('style');
3const SHEET = STYLE.sheet;
4
5STYLE.setAttribute('title', 'oxe');
6STYLE.setAttribute('type', 'text/css');
7
8export default {
9
10 get style () { return STYLE; },
11 get sheet () { return SHEET; },
12
13 add (data) {
14 this.sheet.insertRule(data);
15 },
16
17 append (data) {
18 this.style.appendChild(document.createTextNode(data));
19 },
20
21 async setup (option) {
22 option = option || {};
23
24 if (option.style) {
25 this.append(option.style);
26 }
27
28 document.head.appendChild(this.style);
29 }
30
31};