Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TylerThompson/cc5da9ced7da11ec7134 to your computer and use it in GitHub Desktop.
Save TylerThompson/cc5da9ced7da11ec7134 to your computer and use it in GitHub Desktop.
String transversePage(Event event, String attribute){
Element findElm = ((event.target) as Element);
String name;
if(findElm.getAttribute('$attribute') != null){
name = findElm.getAttribute('$attribute');
} else {
for(int i = 0; i<=findElm.children.length;i++) {
if (findElm != null) {
if (findElm.children.length != i) {
if (findElm.children[i] != null) {
if (findElm.children[i].getAttribute('$attribute') != null) {
name = findElm.children[i].getAttribute('$attribute');
break;
}
}
}
}
}
}
return name;
}
@TylerThompson
Copy link
Author

It checks the element that was clicked, returns if the target attribute was found on clicked element or scales down the children of whatever was clicked and returns the attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment