Created
October 17, 2013 20:12
-
-
Save pure/7031452 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://pure.github.io/pure/libs/pure.js"></script> | |
</head> | |
<body> | |
<!-- main template --> | |
<div class="animals"> | |
<select class="food"> | |
<optgroup> | |
<option></option> | |
</optgroup> | |
</select> | |
</div> | |
<!-- sub template --> | |
<script> | |
var data = {animals:[ | |
{name:'bird', food:['seed','worm']}, | |
{name:'cat', food:['mouse', 'bird']}, | |
{name:'dog', food:['meat', 'bone']}, | |
{name:'mouse', food:['cheese', 'books']} | |
]}, | |
dirAnimals = { | |
'select':{ | |
'animal<-animals':{ | |
'@class':'animal.name', | |
'optgroup@label':'animal.name', | |
'option':{ | |
'aliment<-animal.food':{ | |
'.':'aliment' | |
} | |
} | |
} | |
} | |
}; | |
$('.animals').render(data, dirAnimals); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment