diff --git a/HISTORY.md b/HISTORY.md index 4f44cf6da..20f7802cf 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## v2.6.1, 2022-April-XX + +* [#370](https://github.com/meteor/blaze/pull/370) `templating-runtime@1.6.1`, returned the `Template.__define__` with warning message +* [#366](https://github.com/meteor/blaze/pull/366) Prevent firing callbacks until members are destroyed + * fix destroying child templates when parent is destroyed; prevents memory leak and DOMRange "not attached" error + ## v2.6.0, 2022-April-13 * [#330](https://github.com/meteor/blaze/pull/330) Removed deprecated APIs from before Meteor 1.0 diff --git a/packages/blaze/.versions b/packages/blaze/.versions index f4f59fd26..a8f572af3 100644 --- a/packages/blaze/.versions +++ b/packages/blaze/.versions @@ -1,64 +1,64 @@ -allow-deny@1.1.0 -babel-compiler@7.6.1 +allow-deny@1.1.1 +babel-compiler@7.9.0 babel-runtime@1.5.0 base64@1.0.12 binary-heap@1.0.11 -blaze@2.5.0 -blaze-tools@1.1.2 +blaze@2.6.1-rc.1 +blaze-tools@1.1.3 boilerplate-generator@1.7.1 caching-compiler@1.2.2 caching-html-compiler@1.1.2 -callback-hook@1.3.0 +callback-hook@1.4.0 check@1.3.1 ddp@1.4.0 -ddp-client@2.4.0 +ddp-client@2.5.0 ddp-common@1.4.0 -ddp-server@2.3.2 +ddp-server@2.5.0 diff-sequence@1.1.1 -dynamic-import@0.6.0 -ecmascript@0.15.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.11.0 -ecmascript-runtime-server@0.10.0 -ejson@1.1.1 +dynamic-import@0.7.2 +ecmascript@0.16.2 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.2 fetch@0.1.1 geojson-utils@1.0.10 -html-tools@1.1.0 -htmljs@1.1.0 -id-map@1.1.0 +html-tools@1.1.3 +htmljs@1.1.1 +id-map@1.1.1 inter-process-messaging@0.1.1 jquery@1.11.10 -local-test:blaze@2.5.0 -logging@1.2.0 -meteor@1.9.3 -minimongo@1.6.2 -modern-browsers@0.1.5 -modules@0.16.0 -modules-runtime@0.12.0 -mongo@1.11.0 +local-test:blaze@2.6.1-rc.1 +logging@1.3.1 +meteor@1.10.0 +minimongo@1.8.0 +modern-browsers@0.1.7 +modules@0.18.0 +modules-runtime@0.13.0 +mongo@1.14.6 mongo-decimal@0.1.2 mongo-dev-server@1.1.0 -mongo-id@1.0.7 -npm-mongo@3.9.0 +mongo-id@1.0.8 +npm-mongo@4.3.1 observe-sequence@1.0.16 ordered-dict@1.1.0 -promise@0.11.2 +promise@0.12.0 random@1.2.0 -react-fast-refresh@0.1.0 +react-fast-refresh@0.2.3 reactive-var@1.0.11 reload@1.3.1 retry@1.1.0 -routepolicy@1.1.0 -socket-stream-client@0.3.1 +routepolicy@1.1.1 +socket-stream-client@0.4.0 spacebars@1.0.15 spacebars-compiler@1.1.2 templating@1.3.2 templating-compiler@1.3.2 templating-runtime@1.3.2 templating-tools@1.1.2 -test-helpers@1.2.0 -tinytest@1.1.0 +test-helpers@1.3.0 +tinytest@1.2.1 tracker@1.2.0 underscore@1.0.10 -webapp@1.10.1 +webapp@1.13.1 webapp-hashing@1.1.0 diff --git a/packages/blaze/builtins.js b/packages/blaze/builtins.js index 0735d3cb2..044e68a45 100644 --- a/packages/blaze/builtins.js +++ b/packages/blaze/builtins.js @@ -295,7 +295,7 @@ Blaze._TemplateWith = function (arg, contentFunc) { // parent Views in the current template. However, when there's an argument // (`{{> Template.contentBlock arg}}`), the argument needs to be evaluated // in the original scope. There's no good order to nest - // Blaze._InOuterTemplateScope and Spacebars.TemplateWith to achieve this, + // Blaze._InOuterTemplateScope and Blaze._TemplateWith to achieve this, // so we wrap argFunc to run it in the "original parentView" of the // Blaze._InOuterTemplateScope. // diff --git a/packages/blaze/domrange.js b/packages/blaze/domrange.js index ca39ac459..f9baa465f 100644 --- a/packages/blaze/domrange.js +++ b/packages/blaze/domrange.js @@ -332,9 +332,13 @@ DOMRange.prototype.destroy = function (_skipNodes) { DOMRange._destroy(this, _skipNodes); }; -DOMRange.prototype.containsElement = function (elem) { +DOMRange.prototype.containsElement = function (elem, selector, event) { + const templateName = this.view?.name + ? this.view.name.split('.')[1] + : 'unknown template'; if (! this.attached) - throw new Error("Must be attached"); + throw new Error(`${event} event triggerd with ${selector} on ${templateName} but associated view is not be found. + Make sure the event doesn't destroy the view.`); // An element is contained in this DOMRange if it's possible to // reach it by walking parent pointers, first through the DOM and diff --git a/packages/blaze/package.js b/packages/blaze/package.js index 60aa9a10f..1a07bafb9 100644 --- a/packages/blaze/package.js +++ b/packages/blaze/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'blaze', summary: "Meteor Reactive Templating library", - version: '2.6.0', + version: '2.6.1-rc.2', git: 'https://github.com/meteor/blaze.git' }); @@ -9,7 +9,7 @@ Npm.depends({ 'lodash.has': '4.5.2', 'lodash.isfunction': '3.0.9', 'lodash.isempty': '4.4.0', - 'lodash.isobject': '3.0.2' + 'lodash.isobject': '3.0.2' }); Package.onUse(function (api) { diff --git a/packages/blaze/view.js b/packages/blaze/view.js index dbf5277c1..185197e62 100644 --- a/packages/blaze/view.js +++ b/packages/blaze/view.js @@ -489,14 +489,19 @@ Blaze._destroyView = function (view, _skipNodes) { return; view.isDestroyed = true; - Blaze._fireCallbacks(view, 'destroyed'); // Destroy views and elements recursively. If _skipNodes, // only recurse up to views, not elements, for the case where // the backend (jQuery) is recursing over the elements already. - if (view._domrange) - view._domrange.destroyMembers(_skipNodes); + if (view._domrange) view._domrange.destroyMembers(_skipNodes); + + // XXX: fire callbacks after potential members are destroyed + // otherwise it's tracker.flush will cause the above line will + // not be called and their views won't be destroyed + // Involved issues: DOMRange "Must be attached" error, mem leak + + Blaze._fireCallbacks(view, 'destroyed'); }; Blaze._destroyNode = function (node) { @@ -692,9 +697,11 @@ Blaze.remove = function (view) { while (view) { if (! view.isDestroyed) { var range = view._domrange; - if (range.attached && ! range.parentRange) - range.detach(); range.destroy(); + + if (range.attached && ! range.parentRange) { + range.detach(); + } } view = view._hasGeneratedParent && view.parentView; @@ -888,7 +895,7 @@ Blaze._addEventMap = function (view, eventMap, thisInHandler) { handles.push(Blaze._EventSupport.listen( element, newEvents, selector, function (evt) { - if (! range.containsElement(evt.currentTarget)) + if (! range.containsElement(evt.currentTarget, selector, newEvents)) return null; var handlerThis = thisInHandler || this; var handlerArgs = arguments; diff --git a/packages/blaze/view_tests.js b/packages/blaze/view_tests.js index c9f271723..2e49b4240 100644 --- a/packages/blaze/view_tests.js +++ b/packages/blaze/view_tests.js @@ -56,4 +56,24 @@ if (Meteor.isClient) { test.equal(buf, ""); }); + // this checks, whether a DOMRange is correctly marked as + // desroyed after Blaze.remove has destroyed + // the corresponding view + Tinytest.add("blaze - view - destroy", function (test) { + var v = { + _domrange: Blaze._DOMRange([]) + }; + v._domrange.view = Blaze.View(); + test.equal(v._domrange.view.isDestroyed, false); + Blaze.remove(v); + test.equal(v._domrange.view.isDestroyed, true); + }); + + // this checks, whether an unattached DOMRange notifies + // correctly about it's root cause, when throwing due to an event + Tinytest.add("blaze - view - attached", function (test) { + test.throws(() => Blaze._DOMRange.prototype.containsElement.call({attached: false, view: {name: 'Template.foo'}}, undefined, '.class', 'click'), + `click event triggerd with .class on foo but associated view is not be found. + Make sure the event doesn't destroy the view.`); + }); } diff --git a/packages/spacebars-tests/.versions b/packages/spacebars-tests/.versions index 76b5f7358..7fe5e486c 100644 --- a/packages/spacebars-tests/.versions +++ b/packages/spacebars-tests/.versions @@ -1,6 +1,6 @@ -allow-deny@1.1.0 -babel-compiler@7.6.1 -babel-runtime@1.5.0 +allow-deny@1.1.1 +babel-compiler@7.9.0 +babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 blaze@2.5.0 @@ -8,62 +8,62 @@ blaze-tools@1.1.0 boilerplate-generator@1.7.1 caching-compiler@1.2.2 caching-html-compiler@1.2.0 -callback-hook@1.3.0 +callback-hook@1.4.0 check@1.3.1 ddp@1.4.0 -ddp-client@2.4.0 +ddp-client@2.5.0 ddp-common@1.4.0 -ddp-server@2.3.2 +ddp-server@2.5.0 diff-sequence@1.1.1 -dynamic-import@0.6.0 -ecmascript@0.15.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.11.0 -ecmascript-runtime-server@0.10.0 -ejson@1.1.1 +dynamic-import@0.7.2 +ecmascript@0.16.2 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.2 es5-shim@4.8.0 fetch@0.1.1 geojson-utils@1.0.10 html-tools@1.1.0 htmljs@1.1.0 -id-map@1.1.0 +id-map@1.1.1 inter-process-messaging@0.1.1 jquery@1.11.10 -local-test:spacebars-tests@1.3.0 -logging@1.2.0 +local-test:spacebars-tests@1.3.1-rc.2 +logging@1.3.1 markdown@1.0.14 -meteor@1.9.3 -minimongo@1.6.2 -modern-browsers@0.1.5 -modules@0.16.0 -modules-runtime@0.12.0 -mongo@1.11.1 -mongo-decimal@0.1.2 +meteor@1.10.0 +minimongo@1.8.0 +modern-browsers@0.1.8 +modules@0.18.0 +modules-runtime@0.13.0 +mongo@1.15.0 +mongo-decimal@0.1.3 mongo-dev-server@1.1.0 -mongo-id@1.0.7 -npm-mongo@3.9.0 +mongo-id@1.0.8 +npm-mongo@4.3.1 observe-sequence@1.0.16 ordered-dict@1.1.0 -promise@0.11.2 +promise@0.12.0 random@1.2.0 -react-fast-refresh@0.1.0 +react-fast-refresh@0.2.3 reactive-dict@1.3.0 reactive-var@1.0.11 reload@1.3.1 retry@1.1.0 -routepolicy@1.1.0 +routepolicy@1.1.1 session@1.2.0 -socket-stream-client@0.3.1 +socket-stream-client@0.5.0 spacebars@1.2.0 spacebars-compiler@1.2.0 -spacebars-tests@1.3.0 +spacebars-tests@1.3.1-rc.2 templating@1.4.1 templating-compiler@1.4.1 templating-runtime@1.5.0 templating-tools@1.2.0 -test-helpers@1.2.0 -tinytest@1.1.0 +test-helpers@1.3.0 +tinytest@1.2.1 tracker@1.2.0 underscore@1.0.10 -webapp@1.10.1 +webapp@1.13.1 webapp-hashing@1.1.0 diff --git a/packages/spacebars-tests/old_templates.js b/packages/spacebars-tests/old_templates.js index e92edcb87..5cb450770 100644 --- a/packages/spacebars-tests/old_templates.js +++ b/packages/spacebars-tests/old_templates.js @@ -38,7 +38,7 @@ Template.__define__("old_spacebars_template_test_span_this", (function() { Template.__define__("old_spacebars_template_test_content", (function() { var view = this; - return Blaze.InOuterTemplateScope(view, function() { + return Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateContentBlock); }); @@ -47,7 +47,7 @@ Template.__define__("old_spacebars_template_test_content", (function() { Template.__define__("old_spacebars_template_test_elsecontent", (function() { var view = this; - return Blaze.InOuterTemplateScope(view, function() { + return Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateElseBlock); }); @@ -59,13 +59,13 @@ Template.__define__("old_spacebars_template_test_iftemplate", (function() { return Blaze.If(function() { return Spacebars.call(view.lookup("condition")); }, function() { - return [ "\n ", Blaze.InOuterTemplateScope(view, function() { + return [ "\n ", Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateContentBlock); }); }), "\n " ]; }, function() { - return [ "\n ", Blaze.InOuterTemplateScope(view, function() { + return [ "\n ", Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateElseBlock); }); @@ -125,7 +125,7 @@ Template.__define__("old_spacebars_template_test_triple2", (function() { Template.__define__("old_spacebars_template_test_inclusion_args", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.call(view.lookup("bar")); }, function() { return Spacebars.include(view.lookupTemplate("foo")); @@ -134,7 +134,7 @@ Template.__define__("old_spacebars_template_test_inclusion_args", (function() { Template.__define__("old_spacebars_template_test_inclusion_args2", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.dataMustache(view.lookup("bar"), Spacebars.kw({ q: view.lookup("baz") })); @@ -145,7 +145,7 @@ Template.__define__("old_spacebars_template_test_inclusion_args2", (function() { Template.__define__("old_spacebars_template_test_inclusion_dotted_args", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.call(Spacebars.dot(view.lookup("bar"), "baz")); }, function() { return Spacebars.include(view.lookupTemplate("foo")); @@ -154,7 +154,7 @@ Template.__define__("old_spacebars_template_test_inclusion_dotted_args", (functi Template.__define__("old_spacebars_template_test_inclusion_slashed_args", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.call(Spacebars.dot(view.lookup("bar"), "baz")); }, function() { return Spacebars.include(view.lookupTemplate("foo")); @@ -172,7 +172,7 @@ Template.__define__("old_spacebars_template_test_block_helper", (function() { Template.__define__("old_spacebars_template_test_block_helper_function_one_string_arg", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return "bar"; }, function() { return Spacebars.include(view.lookupTemplate("foo"), function() { @@ -183,7 +183,7 @@ Template.__define__("old_spacebars_template_test_block_helper_function_one_strin Template.__define__("old_spacebars_template_test_block_helper_function_one_helper_arg", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.call(view.lookup("bar")); }, function() { return Spacebars.include(view.lookupTemplate("foo"), function() { @@ -212,7 +212,7 @@ Template.__define__("old_spacebars_template_test_block_helper_component_three_he Template.__define__("old_spacebars_template_test_block_helper_dotted_arg", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return Spacebars.dataMustache(Spacebars.dot(view.lookup("bar"), "baz"), view.lookup("qux")); }, function() { return Spacebars.include(view.lookupTemplate("foo"), function() { @@ -223,7 +223,7 @@ Template.__define__("old_spacebars_template_test_block_helper_dotted_arg", (func Template.__define__("old_spacebars_template_test_nested_content", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return { condition: Spacebars.call(view.lookup("flag")) }; @@ -238,19 +238,19 @@ Template.__define__("old_spacebars_template_test_nested_content", (function() { Template.__define__("old_spacebars_template_test_iftemplate2", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return { condition: Spacebars.call(view.lookup("flag")) }; }, function() { return Spacebars.include(view.lookupTemplate("old_spacebars_template_test_iftemplate"), function() { - return [ "\n ", Blaze.InOuterTemplateScope(view, function() { + return [ "\n ", Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateContentBlock); }); }), "\n " ]; }, function() { - return [ "\n ", Blaze.InOuterTemplateScope(view, function() { + return [ "\n ", Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateElseBlock); }); @@ -261,7 +261,7 @@ Template.__define__("old_spacebars_template_test_iftemplate2", (function() { Template.__define__("old_spacebars_template_test_nested_content2", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return { flag: Spacebars.call(view.lookup("x")) }; @@ -333,7 +333,7 @@ Template.__define__("old_spacebars_template_test_dots", (function() { return [ "\n C\n ", Blaze.Each(function() { return Spacebars.call(view.lookup("items")); }, function() { - return [ "\n D\n \n ", Spacebars.include(view.lookupTemplate("old_spacebars_template_test_dots_subtemplate")), "\n ", Spacebars.TemplateWith(function() { + return [ "\n D\n \n ", Spacebars.include(view.lookupTemplate("old_spacebars_template_test_dots_subtemplate")), "\n ", Blaze._TemplateWith(function() { return Spacebars.call(view.lookup("..")); }, function() { return Spacebars.include(view.lookupTemplate("old_spacebars_template_test_dots_subtemplate")); @@ -755,7 +755,7 @@ Template.__define__("old_spacebars_template_test_markdown_block_helpers", (funct Template.__define__("old_spacebars_template_test_just_content", (function() { var view = this; - return Blaze.InOuterTemplateScope(view, function() { + return Blaze._InOuterTemplateScope(view, function() { return Spacebars.include(function() { return Spacebars.call(view.templateContentBlock); }); @@ -882,7 +882,7 @@ Template.__define__("old_spacebars_template_test_content_context", (function() { return [ "\n ", Spacebars.With(function() { return Spacebars.call(view.lookup("bar")); }, function() { - return [ "\n ", Spacebars.TemplateWith(function() { + return [ "\n ", Blaze._TemplateWith(function() { return { condition: Spacebars.call(view.lookup("cond")) }; @@ -1184,7 +1184,7 @@ Template.__define__("old_spacebars_test_falsy_with", (function() { Template.__define__("old_spacebars_test_helpers_dont_leak", (function() { var view = this; - return Spacebars.TemplateWith(function() { + return Blaze._TemplateWith(function() { return { foo: Spacebars.call("correct") }; @@ -1480,7 +1480,7 @@ Template.__define__("old_spacebars_test_template_created_rendered_destroyed_each return Blaze.Each(function() { return Spacebars.call(view.lookup("items")); }, function() { - return [ "\n ", HTML.DIV(Spacebars.TemplateWith(function() { + return [ "\n ", HTML.DIV(Blaze._TemplateWith(function() { return Spacebars.call(view.lookup("_id")); }, function() { return Spacebars.include(view.lookupTemplate("old_spacebars_test_template_created_rendered_destroyed_each_sub")); @@ -1687,8 +1687,8 @@ Template.__define__("old_spacebars_test_contentBlock_arg_inner", (function() { }, function() { return [ "\n ", Blaze.View(function() { return Spacebars.mustache(Spacebars.dot(view.lookup("."), "foo")); - }), " ", Blaze.InOuterTemplateScope(view, function() { - return Spacebars.TemplateWith(function() { + }), " ", Blaze._InOuterTemplateScope(view, function() { + return Blaze._TemplateWith(function() { return Spacebars.call(view.lookup(".")); }, function() { return Spacebars.include(function() { diff --git a/packages/spacebars-tests/package.js b/packages/spacebars-tests/package.js index d9a52c1fa..fbe8fa4aa 100644 --- a/packages/spacebars-tests/package.js +++ b/packages/spacebars-tests/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'spacebars-tests', summary: "Additional tests for Spacebars", - version: '1.3.0', + version: '1.3.1-rc.2', git: 'https://github.com/meteor/blaze.git' }); diff --git a/packages/templating-runtime/.versions b/packages/templating-runtime/.versions index d98b4a17c..847b1a6a1 100644 --- a/packages/templating-runtime/.versions +++ b/packages/templating-runtime/.versions @@ -1,62 +1,62 @@ -allow-deny@1.1.0 -babel-compiler@7.6.1 -babel-runtime@1.5.0 +allow-deny@1.1.1 +babel-compiler@7.9.0 +babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 -blaze@2.5.0 +blaze@2.6.1-rc.2 blaze-tools@1.1.0 boilerplate-generator@1.7.1 caching-compiler@1.2.2 caching-html-compiler@1.2.0 -callback-hook@1.3.0 +callback-hook@1.4.0 check@1.3.1 ddp@1.4.0 -ddp-client@2.4.0 +ddp-client@2.5.0 ddp-common@1.4.0 -ddp-server@2.3.2 +ddp-server@2.5.0 diff-sequence@1.1.1 -dynamic-import@0.6.0 -ecmascript@0.15.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.11.0 -ecmascript-runtime-server@0.10.0 -ejson@1.1.1 +dynamic-import@0.7.2 +ecmascript@0.16.2 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.2 fetch@0.1.1 geojson-utils@1.0.10 html-tools@1.1.0 -htmljs@1.1.0 -id-map@1.1.0 +htmljs@1.1.1 +id-map@1.1.1 inter-process-messaging@0.1.1 -local-test:templating-runtime@1.5.0 -logging@1.2.0 -meteor@1.9.3 -minimongo@1.6.2 -modern-browsers@0.1.5 -modules@0.16.0 -modules-runtime@0.12.0 -mongo@1.11.0 -mongo-decimal@0.1.2 +local-test:templating-runtime@1.6.1-rc.2 +logging@1.3.1 +meteor@1.10.0 +minimongo@1.8.0 +modern-browsers@0.1.8 +modules@0.18.0 +modules-runtime@0.13.0 +mongo@1.15.0 +mongo-decimal@0.1.3 mongo-dev-server@1.1.0 -mongo-id@1.0.7 -npm-mongo@3.9.0 +mongo-id@1.0.8 +npm-mongo@4.3.1 observe-sequence@1.0.16 ordered-dict@1.1.0 -promise@0.11.2 +promise@0.12.0 random@1.2.0 -react-fast-refresh@0.1.0 +react-fast-refresh@0.2.3 reactive-var@1.0.11 reload@1.3.1 retry@1.1.0 -routepolicy@1.1.0 -socket-stream-client@0.3.1 -spacebars@1.2.0 +routepolicy@1.1.1 +socket-stream-client@0.5.0 +spacebars@1.3.0 spacebars-compiler@1.2.0 templating-compiler@1.4.1 -templating-runtime@1.5.0 +templating-runtime@1.6.1-rc.2 templating-tools@1.2.0 -test-helpers@1.2.0 -tinytest@1.1.0 +test-helpers@1.3.0 +tinytest@1.2.1 tracker@1.2.0 underscore@1.0.10 -webapp@1.10.1 +webapp@1.13.1 webapp-hashing@1.1.0 diff --git a/packages/templating-runtime/package.js b/packages/templating-runtime/package.js index e5da34431..e2d410d49 100644 --- a/packages/templating-runtime/package.js +++ b/packages/templating-runtime/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'templating-runtime', summary: "Runtime for compiled .html files", - version: '1.6.0', + version: '1.6.1-rc.2', git: 'https://github.com/meteor/blaze.git', documentation: null }); @@ -23,13 +23,13 @@ Package.onUse(function (api) { // Blaze, so anybody using templating (eg apps) need to implicitly use // 'meteor' and 'blaze'. api.use([ - 'blaze@2.6.0', + 'blaze@2.6.1-rc.2', 'spacebars@1.2.1', 'ecmascript@0.15.1' ]); api.imply([ - 'meteor@1.2.17', // TODO update - 'blaze@2.6.0', + 'meteor@1.10.0', + 'blaze@2.6.1-rc.2', 'spacebars@1.2.1' ], 'client'); diff --git a/packages/templating-runtime/templating.js b/packages/templating-runtime/templating.js index 223226310..a775607d8 100644 --- a/packages/templating-runtime/templating.js +++ b/packages/templating-runtime/templating.js @@ -26,6 +26,27 @@ Template.__checkName = function (name) { } }; +var shownWarning = false; + +// XXX COMPAT WITH 0.8.3 +Template.__define__ = function (name, renderFunc) { + Template.__checkName(name); + Template[name] = new Template("Template." + name, renderFunc); + // Exempt packages built pre-0.9.0 from warnings about using old + // helper syntax, because we can. It's not very useful to get a + // warning about someone else's code (like a package on Atmosphere), + // and this should at least put a bit of a dent in number of warnings + // that come from packages that haven't been updated lately. + Template[name]._NOWARN_OLDSTYLE_HELPERS = true; + + // Now we want to show at least one warning so that people get serious about + // updating away from this method. + if (!shownWarning) { + shownWarning = true; + console.warn("You app is using old Template definition that is scheduled to be removed with Blaze 3.0, please check your app and packages for use of: Template.__define__"); + } +}; + // Define a template `Template.body` that renders its // `contentRenderFuncs`. `` tags (of which there may be // multiple) will have their contents added to it.