-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically manage binding state such that elements can be garbage …
…collected normally. - when elements are inserted and removed normally, they will be cleaned up automatically. - when an element is not inserted into the dom, you must call cancelUnbindAll() on it for bindings to remain active and subsequently must call unbindAll to dispose of it. - WARNING: insertedCallback changed to inserted; removedCallback changed to removed; attributeChangedCallback changed to attributeChanged.
- Loading branch information
Showing
13 changed files
with
623 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>event path</title> | ||
<script src="../../polymer.js"></script> | ||
<script src="../../tools/test/htmltest.js"></script> | ||
<script src="../../node_modules/chai/chai.js"></script> | ||
</head> | ||
<body> | ||
|
||
<x-base></x-base> | ||
|
||
<x-extendor></x-extendor> | ||
|
||
<element name="x-base"> | ||
<script> | ||
Polymer.register(this, { | ||
ready: function() { | ||
this.isReadied = true; | ||
}, | ||
inserted: function() { | ||
this.isInserted = true; | ||
}, | ||
removed: function() { | ||
this.isRemoved = true; | ||
}, | ||
attributeChanged: function() { | ||
this.hasAttributeChanged = true; | ||
} | ||
}); | ||
</script> | ||
</element> | ||
|
||
<element name="x-extendor" extends="x-base"> | ||
<script> | ||
Polymer.register(this, { | ||
ready: function() { | ||
this.extendedIsReadied = true; | ||
this.super(); | ||
}, | ||
inserted: function() { | ||
this.extendedIsInserted = true; | ||
this.super(); | ||
}, | ||
removed: function() { | ||
this.extendedIsRemoved = true; | ||
this.super(); | ||
}, | ||
attributeChanged: function() { | ||
this.extendedHasAttributeChanged = true; | ||
this.super(); | ||
} | ||
}); | ||
</script> | ||
</element> | ||
|
||
<script> | ||
document.addEventListener('WebComponentsReady', function() { | ||
var xBase = document.querySelector('x-base'); | ||
chai.assert.equal(xBase.isReadied, true); | ||
chai.assert.equal(xBase.isInserted, true); | ||
xBase.setAttribute('foo', 'foo'); | ||
chai.assert.equal(xBase.hasAttributeChanged, true); | ||
|
||
var xExtendor = document.querySelector('x-extendor'); | ||
chai.assert.equal(xExtendor.isReadied, true); | ||
chai.assert.equal(xExtendor.extendedIsReadied, true); | ||
chai.assert.equal(xExtendor.isInserted, true); | ||
chai.assert.equal(xExtendor.extendedIsInserted, true); | ||
xExtendor.setAttribute('foo', 'foo'); | ||
chai.assert.equal(xExtendor.hasAttributeChanged, true); | ||
chai.assert.equal(xExtendor.extendedHasAttributeChanged, true); | ||
|
||
xBase.parentNode.removeChild(xBase); | ||
xExtendor.parentNode.removeChild(xExtendor); | ||
|
||
setTimeout(function() { | ||
chai.assert.equal(xBase.isRemoved, true); | ||
chai.assert.equal(xExtendor.isRemoved, true); | ||
chai.assert.equal(xExtendor.extendedIsRemoved, true); | ||
done(); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.