Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
callParent() breaks Firefox when using js strict mode
Now this is strange: When I use "use strict"; and then define a class with a custom constructor, calling callParent() breaks Firefox (4 at least) with this error:
Error: access to strict mode caller function is censored
. It works in Chrome, though...
-
Thanks, leaving this code here for when we get to this bug.
Code:
Ext.define('Test.Panel', {
extend : 'Ext.panel.Panel',
initComponent: function() {
"use strict";
var me = this;
me.html = 'Hello';
me.title = 'Test';
me.callParent(arguments);
}
});
Ext.onReady(function() {
var panel = Ext.create('Test.Panel', {
renderTo : Ext.getBody(),
width : 400,
height : 400
});
});
-
We don't support JavaScript strict mode via "use strict" (not to be confused with HTML strict mode)
Sencha Touch Lead Architect
-
Ext JS Premium Member
Do you plan to support "use strict"; in future releases of ExtJS or is it impossible to combine this with the Class Hierarchy approach that is used in ExtJS?
-
Ext JS Premium Member
Is this a design decision? Have other extension mechanisms not using parent (caller, callee) been considered?
EcmaScript strict mode is a very good help for avoiding common pitfalls. It's also a security measure in production and using it allows for further optimization in JavaScript engines.
-
+1 for "strict mode" compatibility in future Versions (faster execution time).
-
Ext JS Premium Member
+1 for "strict mode"
-
Sencha User
Ditto in favor of strict mode
It's a fact of life, and being incompatible with it is tying the hands of the application developers.
-
Ext JS Premium Member
I've been working round it by putting all the init code in a separate function which I can use strict mode with. E.g.
Code:
initComponent: function () {
this.strictInitComponent();
this.callParent(arguments);
},
strictInitComponent: function () {
"use strict";
// setup code goes here
}
-
Ext JS Premium Member
Please add this to the roadmap. +1