Commit Graph

4064 Commits

Author SHA1 Message Date
Emily Stark
172f709a5f Fix bug where event handler return values weren't being used. 2014-03-27 11:10:30 -07:00
Avital Oliver
4a328d0004 Fix failing IE test 2014-03-27 09:30:46 -07:00
Avital Oliver
42f5ff1fb9 Revert "Remove preserve-inputs package -- an upgrader removes it from apps"
This wouldn't work well if you run from a Meteor checkout or
without updating your app (via `meteor run --release 0.8.0`)

This reverts commit dc71bd2143.
2014-03-26 20:57:58 -07:00
Avital Oliver
dc71bd2143 Remove preserve-inputs package -- an upgrader removes it from apps 2014-03-26 20:55:02 -07:00
David Glasser
27ec7b1519 Fix stylus tests to test stylus rather than less 2014-03-26 20:41:58 -07:00
David Glasser
f58754cb01 Add stuff about template files to spacebars README 2014-03-26 19:10:46 -07:00
Avital Oliver
f0d6c15583 Execute helpers on UI.body 2014-03-26 14:38:11 -07:00
Avital Oliver
cb80bb9f0d Better deprecation message for preserve-inputs package
Now we print it when loading the package (on the server console)
rather than when building it.
2014-03-26 14:27:46 -07:00
Avital Oliver
10b5c88f4e Remove madewith package 2014-03-26 14:23:04 -07:00
Avital Oliver
28ad0a45eb Fix tests 2014-03-25 19:46:27 -07:00
Avital Oliver
c47e898070 Remove now-deprecated preserve-inputs package from examples
Also, add a helpful log message to help users know to remove the package.
2014-03-25 19:27:17 -07:00
Avital Oliver
3f62fab4f2 Remove unmaintained animation package.
We'll get back to animation after we ship 0.8.0.
2014-03-25 19:19:41 -07:00
Avital Oliver
6971f90c0b No more domutils and liverange packages 2014-03-25 19:18:45 -07:00
Avital Oliver
748c4db7a3 No more spark and universal-events packages 2014-03-25 19:09:56 -07:00
David Greenspan
5a1edba2ef Only look for helpers in the current template
Revert the new feature that all helpers in enclosing templates are visible, including helpers on the template that called the current template (for example) and helpers on UI.body.

Making helpers visible to sub-templates was a major change that was never properly justified or thought through.  Helpers take precedence over data properties, and having helpers "leak" down through the app could have bad consequences, even if it's useful for defining helpers on a group of related templates.  There was a point in shark's history where we needed this dynamic lookup in order for helpers to work in block tags, but that's no longer the case.

Now, helpers are only visible to the lexical body of the template they are defined on (except for global helpers defined with UI.registerHelper).

Ran tests in Chrome; ran todos and docs.
2014-03-24 17:45:05 -07:00
Avital Oliver
883188dc70 Revert "Mark backcompat on some Handlebars functions"
This reverts commit b777b04a66.
2014-03-24 14:37:28 -07:00
Avital Oliver
b777b04a66 Mark backcompat on some Handlebars functions 2014-03-24 14:24:03 -07:00
David Greenspan
30cd85f951 Fix templateInstance findAll, add $ alias
findAll was always supposed to return a jQuery object if you use jQuery (which is always at the moment).

Now `this.$` is an alias for `this.findAll`, as well.
2014-03-24 13:20:40 -07:00
David Greenspan
480016ea8b Fix #with 2014-03-23 09:53:53 -07:00
David Greenspan
a1d1549d77 Failing tests for #with behavior 2014-03-23 09:10:04 -07:00
David Greenspan
1fcb33e61b parse.js: Add more comments 2014-03-22 09:57:46 -07:00
Avital Oliver
4ba1abb79e Handlebars.registerHelper -> UI.registerHelper 2014-03-22 00:47:02 -07:00
Avital Oliver
cc4865c114 Handlebars._escape -> UI._escape 2014-03-22 00:35:51 -07:00
Avital Oliver
c2d985c235 Handlebars.SafeString -> Spacebars.SafeString 2014-03-22 00:35:26 -07:00
Avital Oliver
dd6a2a2e5e Pass empty object as 'this' when no data context
in template helpers and event handlers. 'this' must be an object and
it can't be null, so an empty object is the best we can do (and surely
better than 'window' which is what we had before this commit)

This was a regression from Spark.
2014-03-21 23:05:45 -07:00
Avital Oliver
9ef97fc297 Better parsing for {{! }} comments
We now no longer check whether we're at a closing
HTML tag by peeking for "</" since that would fail
if there were a {{! }} comment directly before it.

Instead, we tokenize and then rewind. Presumably
this does have an effect on compilation time but it's
probably fine. An alternative would have been to
explicitly parse {{! }} comments rather than implicitly
skipping them before generally parsing tokens.
2014-03-21 22:08:02 -07:00
David Greenspan
09b9b4adba Tower of hacks to get shark deps right
The implementation is getting really, really ugly.  Just want to get to correctness.

We now stop autoruns not just when started from `materialize` but also `toHTML`, `toText`, and `evaluate`, which is important for HTML attributes.  Reactive regions inside attributes aren't individually autorun; the design is that their dependencies will cause the entire attribute updater to be invalidated and re-run.  In other words, HTML.toText doesn't have internal re-runs but it does register dependencies on the current computation.  In fact, however, the presence of emboxedValues means that there *are* autoruns that need to be stopped, even in toText and evaluate.

