Skip to content

Instantly share code, notes, and snippets.

@bkardell
Created December 15, 2011 20:36
Show Gist options
  • Save bkardell/1482763 to your computer and use it in GitHub Desktop.
Save bkardell/1482763 to your computer and use it in GitHub Desktop.
A really dumb sharing test
<html>
<head>
<link rel="stylesheet"
type="text/css"
href="http://69.54.28.122/describe.css" />
</head>
<body>
<h1>Dumb Hitches Level 1 (<script type="text/javascript">document.write(window.location.href.replace(/.html/,'.js').replace('http://69.54.28.122:8081/describe?u=',''));</script>)</h1>
<h2>Dumb pseudo-class filters</h2>
<p>Dumb psudeo-classes provide a mechanism to select elements based on dumb criteria.</p>
<h2>Table of Contents</h2>
<ol>
<li><a href="random">:-dumb-random() filter</a></li>
</ol>
<h3 class="sectionnumber"><a name="random">1. The -dumb-random pseudo-class</a></h3>
<p>The random pseudo class <span class="sig">:-dumb-random()</span>,
is a funtional notation taking no arguments.
It represents an element whose value is randomly true or false at the time it is filtered.
</p>
<div class="example">
<p>Examples: </p>
<p>
The following selector will randomly match some div elements inside of .x and not others,
and make their color blue. divs outside of .x will be unaffected.
</p>
<pre>.x div:-dumb-random(){
color: blue;
}</pre>
</div>
</body>
</html>
Hitch.add([
{
name: '-dumb-random',
filter: function(match,argsString){
return (Math.floor(Math.random()*2) === 1);
}
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment