I need to check if a clicked element is child of another, using jQuery I would do: $(event.target).parents('#foo').length === 1
but with dart I have no clue.
void main(){
(querySelector('body') as BodyElement).onClick.listen(onGlobalClick);
}
onGlobalClick(Event event){
Element element = event.target;
//Check if `element` is child of an element with an id of 'foo'
}
element.contains(event.target)
should return whether event.target
is a descendant of element