Created
November 6, 2014 15:49
-
-
Save bkardell/1c160ff1d40c9cc2c8dc 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>CSS Custom Properties/attributes</title> | |
| <style> | |
| :root { | |
| --x-thinger: one; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="two" style="--x-thinger: two"> | |
| Very simple example showing what it is like to get the property value and mismatch currently in FF nightly implementation: Those assigned in a stylesheet are trimmed (which is nice) and those inline are not (which kinda sucks but might actually be proper as it's just tokens)... Either way they should match. | |
| </div> | |
| <script> | |
| console.log("computed style of documentElement: '%s'", window.getComputedStyle(document.documentElement).getPropertyValue("--x-thinger")); | |
| console.log("computed style of #foo: '%s'", window.getComputedStyle(document.querySelector("#two")).getPropertyValue("--x-thinger")); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment