diff --git a/src/app/components/tree/tree.ts b/src/app/components/tree/tree.ts index 758e16f6a94..5610918f51f 100755 --- a/src/app/components/tree/tree.ts +++ b/src/app/components/tree/tree.ts @@ -1369,14 +1369,9 @@ export class Tree implements OnInit, AfterContentInit, OnChanges, OnDestroy, Blo onNodeRightClick(event: MouseEvent, node: TreeNode) { if (this.contextMenu) { let eventTarget = event.target; - let className; + let className = eventTarget.getAttribute('class'); - if (eventTarget instanceof SVGElement) { - className = eventTarget.getAttribute('class'); - } else { - className = eventTarget.className; - } - if (className && className.indexOf('p-tree-toggler') === 0) { + if (className && className.includes('p-tree-toggler')) { return; } else { let index = this.findIndexInSelection(node);