From b35aab373684758ce80a0115d424e9a83d134420 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Tue, 13 Mar 2018 11:28:21 -0400 Subject: [PATCH] only apply stylesheet once --- src/generators/Generator.ts | 2 +- src/generators/nodes/Element.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/generators/Generator.ts b/src/generators/Generator.ts index d78bf7bbbb..b53851cec9 100644 --- a/src/generators/Generator.ts +++ b/src/generators/Generator.ts @@ -179,7 +179,7 @@ export default class Generator { } this.walkTemplate(); - this.stylesheet.reify(); + if (!this.customElement) this.stylesheet.reify(); } addSourcemapLocations(node: Node) { diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index 1b5b49f498..42db165f9d 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -142,8 +142,6 @@ export default class Element extends Node { this.name.replace(/[^a-zA-Z0-9_$]/g, '_') ); - this.generator.stylesheet.apply(this); - if (this.children.length) { if (this.name === 'pre' || this.name === 'textarea') stripWhitespace = false; this.initChildren(block, stripWhitespace, nextSibling); @@ -671,8 +669,6 @@ export default class Element extends Node { } addCssClass() { - if (this._addedCssClass || this.generator.customElement) return; - this._addedCssClass = true; const classAttribute = this.attributes.find(a => a.name === 'class'); if (classAttribute && classAttribute.value !== true) { if (classAttribute.value.length === 1 && classAttribute.value[0].type === 'Text') {