Skip to main content
added 228 characters in body
Source Link
konijn
  • 34.4k
  • 5
  • 71
  • 267

In all, quite impressive code, here are some pointers:

  • Besides the suggestion to compare with 0 via ===, JsHint could not find anything

  • Consider using addEventListener instead of the old skool onxxx

  • I would put preview(); and createURL(); together instead of having them in the middle of event handler assignments, either right after the var assignments or at the very bottom.

  • Or you could even consider faking a click on 'resetter' which does all that, if you dont use addEventListener, you could simply do

      document.getElementById('resetter').onclick();  
    
  • TernaryTernary can be your friend here:

       if (resizerVal == 0) {
           editor.className = 'minSize';
       } else {
           editor.className = '';
       }
    

    can be

       editor.className = resizerVal ? '' : 'minSize';
    

In all, quite impressive code, here are some pointers:

  • Besides the suggestion to compare with 0 via ===, JsHint could not find anything

  • Consider using addEventListener instead of the old skool onxxx

  • I would put preview(); and createURL(); together instead of having them in the middle of event handler assignments, either right after the var assignments or at the very bottom.

  • Or you could even consider faking a click on 'resetter' which does all that

  • Ternary can be your friend here:

       if (resizerVal == 0) {
           editor.className = 'minSize';
       } else {
           editor.className = '';
       }
    

    can be

       editor.className = resizerVal ? '' : 'minSize';
    

In all, quite impressive code, here are some pointers:

  • Besides the suggestion to compare with 0 via ===, JsHint could not find anything

  • Consider using addEventListener instead of the old skool onxxx

  • I would put preview(); and createURL(); together instead of having them in the middle of event handler assignments, either right after the var assignments or at the very bottom.

  • Or you could even consider faking a click on 'resetter' which does all that, if you dont use addEventListener, you could simply do

      document.getElementById('resetter').onclick();  
    
  • Ternary can be your friend here:

       if (resizerVal == 0) {
           editor.className = 'minSize';
       } else {
           editor.className = '';
       }
    

    can be

       editor.className = resizerVal ? '' : 'minSize';
    
Source Link
konijn
  • 34.4k
  • 5
  • 71
  • 267

In all, quite impressive code, here are some pointers:

  • Besides the suggestion to compare with 0 via ===, JsHint could not find anything

  • Consider using addEventListener instead of the old skool onxxx

  • I would put preview(); and createURL(); together instead of having them in the middle of event handler assignments, either right after the var assignments or at the very bottom.

  • Or you could even consider faking a click on 'resetter' which does all that

  • Ternary can be your friend here:

       if (resizerVal == 0) {
           editor.className = 'minSize';
       } else {
           editor.className = '';
       }
    

    can be

       editor.className = resizerVal ? '' : 'minSize';