zodoz / jquery-ZenCoding

Zen-Coding for jQuery

Home Page:http://zodoz.github.com/jquery-ZenCoding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove jQuery dependency

AlecRaeside opened this issue · comments

First off, this is a great idea and implementation, a nice alternative to the traditional JS templating solutions.

What do you think about abstracting this plugin to be library agnostic? It seems to just use jquery as a namespace and use some of its utility functions.

I would have to think about this for a bit. I originally decided to use jQuery as a way for me to abstract away the creation of the HTML elements, and I know that jQuery will continually be updated for newer(/est) versions of HTML, thus requiring fewer code changes/updates for this project.

However, having said that, I am aware that I do not use very much of the jQuery library and it would be worth the time to investigate just what that percentage is and what would be required to remove this dependency. For now, however I am working on version 2.0 which will include many significant changes (I refer you to the wiki for more details), the most significant of which is a PEG via pegjs which will make this a fully fledged language rather than my (probably error prone) regular expression parsing. But I will be happy to consider this after version 2.0. Also, feel free to make revisions to that document to suggest any other new ideas you may have.

As a side note: I think that this templating language may be general enough to be XML rather than specifically HTML. If this ends up being true and worth pursuing, then I will definitely be removing the jQuery dependency at that time. The only down side(s) that I can think of with doing that at the moment is that it will/may remove the &data and ~event capabilities.

I agree, the fact that $.zen sits on jQuery suggests the following code would return a jQuery object rather than just plain html:


...so I find myself having to wrap it using a second $ which looks and feels cumbersome:


Perhaps ZenCoding might sit well as a standalone AMD module, so example 2 above could become:



Hmm... I think I like the idea behind AMD, but this is the first time I've seen AMD I'm not sure how it will integrate in the direction I'm currently bringing this project. Therefore I have marked this thread as a "New Feature" and will explore it more once I have brought my upgrade a bit further.

Also, I seem to not be pushing my updates as often as I used too, this is intentional: Making a PEG for this language is proving more finicky than I first anticipated, and I'd rather not push things too early. So instead, I'm working on it on my local machine until I have a general working prototype and then I'll push it up to github.

I intend to also be creating a new wiki page within the next few days for how I feel the general use-case(s) for version 2.0 will be and the direction I'm trying to take. I hope you all will be able to review this and provide further feedback.

+1 to this, we should first focus on how to fast templating, then consider the extras like ~event and &data. Also I don't think including !js! in templates is a good idea, it makes debugging trickier

suppose we can borrow some ideas form sprintf.js http://www.diveintojavascript.com/projects/javascript-sprintf