Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
replace classList with dataset for contextMenu
Browse files Browse the repository at this point in the history
Fix #10443
Auditors: @luixxiul, @bsclifton
  • Loading branch information
cezaraugusto committed Aug 11, 2017
1 parent d5a6317 commit 331a29b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/renderer/components/common/contextMenu/contextMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const windowActions = require('../../../../../js/actions/windowActions')
// Utils
const cx = require('../../../../../js/lib/classSet')
const {formatAccelerator} = require('../../../../common/lib/formatUtil')
const {elementHasDataset} = require('../../../../../js/lib/eventUtil')

class ContextMenuItem extends ImmutableComponent {
componentDidMount () {
Expand Down Expand Up @@ -94,11 +95,11 @@ class ContextMenuItem extends ImmutableComponent {

if (this.hasSubmenu) {
let node = e.target
while (node && node.classList && !node.classList.contains('contextMenuItem')) {
while (node && elementHasDataset(node, 'contextMenuItem')) {
node = node.parentNode
}
let parentNode = node.parentNode
while (parentNode && parentNode.classList && !parentNode.classList.contains('contextMenu')) {
while (parentNode && !elementHasDataset(parentNode, 'contextMenu')) {
parentNode = parentNode.parentNode
}
const parentBoundingRect = parentNode.getBoundingClientRect()
Expand Down Expand Up @@ -166,6 +167,7 @@ class ContextMenuItem extends ImmutableComponent {
}

return <div {...props}
data-context-menu-item
ref={(node) => { this.node = node }}
draggable={this.props.contextMenuItem.get('draggable')}
onDragStart={this.onDragStart.bind(this)}
Expand Down

0 comments on commit 331a29b

Please sign in to comment.