Permalink
Browse files

Updated readme.

  • Loading branch information...
1 parent d8a1baa commit 2ba7528bc282596f516015f63cfe9ec21b778468 @blacktaxi committed Sep 14, 2012
Showing with 16 additions and 3 deletions.
  1. +16 −3 README.md
View
19 README.md
@@ -1,4 +1,17 @@
-dollar-gee
-==========
+dollar-gee ($g)
+===============
-Client-side DOM-based templating; "reverse jQuery" intuitively.
+A little routine for *declarative UI definition* (or basically creating DOM nodes.)
+
+- `$g('xxx')` is the same as parsing `<div class='xxx'></div>`
+- `$g('', 'xxx')` will be a text element `xxx`
+- `$g('.a', { href: 'link' }, 'the link')` will be an `<a>` element with a text element inside: `<a href='link'>the link</a>`
+- `$g('#div1', [ $g('#div2 xxx', 'in div2'), $g('#div3 yyy', 'in div3'), 'in div1' ])` will output
+ ```<div id='div1'>
+ <div id='div2' class='xxx'>in div2</div>
+ <div id='div3' class='yyy'>in div3</div>
+ in div1
+ </div>
+ ```
+
+For a bit more complex example, look inside the source. I used this little thing to create UI tree for an iGoogle app back in the day.

0 comments on commit 2ba7528

Please sign in to comment.