Skip to main content
added 1 characters in body
Source Link
konijn
  • 33.8k
  • 5
  • 69
  • 264

On the whole, I think you notneed to work on keeping it simple.

  • I would not write my own cross-browser event handling function if I use jQuery, I would leverage what jQuery provides.

  • This:

      /* standard JS */
      function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }
    
      /* initialise standard JS on load and pass in the jQuery object */
      (function init(jQuery) {
          var js = new InitStandard(jQuery);
      }(jQuery));
    

    could be

      (function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }(jQuery));
    

    Because you are not using var js anywhere.
    Also, 1 should be assigned to a properly named constant like ADVANCED_DEVICE

  • addEvent(window, 'load', init); could be $( init )

On the whole, I think you not to work on keeping it simple.

  • I would not write my own cross-browser event handling function if I use jQuery, I would leverage what jQuery provides.

  • This:

      /* standard JS */
      function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }
    
      /* initialise standard JS on load and pass in the jQuery object */
      (function init(jQuery) {
          var js = new InitStandard(jQuery);
      }(jQuery));
    

    could be

      (function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }(jQuery));
    

    Because you are not using var js anywhere.
    Also, 1 should be assigned to a properly named constant like ADVANCED_DEVICE

  • addEvent(window, 'load', init); could be $( init )

On the whole, I think you need to work on keeping it simple.

  • I would not write my own cross-browser event handling function if I use jQuery, I would leverage what jQuery provides.

  • This:

      /* standard JS */
      function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }
    
      /* initialise standard JS on load and pass in the jQuery object */
      (function init(jQuery) {
          var js = new InitStandard(jQuery);
      }(jQuery));
    

    could be

      (function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }(jQuery));
    

    Because you are not using var js anywhere.
    Also, 1 should be assigned to a properly named constant like ADVANCED_DEVICE

  • addEvent(window, 'load', init); could be $( init )

Source Link
konijn
  • 33.8k
  • 5
  • 69
  • 264

On the whole, I think you not to work on keeping it simple.

  • I would not write my own cross-browser event handling function if I use jQuery, I would leverage what jQuery provides.

  • This:

      /* standard JS */
      function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }
    
      /* initialise standard JS on load and pass in the jQuery object */
      (function init(jQuery) {
          var js = new InitStandard(jQuery);
      }(jQuery));
    

    could be

      (function InitStandard(jQuery) {
          //get device information
          this.device = new Device();
    
          // initialise jQuery, if device is capable
          if (this.device.quality === 1) {
              this.jqueryPlugins = new InitJquery(jQuery);
          }
      }(jQuery));
    

    Because you are not using var js anywhere.
    Also, 1 should be assigned to a properly named constant like ADVANCED_DEVICE

  • addEvent(window, 'load', init); could be $( init )