diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js
index f01467fc5..4a87ba6d8 100644
--- a/IPython/html/static/notebook/js/cell.js
+++ b/IPython/html/static/notebook/js/cell.js
@@ -39,18 +39,28 @@ var IPython = (function (IPython) {
this.placeholder = options.placeholder || '';
this.read_only = options.cm_config.readOnly;
this.selected = false;
- this.element = null;
this.metadata = {};
// load this from metadata later ?
this.user_highlight = 'auto';
this.cm_config = options.cm_config;
+ this.cell_id = utils.uuid();
+ this._options = options;
+
+ // For JS VM engines optimisation, attributes should be all set (even
+ // to null) in the constructor, and if possible, if different subclass
+ // have new attributes with same name, they should be created in the
+ // same order. Easiest is to create and set to null in parent class.
+
+ this.element = null;
+ this.cell_type = null;
+ this.code_mirror = null;
+
+
this.create_element();
if (this.element !== null) {
this.element.data("cell", this);
this.bind_events();
}
- this.cell_id = utils.uuid();
- this._options = options;
};
Cell.options_default = {
@@ -309,7 +319,6 @@ var IPython = (function (IPython) {
}
if (mode.search('magic_') != 0) {
this.code_mirror.setOption('mode', mode);
- console.log('from',current_mode,'to',mode)
CodeMirror.autoLoadMode(this.code_mirror, mode);
return;
}
@@ -336,7 +345,6 @@ var IPython = (function (IPython) {
);
});
this.code_mirror.setOption('mode', mmode);
- console.log('from',current_mode,'to', mmode)
return;
}
}
@@ -352,7 +360,6 @@ var IPython = (function (IPython) {
return
}
this.code_mirror.setOption('mode', default_mode);
- console.log('from',current_mode,'to', default_mode)
};
IPython.Cell = Cell;
diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js
index eb4b60f61..9b32496fe 100644
--- a/IPython/html/static/notebook/js/codecell.js
+++ b/IPython/html/static/notebook/js/codecell.js
@@ -62,11 +62,17 @@ var IPython = (function (IPython) {
*/
var CodeCell = function (kernel, options) {
this.kernel = kernel || null;
- this.code_mirror = null;
- this.input_prompt_number = null;
this.collapsed = false;
this.cell_type = "code";
+ // create all attributed in constructor function
+ // even if null for V8 VM optimisation
+ this.input_prompt_number = null;
+ this.celltoolbar = null;
+ this.output_area = null;
+ this.last_msg_id = null;
+ this.completer = null;
+
var cm_overwrite_options = {
onKeyEvent: $.proxy(this.handle_codemirror_keyevent,this)
@@ -129,13 +135,7 @@ var IPython = (function (IPython) {
cell.append(input).append(output);
this.element = cell;
this.output_area = new IPython.OutputArea(output, true);
-
- // construct a completer only if class exist
- // otherwise no print view
- if (IPython.Completer !== undefined)
- {
- this.completer = new IPython.Completer(this);
- }
+ this.completer = new IPython.Completer(this);
};
/**