|
1 |
| -(function (document: any) { |
| 1 | +/// <reference lib="dom" /> |
| 2 | +(function (document: Document) { |
2 | 3 | var contarinEl = document.createElement('div')
|
3 | 4 | var hEl = document.createElement('h2')
|
4 | 5 | var pEl = document.createElement('p')
|
5 |
| - var style: Record<string, string> = { |
| 6 | + var style: Partial<CSSStyleDeclaration> = { |
6 | 7 | position: 'fixed',
|
7 | 8 | top: '0',
|
8 | 9 | left: '0',
|
|
17 | 18 | textAlign: 'center',
|
18 | 19 | boxShadow: '0 1px 5px rgba(0,0,0,0.1)'
|
19 | 20 | }
|
20 |
| - var hStyle: Record<string, string> = { |
| 21 | + var hStyle: Partial<CSSStyleDeclaration> = { |
21 | 22 | padding: '0',
|
22 | 23 | margin: '0',
|
23 | 24 | lineHeight: '1.2',
|
24 | 25 | fontSize: '24px',
|
25 | 26 | fontWeight: '700',
|
26 | 27 | color: '#000',
|
27 | 28 | }
|
28 |
| - for (var key in style) { |
29 |
| - contarinEl.style[key] = style[key] |
30 |
| - } |
31 |
| - for (var key in hStyle) { |
32 |
| - hEl[key] = hStyle[key] |
33 |
| - } |
| 29 | + Object.assign(contarinEl.style, style) |
| 30 | + Object.assign(hEl.style, hStyle) |
34 | 31 | // todo: i18n
|
35 | 32 | // todo: add browser info
|
36 | 33 | hEl.innerText = 'Your browser is out of date.'
|
37 | 34 | pEl.innerHTML = 'Aleph.js requires <a href="https://caniuse.com/es6-module" style="font-weight:500;color:#000;">ES module</a> support during development.'
|
38 | 35 | contarinEl.appendChild(hEl)
|
39 | 36 | contarinEl.appendChild(pEl)
|
40 | 37 | document.body.appendChild(contarinEl)
|
41 |
| -})((window as any).document) |
| 38 | +})(window.document) |
0 commit comments