Skip to content

Commit

Permalink
add no-multi-assign-on-declaration lint rule, phetsims/chipper#794
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 7, 2019
1 parent 141b983 commit d76d42f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions js/display/drawables/CircleDOMDrawable.js
Expand Up @@ -48,10 +48,12 @@ define( require => {
// allocation and performance costs)
if ( !this.fillElement || !this.strokeElement ) {
// @protected {HTMLDivElement} - Will contain the fill by manipulating borderRadius
const fillElement = this.fillElement = document.createElement( 'div' );
const fillElement = document.createElement( 'div' );
this.fillElement = fillElement;

// @protected {HTMLDivElement} - Will contain the stroke by manipulating borderRadius
const strokeElement = this.strokeElement = document.createElement( 'div' );
const strokeElement = document.createElement( 'div' );
this.strokeElement = strokeElement;

fillElement.style.display = 'block';
fillElement.style.position = 'absolute';
Expand Down
6 changes: 4 additions & 2 deletions js/display/drawables/RectangleDOMDrawable.js
Expand Up @@ -41,14 +41,16 @@ define( require => {
// only create elements if we don't already have them (we pool visual states always, and depending on the platform may also pool the actual elements to minimize
// allocation and performance costs)
if ( !this.fillElement || !this.strokeElement ) {
const fillElement = this.fillElement = document.createElement( 'div' );
const fillElement = document.createElement( 'div' );
this.fillElement = fillElement;
fillElement.style.display = 'block';
fillElement.style.position = 'absolute';
fillElement.style.left = '0';
fillElement.style.top = '0';
fillElement.style.pointerEvents = 'none';

const strokeElement = this.strokeElement = document.createElement( 'div' );
const strokeElement = document.createElement( 'div' );
this.strokeElement = strokeElement;
strokeElement.style.display = 'block';
strokeElement.style.position = 'absolute';
strokeElement.style.left = '0';
Expand Down
3 changes: 2 additions & 1 deletion js/display/drawables/TextSVGDrawable.js
Expand Up @@ -41,7 +41,8 @@ define( require => {

if ( !this.svgElement ) {
// @protected {SVGTextElement} - Sole SVG element for this drawable, implementing API for SVGSelfDrawable
const text = this.svgElement = document.createElementNS( scenery.svgns, 'text' );
const text = document.createElementNS( scenery.svgns, 'text' );
this.svgElement = text;
text.appendChild( document.createTextNode( '' ) );

// TODO: flag adjustment for SVG qualities
Expand Down
3 changes: 2 additions & 1 deletion js/overlays/ShapeBasedOverlay.js
Expand Up @@ -18,12 +18,13 @@ define( require => {
this.display = display;
this.rootNode = rootNode;

const svg = this.svg = document.createElementNS( scenery.svgns, 'svg' );
const svg = document.createElementNS( scenery.svgns, 'svg' );
svg.style.position = 'absolute';
svg.setAttribute( 'class', name );
svg.style.top = 0;
svg.style.left = 0;
svg.style[ 'pointer-events' ] = 'none';
this.svg = svg;

function resize( width, height ) {
svg.setAttribute( 'width', width );
Expand Down

0 comments on commit d76d42f

Please sign in to comment.