mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Make view.isAttached private again
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user