Skip to content

Commit

Permalink
Projector Plugin: Fix bookmark loading (issue tensorflow#4159)
Browse files Browse the repository at this point in the history
Bookmark loading currently fails because of a missing type check. This change makes sure the object that is checked against is actually an HTMLElement.
  • Loading branch information
aknoerig authored Sep 14, 2020
1 parent 8a8788c commit 6e0a216
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ class BookmarkPanel extends LegacyElementMixin(PolymerElement) {
*/
private getParentDataIndex(evt: Event) {
for (let i = 0; i < (evt as any).path.length; i++) {
let dataIndex = (evt as any).path[i].getAttribute('data-index');
if (dataIndex != null) {
return +dataIndex;
let elem = (evt as any).path[i];
if (elem instanceof HTMLElement) {
let dataIndex = elem.getAttribute('data-index');
if (dataIndex != null) {
return +dataIndex;
}
}
}
return -1;
Expand Down

0 comments on commit 6e0a216

Please sign in to comment.