Skip to content

Commit

Permalink
Merge pull request ipython#3969 from Carreau/usestrict
Browse files Browse the repository at this point in the history
"use strict" in most (if not all) our javascript

plus fix one variable leaking in global namespace
  • Loading branch information
Carreau committed Aug 19, 2013
2 parents 23a00d8 + e7cf937 commit 17d4724
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions IPython/html/static/base/js/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
IPython.namespace('IPython.dialog');

IPython.dialog = (function (IPython) {
"use strict";

var modal = function (options) {
var dialog = $("<div/>").addClass("modal").attr("role", "dialog");
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/base/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// $([IPython.events]).on('event.Namespace',function () {});

var IPython = (function (IPython) {
"use strict";

var utils = IPython.utils;

Expand Down
2 changes: 2 additions & 0 deletions IPython/html/static/base/js/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
var IPython = IPython || {};

IPython.namespace = function (ns_string) {
"use strict";

var parts = ns_string.split('.'),
parent = IPython,
i;
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/base/js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var Page = function () {
this.style();
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/base/js/pagemain.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@


$(document).ready(function () {
"use strict";

IPython.page = new IPython.Page();
IPython.page.show();
Expand Down
3 changes: 2 additions & 1 deletion IPython/html/static/base/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
IPython.namespace('IPython.utils');

IPython.utils = (function (IPython) {
"use strict";

//============================================================================
// Cross-browser RegEx Split
Expand Down Expand Up @@ -366,7 +367,7 @@ IPython.utils = (function (IPython) {
};

// http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
browser = (function() {
var browser = (function() {
var N= navigator.appName, ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if (M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

var IPython = (function (IPython) {
"use strict";

var utils = IPython.utils;

Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/codemirror-ipython.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// to do, but at least the simple one for now.

CodeMirror.requireMode('python',function(){
"use strict";

CodeMirror.defineMode("ipython", function(conf, parserConf) {

Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
**/

var IPython = (function (IPython) {
"use strict";
/**
* A place where some stuff can be confugured.
*
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/layoutmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var LayoutManager = function () {
this.bind_events();
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/maintoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var MainToolBar = function (selector) {
IPython.ToolBar.apply(this, arguments);
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


var IPython = (function (IPython) {
"use strict";

/**
* A MenuBar Class to generate the menubar of IPython noteboko
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var utils = IPython.utils;
var key = IPython.utils.keycodes;
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var utils = IPython.utils;

Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/quickhelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var QuickHelp = function (selector) {
};
Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/savewidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//============================================================================

var IPython = (function (IPython) {
"use strict";

var utils = IPython.utils;

Expand Down
1 change: 1 addition & 0 deletions IPython/html/static/notebook/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

var IPython = (function (IPython) {
"use strict";

/**
* A generic toolbar on which one can add button
Expand Down

0 comments on commit 17d4724

Please sign in to comment.