Forked from bramstein/subpixel-word-spacing-detect.js
Created
November 19, 2013 07:57
-
-
Save manikrathee/7541849 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var subpixelWordSpacing = false; | |
if (document.defaultView && document.defaultView.getComputedStyle) { | |
// Store the original word spacing on the document element | |
var originalWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing; | |
// Set the word-spacing to half a pixel | |
document.documentElement.style.wordSpacing = '0.5px'; | |
// This will return either 0px or 1px if sub-pixel word-spacing is not supported, otherwise | |
// it will return 0.5px. | |
subpixelWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing === '0.5px'; | |
// Restore the original word-spacing | |
document.documentElement.style.wordSpacing = originalWordSpacing; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment