diff --git a/examples/unfinished/shark/client/shark.html b/examples/unfinished/shark/client/shark.html index a690789fc4..f11a8885af 100644 --- a/examples/unfinished/shark/client/shark.html +++ b/examples/unfinished/shark/client/shark.html @@ -18,6 +18,10 @@ + + diff --git a/packages/ui/component.js b/packages/ui/component.js index 1be1477896..eaf189b66d 100644 --- a/packages/ui/component.js +++ b/packages/ui/component.js @@ -494,7 +494,11 @@ _.extend(Component.prototype, { }); _.extend(Component.prototype, { - render: function (buf) {} + render: function (buf) { + var content = this.getArg('content'); + if (content) + buf.component(content.create(), {key: 'content'}); + } }); var allCallbacks = { @@ -562,16 +566,20 @@ _.extend(Component.prototype, { }); // Require ComponentClass.create(...) instead of -// new CompomentClass(...) because a factory method gives +// new ComponentClass(...) because a factory method gives // us more flexibility, and there should be one way to // make a component. The `new` syntax is awkward if // the component class is calculated by a complex expression // (like a reactive getter). -Component.create = function (/*args*/) { +Component.create = function (args) { constructorsLocked = false; - var comp = new this; - if (this !== Component) - Component.apply(comp, arguments); + var comp; + if (this === Component) { + comp = new Component(args); + } else { + comp = new this; + Component.call(comp, args); + } return comp; }; @@ -719,11 +727,6 @@ RootComponent = Component.extend({ // this would normally be called upon "add" this.init(); }, - render: function (buf) { - var content = this.getArg('content'); - if (content) - buf.component(content.create(), {key: 'content'}); - }, attached: function () { RootComponent._attachedInstances[this._uid] = this; },