brianleroux / xui

A tiny javascript framework for mobile web apps.
http://github.com/xui/xui
391 stars 159 forks source link

Consolidating core and more #37

Closed filmaj closed 13 years ago

filmaj commented 13 years ago

There is a 1k minified difference between core and more. Additionally, some functions in more, I think, are useless, and others I use all the fucking time. I think we should just combine the two.

I wanted to hack it all up right away but brian in his democratic way said, let's vote on it. So, here's a summary of functions present in more.js and my thoughts on whether to drop or incorporate into mainline. Please share your thoughts!

more/fx.js:

native animations (i say kill it)

webkit-transform-based animations (kill it)

more/dom.js:

shortcut .html methods, i.e. .bottom() .top() etc. (incorporate)

more/base.js:

add(), adds more dom elements to existing set. (kill it, I don't use it)

end(), "Pops the last selector from XUI", wtf is this?

first(), this is just get(0). typing get(0) is one less char so I don't know why someone would use first. kill it!

get()... ya keep it.

eq(): returns a collection containing element at given index. never use it, kill it.

size(): return this.length. nuf said. kill it.

more/xhr.js:

xhrjson - i love this function. keep it!

more/event.js:

shortcut functions .click .touchstart etc. keep!

more/form.js:

just helper functions for parsing forms. kill it, I never use it.

Please vote !!!!!!!

alunny commented 13 years ago

keep dom and event

I don't care about the rest

brianleroux commented 13 years ago

native animations as plugin

more/dom.js shortcut .html methods, i.e. .bottom() .top()

more/base.js:

add(), adds more dom elements to existing set. (kill it, I don't use it)

end(), "Pops the last selector from XUI", wtf is this?

first()

get()

eq(): returns a collection containing element at given index. never use it, kill it.

size(): return this.length. nuf said. kill it.

more/xhr.js:

xhrjson - i love this function. keep it!

more/event.js:

shortcut functions .click .touchstart etc. keep!

more/form.js:

just helper functions for parsing forms. kill it, I never use it.

mwbrooks commented 13 years ago

I vote the same as alunny:

I don't use the rest.

imhotep commented 13 years ago

+1 DOM

silentrob commented 13 years ago

The Idea behind Add was to do things like x$('.selected').add('li:first').removeClass('baz'); Or x$('.selected').each(function(el) { this.add(el.firstChild); })

I think it has a use but maybe not super clear to see our not a popular pattern.

I tend to follow Fil's +1 DOM, +1 Event. drop first() in favor of get(0) or change get() to with no args to first()

if xhrjson is being used, I say we keep it. I dont care about the other xhr sugar methods.

If native animations work, I would like to keep them. They are hardware accelerators. and have many benefits over emily, plus less code.

remy commented 13 years ago

Equally $('selector').find('a').click(fn).end().doStuff2Selector() works by traversing up through the cache of selectors - a pattern that was supposed to help porting jquery plugins to xui

brianleroux commented 13 years ago

ok, from this conversation I'm thinking

remy commented 13 years ago

Otherwise agree with most of the other method changes. I've never quite been sure of the grammer around bottom, top, etc - but that's more of documentation to go with it.

filmaj commented 13 years ago

Thanks for the comments guys. I kinda agree with remy - array syntax is fine with me instead of get(). Will save a few bytes too! I'll set up xui organization repos (xui proper and xui-plugins) today sometime.

remy commented 13 years ago

Got some animation plugin good for you already - this will progressively enhance the tween method to detect CSS transitions and make use of them if they're available: http://github.com/remy/marbles2/blob/master/xui-anim.js

silentrob commented 13 years ago

remy, top and bottom make total sense in the context of list items x$('ul').bottom("add this");

remy commented 13 years ago

Sure - but what about the other elements :)

Would x$('div').top('<p>foo</p>') put the <p> on top of the div or inside the div at the top?

I know the answer if I check the code (and based on the example you gave), but I'm not 100% sure by just looking at the syntax.

Like I said, easily fixed with documentation and one simple example.

filmaj commented 13 years ago

This is all consolidated under the xui/xui repo.