Strict mode and Dojo declare - Workaround 2

by Deepak Anand

HTML

<div id="output"></div>

JavaScript

// Strict mode with Dojo declare
// Trying a suggested solution from
// http://comments.gmane.org/gmane.comp.web.dojo.devel/16739

require([
  "dojo/_base/declare"  
], function(declare){	
    'use strict';
        var output,
            buffer = '',
            log = function (msg) {
                output.innerHTML = (buffer += msg + '<br>');
            },
            A = declare(null, {
                go: function () {
                    log('A');
                }
            }),
            B = declare([A], {
                go: function go() {                
                    this.inherited(B.prototype.go, arguments);
                    log('B');
                }
            });
        
        
            output = document.getElementById('output');
            log('starting...');
            
            log('should see "A B"');
            var it = new B();
            it.go();
   
});