In the good spirit of testing capabilities rather than browser versions, I needed a way to find out whether or not a browser supports setting the values of the “outline” property via CSS. IE6 and 7 don’t support it, everything else seems to. So I just quickly extended the jQuery.support functionality like so:
$.support.outlineCss = function() { var $el = $("<div></div>").css("outline", "1px solid black"), outlineStyle = $el.appendTo(document.body).css("outline-style"); $el.remove(); return outlineStyle == "solid"; }();
Simply test if $.support.outlineCss is true and you’re good to go…
Good work!
Might be worth caching the result as I’m guessing there could be a micro-flicker when it’s run?
It is cached; it only runs on startup. From then on it just stores a boolean value.