##// END OF EJS Templates
Use low overhead object heritence in Js (Object.create vs new)...
Matthias Bussonnier -
Show More
@@ -115,7 +115,7 b' define(['
115
115
116 CodeCell.msg_cells = {};
116 CodeCell.msg_cells = {};
117
117
118 CodeCell.prototype = new Cell();
118 CodeCell.prototype = Object.create(Cell.prototype);
119
119
120 /**
120 /**
121 * @method auto_highlight
121 * @method auto_highlight
@@ -27,7 +27,7 b' define(['
27 this.bind_events();
27 this.bind_events();
28 };
28 };
29
29
30 MainToolBar.prototype = new toolbar.ToolBar();
30 MainToolBar.prototype = Object.create(toolbar.ToolBar.prototype);
31
31
32 MainToolBar.prototype.construct = function () {
32 MainToolBar.prototype.construct = function () {
33 var that = this;
33 var that = this;
@@ -68,7 +68,7 b" define(['jquery'], function($){"
68 // Public constructor.
68 // Public constructor.
69 ScrollManager.apply(this, [notebook, options]);
69 ScrollManager.apply(this, [notebook, options]);
70 };
70 };
71 TargetScrollManager.prototype = new ScrollManager();
71 TargetScrollManager.prototype = Object.create(ScrollManager.prototype);
72
72
73 TargetScrollManager.prototype.is_target = function (index) {
73 TargetScrollManager.prototype.is_target = function (index) {
74 // Check if a cell should be a scroll stop.
74 // Check if a cell should be a scroll stop.
@@ -114,7 +114,7 b" define(['jquery'], function($){"
114 // Public constructor.
114 // Public constructor.
115 TargetScrollManager.apply(this, [notebook, options]);
115 TargetScrollManager.apply(this, [notebook, options]);
116 };
116 };
117 SlideScrollManager.prototype = new TargetScrollManager();
117 SlideScrollManager.prototype = Object.create(TargetScrollManager.prototype);
118
118
119 SlideScrollManager.prototype.is_target = function (index) {
119 SlideScrollManager.prototype.is_target = function (index) {
120 var cell = this.notebook.get_cell(index);
120 var cell = this.notebook.get_cell(index);
@@ -131,7 +131,7 b" define(['jquery'], function($){"
131 options = options || {};
131 options = options || {};
132 this._level = options.heading_level || 1;
132 this._level = options.heading_level || 1;
133 };
133 };
134 HeadingScrollManager.prototype = new ScrollManager();
134 HeadingScrollManager.prototype = Object.create(ScrollManager.prototype)
135
135
136 HeadingScrollManager.prototype.scroll = function (delta) {
136 HeadingScrollManager.prototype.scroll = function (delta) {
137 // Scroll the document.
137 // Scroll the document.
@@ -55,7 +55,7 b' define(['
55 this.rendered = false;
55 this.rendered = false;
56 };
56 };
57
57
58 TextCell.prototype = new Cell();
58 TextCell.prototype = Object.create(Cell.prototype);
59
59
60 TextCell.options_default = {
60 TextCell.options_default = {
61 cm_config : {
61 cm_config : {
@@ -220,7 +220,7 b' define(['
220 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
220 placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
221 };
221 };
222
222
223 MarkdownCell.prototype = new TextCell();
223 MarkdownCell.prototype = Object.create(TextCell.prototype);
224
224
225 /**
225 /**
226 * @method render
226 * @method render
@@ -270,7 +270,7 b' define(['
270 "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."
270 "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."
271 };
271 };
272
272
273 RawCell.prototype = new TextCell();
273 RawCell.prototype = Object.create(TextCell.prototype);
274
274
275 /** @method bind_events **/
275 /** @method bind_events **/
276 RawCell.prototype.bind_events = function () {
276 RawCell.prototype.bind_events = function () {
@@ -330,7 +330,7 b' define(['
330 placeholder: "Type Heading Here"
330 placeholder: "Type Heading Here"
331 };
331 };
332
332
333 HeadingCell.prototype = new TextCell();
333 HeadingCell.prototype = Object.create(TextCell.prototype);
334
334
335 /** @method fromJSON */
335 /** @method fromJSON */
336 HeadingCell.prototype.fromJSON = function (data) {
336 HeadingCell.prototype.fromJSON = function (data) {
General Comments 0
You need to be logged in to leave comments. Login now