diff --git a/src/index.js b/src/index.js index a3c8a6d44..6d0d07962 100755 --- a/src/index.js +++ b/src/index.js @@ -136,7 +136,7 @@ class ReactTooltip extends React.Component { * For unify the bind and unbind listener */ bind(methodArray) { - methodArray.forEach((method) => { + methodArray.forEach(method => { this[method] = this[method].bind(this); }); } @@ -152,7 +152,7 @@ class ReactTooltip extends React.Component { static getDerivedStateFromProps(nextProps, prevState) { const { ariaProps } = prevState; const newAriaProps = parseAria(nextProps); - const isChanged = Object.keys(newAriaProps).some((props) => { + const isChanged = Object.keys(newAriaProps).some(props => { return newAriaProps[props] !== ariaProps[props]; }); if (!isChanged) { @@ -247,8 +247,8 @@ class ReactTooltip extends React.Component { // Scan document for shadow DOM elements nodeListToArray(document.getElementsByTagName('*')) - .filter((element) => element.shadowRoot) - .forEach((element) => { + .filter(element => element.shadowRoot) + .forEach(element => { targetArray = targetArray.concat( nodeListToArray(element.shadowRoot.querySelectorAll(selector)) ); @@ -266,7 +266,7 @@ class ReactTooltip extends React.Component { const { id, globalEventOff, isCapture } = this.props; const targetArray = this.getTargetArray(id); - targetArray.forEach((target) => { + targetArray.forEach(target => { if (target.getAttribute('currentItem') === null) { target.setAttribute('currentItem', 'false'); } @@ -279,7 +279,7 @@ class ReactTooltip extends React.Component { if (this.isBodyMode()) { this.bindBodyListener(targetArray); } else { - targetArray.forEach((target) => { + targetArray.forEach(target => { const isCaptureMode = this.isCapture(target); const effect = this.getEffect(target); if (this.isCustomEvent(target)) { @@ -320,7 +320,7 @@ class ReactTooltip extends React.Component { this.unbindBodyListener(); } else { const targetArray = this.getTargetArray(id); - targetArray.forEach((target) => { + targetArray.forEach(target => { this.unbindBasicListener(target); if (this.isCustomEvent(target)) this.customUnbindListener(target); }); @@ -382,7 +382,7 @@ class ReactTooltip extends React.Component { if (isGlobalCall) { // Don't trigger other elements belongs to other ReactTooltip const targetArray = this.getTargetArray(this.props.id); - const isMyElement = targetArray.some((ele) => ele === e.currentTarget); + const isMyElement = targetArray.some(ele => ele === e.currentTarget); if (!isMyElement) return; } // Get the tooltip content @@ -624,7 +624,7 @@ class ReactTooltip extends React.Component { if (hasTarget) { // Don't trigger other elements belongs to other ReactTooltip const targetArray = this.getTargetArray(this.props.id); - const isMyElement = targetArray.some((ele) => ele === e.currentTarget); + const isMyElement = targetArray.some(ele => ele === e.currentTarget); if (!isMyElement || !this.state.show) return; } @@ -742,7 +742,7 @@ class ReactTooltip extends React.Component { hasCustomColors() { return Boolean( Object.keys(this.state.customColors).find( - (color) => color !== 'border' && this.state.customColors[color] + color => color !== 'border' && this.state.customColors[color] ) || (this.state.border && this.state.customColors['border']) ); @@ -786,7 +786,7 @@ class ReactTooltip extends React.Component { (this.tooltipRef = ref)} + ref={ref => (this.tooltipRef = ref)} {...ariaProps} data-id="tooltip" dangerouslySetInnerHTML={{ __html: htmlContent }} @@ -798,7 +798,7 @@ class ReactTooltip extends React.Component { className={`${wrapperClassName}`} id={this.props.id || uuid} {...ariaProps} - ref={(ref) => (this.tooltipRef = ref)} + ref={ref => (this.tooltipRef = ref)} data-id="tooltip" >