From 1afbc0a8dc0162a9a7889a3d998e30221ad56c41 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Fri, 14 Jun 2013 09:51:12 -0700 Subject: [PATCH] add controller styles synchronously; Polymer.installControllerStyles should be called in inserted. --- src/styling.js | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/styling.js b/src/styling.js index e1ac02a37b..1da882d2ac 100644 --- a/src/styling.js +++ b/src/styling.js @@ -85,15 +85,13 @@ STYLE_CONTROLLER_SCOPE); } var styleElement = elementElement.controllerStyle; - async.queue(function() { - var scope = findStyleController(element); - // apply controller styles only if they are not yet applied - if (scope && !scopeHasElementStyle(scope, element, - STYLE_CONTROLLER_SCOPE)) { - Polymer.shimPolyfillDirectives([styleElement], element.localName); - applyStyleToScope(styleElement, scope); - } - }); + var scope = findStyleController(element); + // apply controller styles only if they are not yet applied + if (scope && !scopeHasElementStyle(scope, element, + STYLE_CONTROLLER_SCOPE)) { + Polymer.shimPolyfillDirectives([styleElement], element.localName); + applyStyleToScope(styleElement, scope); + } } function scopeHasElementStyle(scope, element, descriptor) { @@ -145,33 +143,6 @@ } return nodes.filter(matcher); } - - - // queue a series of functions to occur async. - var async = { - list: [], - queue: function(inFn) { - if (inFn) { - async.list.push(inFn); - } - async.queueFlush(); - }, - queueFlush: function() { - if (!async.flushing) { - async.flushing = true; - requestAnimationFrame(async.flush); - } - }, - flush: function() { - async.list.forEach(function(fn) { - fn(); - }); - async.list = []; - async.flushing = false; - } - - } - function findStyleController(node) { // find the shadow root that contains inNode var n = node; @@ -194,7 +165,7 @@ function applyStyleToScope(style, scope) { if (style) { var clone = style.cloneNode(true); - // TODO(sorvell): this is here for IE, which requires deep cloning + // TODO(sorvell): this is here for IE, which requires deep cloning // of style elements. // see https://github.com/Polymer/ShadowDOM/issues/165 if (window.ShadowDOMPolyfill) {