From 8328906fe5ec7850f8aa3d56fb0aed34cc6acfdd Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 25 Jun 2015 15:33:29 +0930 Subject: [PATCH] Give all components config on the root element So that extensions can work on it no matter what --- framework/core/js/lib/component.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/framework/core/js/lib/component.js b/framework/core/js/lib/component.js index 741f55ef4..589b1b32b 100644 --- a/framework/core/js/lib/component.js +++ b/framework/core/js/lib/component.js @@ -18,6 +18,10 @@ export default class Component { return selector ? $(this.element()).find(selector) : $(this.element()); } + config(element, isInitialized, context, vdom) { + // + } + /** */ @@ -30,14 +34,15 @@ export default class Component { component.props = props; var vdom = component.view(); vdom.attrs = vdom.attrs || {}; - var oldConfig = vdom.attrs.config; - vdom.attrs.config = function() { - var args = [].slice.apply(arguments); - component.element(args[0]); - if (oldConfig) { - oldConfig.apply(component, args); - } + + if (!vdom.attrs.config) { + vdom.attrs.config = function() { + var args = [].slice.apply(arguments); + component.element(args[0]); + component.config.apply(component, args); + }; } + return vdom; }; view.$original = this.prototype.view;