Skip to content

Commit

Permalink
jacline: Add ViewBase
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed Aug 9, 2024
1 parent 58b069d commit 2a4206b
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.kohlschutter.dumbo.js;

import java.util.Objects;

import elemental2.dom.Element;
import elemental2.dom.Node;

public abstract class ViewBase {
private final Node parent;

protected ViewBase(Node parentNode) {
this.parent = Objects.requireNonNull(parentNode, "parentNode");
}

protected Element querySelector(String selectors) {
return parent.querySelector(selectors);
}

protected Node getParentNode() {
return parent;
}

protected Element querySelector(Element ref, String selectors) {
if (ref == null) {
return null;
}
return ref.querySelector(selectors);
}
}

0 comments on commit 2a4206b

Please sign in to comment.