| OLD | NEW |
| (Empty) | |
| 1 // A test using Ahem font includes this file to ensure that the |
| 2 // font is loaded before window.onload fires and test finishes. |
| 3 // Note: this doesn't work if the test doesn't contain any visible |
| 4 // element with 'font-family: Ahem' style. |
| 5 (function() { |
| 6 var scripts = document.getElementsByTagName('script'); |
| 7 var src = scripts[scripts.length - 1].src; |
| 8 var lastSlash = src.lastIndexOf('/'); |
| 9 var relativePath = src.substr(0, lastSlash); |
| 10 |
| 11 window.addEventListener('DOMContentLoad', function() { |
| 12 var style = document.createElement('style'); |
| 13 style.appendChild(document.createTextNode( |
| 14 '@font-face { font-family: Ahem; src: url(' + relativePath + '/Ahem.ttf'))
; |
| 15 document.head.appendChild(style); |
| 16 // Force a layout to start loading the font. |
| 17 document.documentElement.offsetTop; |
| 18 }, true); |
| 19 }()); |
| OLD | NEW |