From d933a149e1f069fb69ccd3c686cd3ca5fd3a90de Mon Sep 17 00:00:00 2001 From: Chris Malley Date: Tue, 23 Aug 2016 17:53:14 -0600 Subject: [PATCH] use && pattern to add optional subcomponents, #261 --- js/WavelengthSlider.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/WavelengthSlider.js b/js/WavelengthSlider.js index 516c241e2..7dff1002f 100644 --- a/js/WavelengthSlider.js +++ b/js/WavelengthSlider.js @@ -177,12 +177,10 @@ define( function( require ) { thisNode.addChild( track ); thisNode.addChild( trackBorder ); thisNode.addChild( thumb ); - if ( valueDisplay ) { thisNode.addChild( valueDisplay ); } - if ( cursor ) { thisNode.addChild( cursor ); } - if ( options.tweakersVisible ) { - thisNode.addChild( plusButton ); - thisNode.addChild( minusButton ); - } + valueDisplay && thisNode.addChild( valueDisplay ); + cursor && thisNode.addChild( cursor ); + plusButton && thisNode.addChild( plusButton ); + minusButton && thisNode.addChild( minusButton ); // layout if ( cursor ) { cursor.top = track.top; }