Created
August 18, 2013 03:34
-
-
Save hongymagic/6259776 to your computer and use it in GitHub Desktop.
Trying to modify _content_ of a _content-less_ element – can't be done boys and girls.
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
html { | |
font-size: 100%; | |
} | |
img, | |
button, | |
input { | |
-webkit-appearance: none; | |
display: block; | |
margin: 0; padding: 0.4rem 0.2rem; | |
border: 1px solid #222; | |
background: #fff; | |
} | |
button:after, | |
input:after { | |
content: '*' | |
} |
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 name="description" content="Cannot force content into content-less elements! Not even via shadow DOM!" /> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input type="submit" /> | |
<button type="submit">Hello</button> | |
<img src="http://www.gravatar.com/avatar/46068a67c1129be0dd0e4915f62b6677?s=29" /> | |
</body> | |
</html> |
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 input = document.querySelector('input'); | |
var root = input.webkitCreateShadowRoot(); | |
root.textContent = 'Hello*'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment