Skip to content

Instantly share code, notes, and snippets.

@autioch
Created October 18, 2015 01:14
Show Gist options
  • Save autioch/7e468e310f80e5bc3400 to your computer and use it in GitHub Desktop.
Save autioch/7e468e310f80e5bc3400 to your computer and use it in GitHub Desktop.
Longest CSS rule in the page
(function(j, w) {
w.call(document.styleSheets).forEach(function(q) {
try { /* Accessing remote domain cssRules fails. */
w.call(q.rules || q.cssRules).forEach(function(k) {
(k.selectorText || '').split(',').forEach(function(b) {
(b.length > j.length) && (j = b);
});
});
} catch (z) {}
});
return j;
})('', [].slice);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment