xuijs / xui

A tiny javascript framework for mobile web apps.
http://xuijs.com
788 stars 106 forks source link

not(q) returns empty set instead of all nodes if xui(q) is empty #26

Closed bryfox closed 13 years ago

bryfox commented 13 years ago

elements.not(q) should return elements if xui(q) returns an empty set. Instead, not(q) returns an empty set.

Spec & patch here: https://github.com/bryfox/xui/commit/17abdbad4a726f0c9e6c763b068ef1f2a147b2f2

(Also note that I cache the xui(q) result set, which I can't see a problem with.)

I just made a clean fork of xui, so this is the only change on top of the xui/xui head; do you want a pull request?

filmaj commented 13 years ago

I pulled your master branch in and rebased it, and now it is merged in 17abdbad4a726f0c9e6c763b068ef1f2a147b2f2

One thing that would be cool would be to eventually use webkitMatchesSelector instead of iterating over entire collections to check for membership in a set. Not sure how well this is supported on the various mobile devices we are targeting. Could always add more generic implementations for the profiles targeting weaker devices such as BlackBerry or IE-based devices.

Thank you for the patch and spec!