We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bf88acf commit fca0474Copy full SHA for fca0474
js/view.js
@@ -17,6 +17,8 @@ import Error from './error';
17
*
18
* @arg {Node} node - The node to attach the view to. Throws an error if the node
19
* is not provided.
20
+ *
21
+ * @property {View} parent - The parent view
22
*/
23
export default class View extends Emitter {
24
constructor(node) {
@@ -28,6 +30,11 @@ export default class View extends Emitter {
28
30
}
29
31
32
33
+ get parent() {
34
+ const parent = this.$node.parentElement;
35
+ return parent ? new View(parent) : null;
36
+ }
37
+
38
/**
39
* Query the view to return a single element within the node.
40
* @param {string} selector - The query.
0 commit comments