mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Minor tweaks
This commit is contained in:
@@ -156,4 +156,4 @@ outerRange.attach(document.body);
|
||||
// outerRange.stop();
|
||||
// ```
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
24
packages/blaze/materialize.js
vendored
24
packages/blaze/materialize.js
vendored
@@ -5,10 +5,10 @@
|
||||
// computation).
|
||||
Blaze._inDummyComputation = function (f) {
|
||||
var ret;
|
||||
Deps.autorun(function (c) {
|
||||
Blaze._wrapAutorun(Deps.autorun(function (c) {
|
||||
c.stop();
|
||||
ret = f();
|
||||
});
|
||||
}));
|
||||
return ret;
|
||||
};
|
||||
|
||||
@@ -26,6 +26,11 @@ Blaze.ToTextVisitor = HTML.ToTextVisitor.extend({
|
||||
}
|
||||
});
|
||||
|
||||
var ToTextController = Blaze.ToTextController = function () {
|
||||
Blaze.Controller.call(this);
|
||||
};
|
||||
__extends(Blaze.ToTextController, Blaze.Controller);
|
||||
|
||||
Blaze.toText = function (content, textMode) {
|
||||
if (! Deps.active) {
|
||||
return Blaze._inDummyComputation(function () {
|
||||
@@ -43,7 +48,10 @@ Blaze.toText = function (content, textMode) {
|
||||
var visitor = new Blaze.ToTextVisitor;
|
||||
visitor.textMode = textMode;
|
||||
|
||||
return visitor.visit(content);
|
||||
var controller = (Blaze.currentController || new ToTextController);
|
||||
return Blaze.withCurrentController(controller, function () {
|
||||
return visitor.visit(content);
|
||||
});
|
||||
};
|
||||
|
||||
////////////////////////////// Blaze.toHTML
|
||||
@@ -60,6 +68,11 @@ Blaze.ToHTMLVisitor = HTML.ToHTMLVisitor.extend({
|
||||
}
|
||||
});
|
||||
|
||||
var ToHTMLController = Blaze.ToHTMLController = function () {
|
||||
Blaze.Controller.call(this);
|
||||
};
|
||||
__extends(Blaze.ToHTMLController, Blaze.Controller);
|
||||
|
||||
// This function is mainly for server-side rendering and is not in the normal
|
||||
// code path for client-side rendering.
|
||||
Blaze.toHTML = function (content) {
|
||||
@@ -68,7 +81,10 @@ Blaze.toHTML = function (content) {
|
||||
return Blaze.toHTML(content);
|
||||
});
|
||||
}
|
||||
return (new Blaze.ToHTMLVisitor).visit(content);
|
||||
var controller = (Blaze.currentController || new ToHTMLController);
|
||||
return Blaze.withCurrentController(controller, function () {
|
||||
return (new Blaze.ToHTMLVisitor).visit(content);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user