having fun with code

Mooml 1.2.3 – Bye, bye, with()

Mooml 1.1 was the first version of Mooml that didn’t rely on eval(), a javascript function that causes lot’s of problems when not used properly, but that also prevent minimizers and compilers like Closure to generate valid code.

The new Mooml 1.2.3 release also gets rid of with(), which will no longer be used to render Mooml templates. Instead, templates are prepared when they get registered, so all template tag functions (div(), span(), p()) get replaced by calls to the Mooml engine. Although this means there will be a performance hit when registering templates, it also means templates will render faster. As a plus, template parameter names will no longer conflict with template tag function names. Thus, you can now have a template with a parameter named ‘div’ and the template wont fail rendering.

Download: http://mootools.net/forge/p/mooml
Source: http://github.com/eneko/mooml

Related Posts:

3 Comments to Mooml 1.2.3 – Bye, bye, with()

  1. Mike's Gravatar Mike
    September 6, 2010 at 09:09 | Permalink

    IS it possible to have template use other templates?
    eg.
    Mooml.register(‘Login’, function(data) {
    Mooml.render(data),
    form(
    ul(
    li(
    label({‘for’:'UID’},data.lbluserid),
    input({‘id’:'UID’,'type’:'text’,'maxlength’:’8′,’size’:’20′}),
    label(‘*’)
    ),
    li(
    label({‘for’:'pw’},data.lblpw),
    input({‘id’:'pw’,'type’:'password’,'maxlength’:’20′,’size’:’20′}),
    label(‘*’)
    )
    ),
    div(), // for messages
    input({‘id’:'login’,'type’:'button’,'value’:'Login’})
    );
    });

  2. Jean-Nicolas's Gravatar Jean-Nicolas
    May 4, 2011 at 11:22 | Permalink

    I am trying to called a method, but for some reason it does not work: http://jsfiddle.net/FEfpq/

    The code is self-explanatory.

    Thanks in advance for any help…

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Additional comments powered by BackType

About the blog

This is a blog about development, focused mainly on Javascript but also other languages like python, shell scripts and more.

About the author

Eneko Alonso is a software engineer and UI developer with more than eight years of experience in software and web development. He lives in San Luis Obispo, California and works at LEVEL Studios.

Contact Info

Contact Info

PromoteJS

JavaScript JS Documentation