Make view.isAttached private again

This commit is contained in:
David Greenspan
2014-08-26 17:32:15 -07:00
parent dd77f94035
commit bdb9ddfaae
2 changed files with 6 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ Blaze.View = function (name, render) {
this.isCreated = false;
this._isCreatedForExpansion = false;
this.isRendered = false;
this.isAttached = false;
this._isAttached = false;
this.isDestroyed = false;
this._isInRender = false;
this.parentView = null;
@@ -168,14 +168,14 @@ Blaze.View.prototype.autorun = function (f, _inViewScope) {
};
Blaze.View.prototype.firstNode = function () {
if (! this.isAttached)
if (! this._isAttached)
throw new Error("View must be attached before accessing its DOM");
return this._domrange.firstNode();
};
Blaze.View.prototype.lastNode = function () {
if (! this.isAttached)
if (! this._isAttached)
throw new Error("View must be attached before accessing its DOM");
return this._domrange.lastNode();
@@ -249,7 +249,7 @@ Blaze._materializeView = function (view, parentView) {
var teardownHook = null;
domrange.onAttached(function attached(range, element) {
view.isAttached = true;
view._isAttached = true;
teardownHook = Blaze._DOMBackend.Teardown.onElementTeardown(
element, function teardown() {

View File

@@ -26,7 +26,7 @@ if (Meteor.isClient) {
var div = document.createElement("DIV");
test.isFalse(v.isRendered);
test.isFalse(v.isAttached);
test.isFalse(v._isAttached);
test.equal(canonicalizeHtml(div.innerHTML), "");
test.throws(function () { v.firstNode(); }, /View must be attached/);
test.throws(function () { v.lastNode(); }, /View must be attached/);
@@ -35,7 +35,7 @@ if (Meteor.isClient) {
test.equal(typeof (v.firstNode().nodeType), "number");
test.equal(typeof (v.lastNode().nodeType), "number");
test.isTrue(v.isRendered);
test.isTrue(v.isAttached);
test.isTrue(v._isAttached);
test.equal(buf, 'c0r1');
test.equal(canonicalizeHtml(div.innerHTML), "foo");
Deps.flush();