Hacker News new | ask | show | jobs
by firefoxman1 5174 days ago
This is really neat. The coolest part is being able to register your own "tags" which take any arguments you want.

The problem I see is that this only works for "all known HTML tags." If you want to use custom tags, like <template> (I believe that's what meteor uses), this won't cut it since it uses $.el.tagname syntax, every tag has to be loaded into the $.el object.

How about a very similar, more jQuery-like syntax instead:

   $.el('template', [
     $.el('div', {'class' : 'foo'}, [
       //other children here
       //so basically, the last arg is always an array of children
     ]
   ]);
1 comments

Though I did a poor job at documenting it, $.el is actually a function that accepts a tag name as the first parameter. The following two snippets are equivalent:

  $.el.div({className : 'foo'});

  $.el('div', {className : 'foo'});
That's awesome! Yeah I see it now in the source's comments. Thanks for pointing that out; I'm sold.