Created
April 27, 2012 13:49
-
-
Save phloe/2509412 to your computer and use it in GitHub Desktop.
escaping selector fun
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
div { | |
margin: 10px; | |
min-height: 20px; | |
padding: 2px; | |
} | |
span { | |
margin: 2px; | |
} | |
div { | |
background-color: lightgrey; | |
} | |
/* Valid */ | |
#\# { | |
background-color: cyan; | |
} | |
#\. { | |
background-color: cyan; | |
} | |
#\\ { | |
background-color: cyan; | |
} | |
#\: { | |
background-color: cyan; | |
} | |
#\[ { | |
background-color: cyan; | |
} | |
.\. { | |
background-color: cyan; | |
} | |
.\# { | |
background-color: cyan; | |
} | |
/* Invalid */ | |
#\ { | |
background-color: yellow; | |
} | |
[\[=\]] { | |
background-color: yellow; | |
} | |
[\]=\=] { | |
border: 1px solid red; | |
} | |
/* Invalid - no IE */ | |
[\==\=] { | |
background-color: red; | |
color: #FFF; | |
} | |
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
<h4>Valid - but weird</h4> | |
<div id=#>id=#</div> | |
<div id=.>id=.</div> | |
<div id=\>id=\</div> | |
<div id=:>id=:</div> | |
<div id=[>id=[</div> | |
<div class=.>class=.</div> | |
<div class=#>class=#</div> | |
<hr/> | |
<h4>Invalid - but somehow working</h4> | |
<div id=" ">id=" "</div> | |
<div [=] ]==>[=] ]==</div> | |
<hr/> | |
<h4>Invalid - doesn't work in IE</h4> | |
<div ===>===</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment