colorful rat Ratfactor.com > Dave's Repos

retrov

A tiny browser-native Virtual DOM rendering library.
git clone http://ratfactor.com/repos/retrov/retrov.git

retrov/README.md

Download raw file: README.md

1 <img src="raw/retrov.svg" alt="RetroV 1970s colors svg logo"> 2 3 # RetroV 4 5 RetroV (pronounced "retro vee") is a virtual DOM (VDOM) rendering library. 6 It is browser-native and has no dependencies or build system. 7 8 It's tiny: **1129 bytes** (the usual minified gzipped metric). 9 10 Read more on the World Wide Web here: 11 12 http://ratfactor.com/retrov/ 13 14 ## Installation 15 16 <script src="retrov.js"></script> 17 18 ## Example 19 20 Here's a quick glimpse (a whole web page!): 21 22 <!DOCTYPE html> 23 <html><body> 24 <script src="retrov.js"></script> 25 <script> 26 RV.render( 27 document.body, 28 ['div', 29 ['h1', 'Hello'], 30 ['p', 'Hello world, this is ', 31 ['em', 'RetroV'], 32 '!', 33 ] 34 ] 35 ); 36 </script> 37 </body></html> 38 39 For more examples and fairly complete **tutorial**, take a look at 40 at `demo.html` in this repo or see it live here: 41 42 http://ratfactor.com/retrov/demo.html 43 44 You can also run the test suite `test.html` or run it live: 45 46 http://ratfactor.com/retrov/test.html 47 48 ## Updates! 49 50 * Raw verbatim HTML string nodes now update when they've changed. 51 * Added 'rvid' special property. See demo.html for demo/documentation. 52 * Added Crockford's jsmin.c to do minifying with no external dependencies. 53 54 ## Why? 55 56 I couldn't find anything exactly like it. Lots of bits and pieces 57 I liked, but not this exact thing. 58 59 ## Inspiration 60 61 [.dom](https://github.com/wavesoft/dot-dom/) - 62 Full hyperscript and DOM diff in 512 bytes! A direct inspiration. In fact, I 63 was originally going to fork this and change it to suit my preferences until I 64 decided to go in a radically different direction for VNode creation. 65 66 [Mithril](https://github.com/MithrilJS/mithril.js/) - 67 My old favorite, still getting updates. This is how I learned these practices 68 and it's the standard by which I judge them. 69 70 [ijk](https://github.com/lukejacksonn/ijk) - 71 DOM without the 'h()' function - pure JS data structures. 72 I _think_ I'd seen this concept before, but maybe not. At any rate, this 73 has heavily influenced RetroV. This library is for transforming data, 74 not rendering. Super compact code!