From e69132b40aba81a1edd6f8bd7c9d3279ca67e108 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Mon, 20 May 2024 20:31:30 -0500 Subject: [PATCH] Constant a lookup. --- shared/naturalcrit/splitPane/splitPane.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 217fcc80c..e1b30887e 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -43,7 +43,7 @@ const SplitPane = createClass({ window.addEventListener('resize', this.handleWindowResize); }, - componentWillUnmount : function() { +componentWillUnmount : function() { window.removeEventListener('resize', this.handleWindowResize); }, @@ -123,12 +123,14 @@ const SplitPane = createClass({ style={{ left: this.state.currentDividerPos-4 }} onClick={()=>{ this.setState({ liveScroll: !this.state.liveScroll }); - if(document.getElementById('scrollToggle').classList.contains('fa-unlock')) { - document.getElementById('scrollToggle').className = 'fas fa-lock'; - document.getElementById('scrollToggleDiv').className = 'arrow lock'; + const toggle = document.getElementById('scrollToggle'); + const toggleDiv = document.getElementById('scrollToggleDiv'); + if(toggle.classList.contains('fa-unlock')) { + toggle.className = 'fas fa-lock'; + toggleDiv.className = 'arrow lock'; } else { - document.getElementById('scrollToggle').className = 'fas fa-unlock'; - document.getElementById('scrollToggleDiv').className = 'arrow unlock'; + toggle.className = 'fas fa-unlock'; + toggleDiv.className = 'arrow unlock'; } }} >