The hack where we define a `.materialized()` callback for the benefit of UI.With falls short, because toText et al. don't call it.  The current workaround is yet worse hacks in htmljs (stopWithLater).

Finally, the fact that UI.If, UI.Unless, and Spacebars.include return reactive closures that close over emboxedValues is a problem when those same closures are reused in recalculating attributes.  The intent was that recalculating attributes should tear down any boxes internal to the attribute calculation and start fresh, but when we reuse closures that close over boxes, we are reusing boxes, and if those boxes have been stopped we lose correctness.  The ugly hack to get this to work for now is to have the boxes in If, Unless and include not be per reactive closure but per currentComputation, i.e. per autorun.  Since toText et al. don't normally autorun reactive closures, we add an autorun so that they get their own Computation objects.  This hack is supported by UI.namedEmboxValue and callReactiveFunction.

The good news is that the right answer is buried in here somewhere.
2014-03-21 03:54:28 -07:00
David Greenspan
7e49210eec Deps: Do less function wrapping
Now you can actually see function source code when you inspect _onInvalidateCallbacks in the debugger.  Instead of wrapping a bunch of stuff around the callbacks before enqueuing them, we move the logic to where they are called.
2014-03-21 02:53:34 -07:00
David Greenspan
54e43e7151 Deps: Take noYieldsAllowed off client call stack 2014-03-21 02:18:05 -07:00
David Greenspan
f12845fc33 Add failing tests for reactive attribute stoppage 2014-03-21 00:13:24 -07:00
David Greenspan
726e90930e Stop more helpers
Stop emboxed values again from reactive ranges on DOM removal
2014-03-21 00:12:54 -07:00
David Greenspan
3d42ae9a5a Deps: Wrap functions more debuggably 2014-03-20 23:59:11 -07:00
David Greenspan
295268fb8c Fix #unless to stop helpers 2014-03-20 18:02:41 -07:00
Avital Oliver
3eb4e97112 Greenspan comments on keyword argument parsing 2014-03-20 14:14:54 -07:00
Avital Oliver
adbadbfbc6 Allow hyphens in kwargs to inclusions and block helpers
(and other characters)
2014-03-20 13:39:54 -07:00
David Greenspan
2b10bf3794 Remove emboxValue tests
emboxValue is going away anyway
2014-03-20 10:25:39 -07:00
David Greenspan
c910fce4c6 Make emboxValue dumb; explicitly stop autoruns 2014-03-20 09:39:13 -07:00
David Greenspan
6e945e29e7 Test no helper re-run with inclusions, callbacks 2014-03-20 09:38:35 -07:00
Avital Oliver
2f7724ac2a New failing test for re-running helpers in #each within #with 2014-03-18 21:53:07 -07:00
David Greenspan
53c83be0b8 Make #each stop sooner; observe inside Deps comp
By doing the #each observe inside the current Deps computation from materialization, it will stop when the parent computation is invalidated.
2014-03-18 14:59:42 -07:00
David Greenspan
20db762c6d Modify test 2014-03-18 14:38:40 -07:00
David Greenspan
af9bc84ecc Test for helper re-run after template removed
(some failures)
2014-03-18 14:32:07 -07:00
David Greenspan
42258895be Hack to stop emboxed .data() sooner
This fixes cmather's test case for real this time (https://github.com/cmather/meteor-emboxed-issue)
2014-03-17 20:37:10 -07:00
David Greenspan
75b34dff39 rewrite emboxValue (doesn't fix everything yet) 2014-03-17 20:22:22 -07:00
Nick Martin
d8575d0a24 Merge branch 'devel' into shark 2014-03-17 15:51:18 -07:00
David Glasser
8a16f50138 Ensure that hook.each is called from a Fiber
That gives us enough guarantees that we can simplify the error-handling
code.

We also ensure that the "new connection" handler in livedata_server runs
in a Fiber, which fixes a bug introduced in d049bf7506 where connections
from pre-pre1 clients would crash (due to Meteor.setTimeout which only
works in a Fiber).
2014-03-17 15:49:27 -07:00
Avital Oliver
6282e42b1d Test that helpers are called only once when invalidated.
(This was fixed by the recent commit eliminating Deps.isolateValue)
2014-03-17 15:24:14 -07:00
Avital Oliver
b97d9e143a Eliminate Deps.isolateValue
Unfortunately, using it always led to reactive functions
firing twice. Instead, we now use emboxValue in the two
cases we originally had Deps.isolateValue.
2014-03-17 15:09:52 -07:00
David Glasser
da96352c65 Make some white-box tests less flaky
If we want the *internal* state of the oplog driver to be consistent, we
need to make sure that we start our observes at a consistent point in
the oplog.  (ie, initial inserts need to have been fully processed, so
that we don't process them during the original QUERYING phase, which can
give us a different unpublished buffer.)

Note that only the white-box tests (looked at _unpublishedBuffer, eg)
appeared to be flaky: the actual docs published seemed to be correct in
all cases.
2014-03-17 12:11:21 -07:00
David Glasser
17297d98d7 make LocalCollection.Cursor easier to read
and whitespace cleanup
2014-03-17 02:17:06 -07:00