This repository was archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a helper for getting shadowRoots by element name, e.g. this.shado…
…wRoots['x-foo']; fixes Polymer/polymer#310
- Loading branch information
Showing
3 changed files
with
58 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>shadowRoots test</title> | ||
<script src="../../../platform/platform.js"></script> | ||
<link rel="import" href="../../polymer.html"> | ||
<script src="../../../tools/test/htmltest.js"></script> | ||
<script src="../../../tools/test/chai/chai.js"></script> | ||
</head> | ||
<body> | ||
|
||
<x-zot>I am x-foo.</x-zot> | ||
|
||
<polymer-element name="x-foo" noscript> | ||
|
||
<template> | ||
<div id="foo"></div> | ||
</template> | ||
|
||
</polymer-element> | ||
|
||
<polymer-element name="x-bar" extends="x-foo" noscript> | ||
|
||
<template> | ||
<div id="bar"></div> | ||
</template> | ||
|
||
</polymer-element> | ||
|
||
<polymer-element name="x-zot" extends="x-bar"> | ||
<template> | ||
<div id="zot"></div> | ||
</template> | ||
<script> | ||
Polymer('x-zot', { | ||
ready: function() { | ||
chai.assert.equal(this.shadowRoots['x-foo'].querySelector('#foo'), | ||
this.$.foo); | ||
chai.assert.equal(this.shadowRoots['x-bar'].querySelector('#bar'), | ||
this.$.bar); | ||
chai.assert.equal(this.shadowRoots['x-zot'].querySelector('#zot'), | ||
this.$.zot); | ||
done(); | ||
} | ||
}); | ||
</script> | ||
</polymer-element> | ||
</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