This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function allStyleSheets(doc) { | |
var stylesheets = []; | |
for(var i = 0; i < doc.styleSheets.length; i++) | |
stylesheets = stylesheets.concat(getStyleSheets(doc.styleSheets[i])); | |
return stylesheets; | |
} | |
function getStyleSheets(stylesheet) { | |
if(!stylesheet) | |
return []; // Firefox protects against @import statement loops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFont(element) { | |
// create canvas in owner doc to get @font-face fonts | |
var doc = element.ownerDocument; | |
var canvas = doc.createElement("canvas"); | |
var context = canvas.getContext("2d"); | |
if(!context.measureText) | |
return "Text"; | |
var style = doc.defaultView.getComputedStyle(element, null); |
NewerOlder