Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws
authorWolfram Schneider <wosch@indexdata.dk>
Tue, 8 Apr 2014 11:56:53 +0000 (11:56 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Tue, 8 Apr 2014 11:56:53 +0000 (11:56 +0000)
src/mkws-core.js
src/mkws-team.js
src/mkws-widgets.js

index 01f82c8..6b1e0f6 100644 (file)
@@ -144,13 +144,25 @@ mkws.setMkwsConfig = function(overrides) {
        dummy: "dummy"
     };
 
-    mkws.config = Object.create(config_default);
+    mkws.config = mkws.objectInheritingFrom(config_default);
     for (var k in overrides) {
        mkws.config[k] = overrides[k];
     }
 };
 
 
+// This code is from Douglas Crockford's article "Prototypal Inheritance in JavaScript"
+// http://javascript.crockford.com/prototypal.html
+// mkws.objectInheritingFrom behaves the same as Object.create,
+// but since the latter is not available in IE8 we can't use it.
+//
+mkws.objectInheritingFrom = function(o) {
+    function F() {}
+    F.prototype = o;
+    return new F();
+}
+
+
 // The following functions are dispatchers for team methods that
 // are called from the UI using a team-name rather than implicit
 // context.
index a5a2d03..ee18f1b 100644 (file)
@@ -27,7 +27,7 @@ function team($, teamName) {
     };
     var m_paz; // will be initialised below
     var m_template = {};
-    var m_config = Object.create(mkws.config);
+    var m_config = mkws.objectInheritingFrom(mkws.config);
 
     that.toString = function() { return '[Team ' + teamName + ']'; };
 
index b5d1373..22b9820 100644 (file)
@@ -10,7 +10,7 @@ function widget($, team, type, node) {
        team: team,
        type: type,
        node: node,
-       config: Object.create(team.config())
+       config: mkws.objectInheritingFrom(team.config())
     };
 
     function log(s) {