Skip to content

Instantly share code, notes, and snippets.

@DavidAnson
Created November 4, 2017 21:32
Show Gist options
  • Save DavidAnson/e5862b4a802d0e153942269365cddcb6 to your computer and use it in GitHub Desktop.
Save DavidAnson/e5862b4a802d0e153942269365cddcb6 to your computer and use it in GitHub Desktop.
<!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>
@DavidAnson
Copy link
Author

DavidAnson commented Nov 4, 2017

Results for iOS 11 Safari:

5,effec,vectoreffect
4,acec,placecontent
4,ebac,enablebackground
3,ace,placeitems
3,ace,placeself
3,ace,whitespace
3,add,padding
3,add,paddingbottom
3,add,paddingleft
3,add,paddingright
3,add,paddingtop
3,add,scrollpadding
3,add,scrollpaddingbottom
3,add,scrollpaddingleft
3,add,scrollpaddingright
3,add,scrollpaddingtop
3,bac,background
3,bac,backgroundattachment
3,bac,backgroundblendmode
3,bac,backgroundclip
3,bac,backgroundcolor
3,bac,backgroundimage
3,bac,backgroundorigin
3,bac,backgroundposition
3,bac,backgroundpositionx
3,bac,backgroundpositiony
3,bac,backgroundrepeat
3,bac,backgroundrepeatx
3,bac,backgroundrepeaty
3,bac,backgroundsize
3,bef,breakbefore
3,bef,pagebreakbefore
3,deb,unicodebidi
3,dec,textdecoration
3,eca,strokelinecap
3,eda,strokedasharray
3,eda,strokedashoffset
3,fea,fontfeaturesettings
3,ffe,bufferedrendering

@DavidAnson
Copy link
Author

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