-
-
Save factormystic/1994499 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> | |
<body> | |
<pre><script type="text/javascript"> | |
try { | |
document.createElement("div").style.setProperty("width", 216, ""); | |
document.write("CSSStyleDeclaration's setProperty coerces strings. Hooray!\n"); | |
} catch (error) { | |
document.write("CSSStyleDeclaration's setProperty requires strings. Patching…\n"); | |
var d3_style_prototype = CSSStyleDeclaration.prototype, | |
d3_style_setProperty = d3_style_prototype.setProperty; | |
d3_style_prototype.setProperty = function(name, value, priority) { | |
d3_style_setProperty.call(this, name, value + "", priority); | |
}; | |
try { | |
document.createElement("div").style.setProperty("width", 216, ""); | |
document.write("CSSStyleDeclaration's setProperty now coerces strings. Hooray!\n"); | |
} catch (error2) { | |
document.write("CSSStyleDeclaration's setProperty still requires strings. I give up. :(\n"); | |
} | |
} | |
</script></pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment