Skip to content

Commit fca0474

Browse files
committed
Upgraded and added parent view
1 parent bf88acf commit fca0474

File tree

3 files changed

+435
-341
lines changed

3 files changed

+435
-341
lines changed

js/view.js

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import Error from './error';
1717
*
1818
* @arg {Node} node - The node to attach the view to. Throws an error if the node
1919
* is not provided.
20+
*
21+
* @property {View} parent - The parent view
2022
*/
2123
export default class View extends Emitter {
2224
constructor(node) {
@@ -28,6 +30,11 @@ export default class View extends Emitter {
2830
}
2931
}
3032

33+
get parent() {
34+
const parent = this.$node.parentElement;
35+
return parent ? new View(parent) : null;
36+
}
37+
3138
/**
3239
* Query the view to return a single element within the node.
3340
* @param {string} selector - The query.

0 commit comments

Comments
 (0)