Created
November 4, 2017 21:32
-
-
Save DavidAnson/e5862b4a802d0e153942269365cddcb6 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CSS property names having longest overlap with hexadecimal color characters</title> | |
</head> | |
<body> | |
<pre><script> | |
r = [] | |
for (s in getComputedStyle(document.body)) { | |
s = s.toLowerCase() | |
m = !/^webkit/.test(s) && /[abcdef]{3,}/.exec(s) | |
m && r.push([m[0].length, m[0], s]) | |
} | |
r.sort((a, b) => (b[0]-a[0]) || a[1].localeCompare(b[1])) | |
r.forEach(e => document.write(e + "\n")) | |
</script></pre> | |
</body> | |
</html> |
Self-review: RegExp should be global to find all the matches in the style name (vs. just the first of sufficient length).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results for iOS 11 Safari: