Commit Graph

77 Commits

Author SHA1 Message Date
David Greenspan
4cca9a8082 even more helpful LiveUI message on mismatched tags 2012-04-08 10:13:57 -07:00
David Greenspan
bf04fccb72 new query diffing algorithm with fuzz tests 2012-04-03 22:37:11 -07:00
David Greenspan
3dc7c83da0 use === in liveui 2012-04-03 22:30:56 -07:00
David Greenspan
ee3d306adc templates changes with Geoff (a couple fixes, a couple reverts, comments) 2012-04-03 22:30:54 -07:00
David Greenspan
d73c18aae5 fix extra event handlers in patching 2012-04-03 22:10:21 -07:00
Nick Martin
82ac8e324e fix listChunk event bug (with tests) 2012-04-03 22:10:21 -07:00
David Greenspan
89ce396ae5 Overhaul liveui & templating to support "smart patch" and rendering HTML (rebase-2) 2012-04-03 22:10:20 -07:00
Geoff Schmidt
b3fc3150d4 simplify signature of observe()'s remove callback 2012-03-16 18:26:19 -07:00
Geoff Schmidt
76c57526f7 rework public API for defining tests 2012-03-02 05:22:40 -08:00
Geoff Schmidt
cab5afbb91 move test reporting functions out of globals 2012-03-02 03:57:30 -08:00
Geoff Schmidt
f31226e388 rename minimongo Collection => LocalCollection 2012-02-16 22:41:16 -08:00
David Greenspan
476db8cccb Meteor.Collection() -> new Collection() in tests 2012-02-07 12:06:51 -08:00
David Greenspan
f1368be4d8 Refactor liverange for clarity (and to learn it). Tests pass, whew! 2012-02-07 12:02:34 -08:00
matt debergalis
6a0831d9b0 Align Minimongo and MongoDB semantics.
* remove() removes all documents in collection (previously, had to
  explicitly pass {} selector to MM).

* update() requires {multi: true} to update multiple documents.
  Previously we defaulted to true, now multi defaults to false.
2012-02-06 18:17:53 -08:00
matt debergalis
6851bf66ae Make falsey and {_id: <falsey>} selectors match nothing.
In Livedata and Minimongo, make falsey selectors match no documents,
instead of all documents.  Same for {_id: undefined}.  This is a
departure from most MongoDB drivers, but offers a safety belt around
selectors that are rarely useful and easy to accidentally create
programmatically.

For remove(), also protect against accidentally destroying an entire
collection when passing no args.  To empty a collection, pass the
wildcard selector explicitly: foo.remove({});

For find(), keep the standard mongo behavior of returning all documents
when no selector is passed in by explicitly checking arguments.length.

This change also makes typical read cases cleaner, allowing:

 x = foo.findOne(Session.get('foo_id'));

instead of

 x = Session.get('foo_id') && foo.findOne(Session.get('foo_id'));
2012-02-02 16:46:43 -08:00
matt debergalis
5e7daaaff3 New Collection API
The new Collection API separates query handles from result sets.  It
allows template iterators to only redraw changed objects instead of
entire result sets.  This implementation also sets the stage for
minimongo indexes and better invalidation performance.

collection.find() now returns a Collection.Query handle.  To retrieve
results we provide these methods on Collection.Query:

Iterators (encouraged way to access results):

 * query.forEach(function (obj) { ... });
 * results = query.map(function (obj) { ... });

Cursor-based retrieval (iterators are built on fetch):

 * docs = query.fetch(maxlen); // return next [maxlen] (all) docs.
 * doc = query.get(skip);      // return next doc, skipping [skip] (0) docs.

Counter:

 * length = query.count(); // number of results in query.

Live queries (replaces findLive):

 * live_handle = query.observe({added: function (obj, idx) { ... },
                                removed: function (id, idx) { ... },
                                changed: function (obj, idx) { ... },
                                moved: function (obj, old_idx, new_idx) { ... }});

Convenience finders:

 * doc = collection.findOne({color: 'red'});
 * doc = collection.findOne(id_val);

On the client, calling forEach(), map(), fetch(), get(), or findOne()
inside an invalidation context will register a dependency on the entire
query result.  Any change to any objects invalidates the context.

Calling count() inside an invalidation context will register a
dependency that only triggers if objects enter or leave the result set.

Calling observe() does not register a dependency.
2012-01-27 20:59:08 -08:00
Geoff Schmidt
d1d5604976 Refactor bundler; new package API 2012-01-27 20:02:26 -08:00
Geoff Schmidt
e5eb42e55c Refactor package API/bundler 2012-01-27 20:02:24 -08:00
David Greenspan
c2c903f3ef fix a couple tests 2012-01-27 20:01:59 -08:00
David Greenspan
ad801a61ac add a TBODY in IE 2012-01-20 16:00:05 -08:00
David Greenspan
db3f8b3ebc jquery-like fragment creation, placeholder comments; still broken in IE 2012-01-20 16:00:05 -08:00
Geoff Schmidt
c3a5e2cafc merge rename from master, with fixups. unit tests pass. take two (this should be an actual merge commit) 2012-01-20 15:25:31 -08:00
Geoff Schmidt
7a0c0d2217 test that partial patching uses liverange correctly (hint: it doesn't) 2012-01-18 21:27:26 -08:00
Nick Martin
0e39cbe5be Replace new occurances of Skybreak with Meteor. 2012-01-18 17:53:21 -08:00
Nick Martin
0d413ac1db Take new master version of these files. Didn't happen quite right in the merge. 2012-01-18 17:45:07 -08:00
Nick Martin
459dac9cac Merge branch 'master' into meteor
conflicts hand resolved. deftemplate and liveui reverted to master, will re-do later.

Conflicts:
	admin/generate-dev-bundle.sh
	admin/install-s3.sh
	admin/manifest.json
	app/meteor/deploy.js
	app/meteor/meteor.js
	examples/leaderboard/leaderboard.js
	examples/unfinished/azrael/client/azrael.js
	examples/unfinished/azrael/model.js
	packages/liveui/liveui.js
	packages/templating/deftemplate.js
	packages/templating/html_scanner.js
	tests/minimongo/test.html
2012-01-18 16:14:54 -08:00
Geoff Schmidt
a5d650e7ce new test framework WIP 2012-01-18 01:19:55 -08:00
Geoff Schmidt
dc2e377695 comment cleanups, remove unused function 2012-01-17 18:49:35 -08:00
Geoff Schmidt
8653639a2d fix some IE7 issues 2012-01-16 22:12:49 -08:00
Geoff Schmidt
ee8f1c1e9b Make liveui tests pass on IE8! 2012-01-16 20:44:32 -08:00
Geoff Schmidt
b1f06d68ed full Sky.ui.render tests 2012-01-16 19:36:57 -08:00
Geoff Schmidt
5479af11fe fix bug that would give a blank screen on Safari 2012-01-13 21:33:20 -05:00
Geoff Schmidt
e16e0abaf3 more renderList tests
- reactivity/GC of renderlist item body
- items that render to multiple DOM nodes
2012-01-13 19:31:14 -05:00
Nick Martin
75e387aaa0 Use nodeType===11 for cross-browser DocumentFragment test. Thanks David. 2012-01-13 14:00:02 -08:00
Geoff Schmidt
e24c97bd4b remove debugging message 2012-01-13 14:50:43 -05:00
Geoff Schmidt
f30692f0d5 more renderList tests. improve renderList GC 2012-01-13 14:45:53 -05:00
Geoff Schmidt
50fe6de9f9 bugfix: default render_empty 2012-01-13 14:45:53 -05:00
Nick Martin
4891d1c956 Determining if an element is a Node is tricky too. 2012-01-12 21:05:05 -08:00
Nick Martin
a1c5623191 workaround DocumentFragment not being defined on IE8. 2012-01-12 19:21:00 -08:00
Geoff Schmidt
827617e168 add new LiveRange creation mode
.. now you can create either the largest, or the smallest LiveRange that starts and ends on a given pair of nodes. has tests. leaderboard now works (under hand testing)
2012-01-12 01:53:31 -08:00
Geoff Schmidt
8b8d19bf3f renderList implemented, not debugged. it has bugs. 2012-01-12 01:50:53 -08:00
Geoff Schmidt
d38e915438 make todos run again 2012-01-12 01:50:53 -08:00
Geoff Schmidt
0d72c2b6b2 WIP 2012-01-12 01:50:53 -08:00
David Greenspan
ef1233d4fb minor typo-level fixes 2012-01-11 15:06:26 -08:00
Nick Martin
3faff2de78 perl -pi -e 's/Sky/Meteor/g' **/* 2012-01-04 20:52:46 -08:00
Nick Martin
23cd5b6912 perl -pi -e 's/Skybreak/Meteor/g' **/* 2012-01-04 18:30:25 -08:00
Geoff Schmidt
ef614a1619 turn on range creation optimization in liveui 2011-12-20 03:45:23 -08:00
Geoff Schmidt
74ec9c3771 fix bug. todo now collects 100% of its garbage 2011-12-20 03:09:20 -08:00
Geoff Schmidt
fefaa5fc09 liverange tests, bugfixes 2011-12-20 01:30:03 -08:00
Geoff Schmidt
6a9b4f58d0 comments 2011-12-19 17:03:27 -08:00