Posts

Showing posts with the label standard

mjst - Micro JavaScript Template Engine

This is the content I've written so far in the official mjst repository . I'd love to know your thoughts about this little experiment, cheers! What mjst is a lightweight, about 1Kb minified and gzipped, and performances focused template engine with standards support. There are dozens JavaScript ? Template Engines solutions out there but as far as I know this is the only one based on validation for both client and server side programming languages. How There is one single function to call: // via text (e.g. Ajax or innerHTML from a template node) var transformed = mjst ( '<?js var hello = "mjst!"; ?><js-hello/>' ); // classic template node example < script id = "mytpl" type = "text/html" >   <? js     var hello = "mjst!" ;   ?>   < js - hello /> < /script> myEl.innerHTML = mjst(document.getElementById("mytpl")); / / via XML ( e . g . Ajax or a created document ) // this is a ...

More standard Stack, and more slim ArrayObject

I have just updated both Stack and ArrayObject constructors. The Stack improvement is About concat method, now truly standard, accepting arguments that are not instance of Stack or Array. var s = new Stack(1, 2, 3); alert(s.concat([4, 5], 6)); // 1,2,3,4,5,6 Since this method uses defined slice one, there is no more reason to redefine concat method in inherited prototypes. That is why ArrayObject does not need anymore concat method, for a total of 4 fast redefined methods, plus inherited concat. ArrayObject is now the fastest extended Array constructor that returns instances of the same constructor, ArrayObject. ArrayObject is, at the same time, the base to create every other kind of cool library, using native Array methods power. Enjoy!