Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 4c81989

Browse files
committed
feat(view factory): Each css file has its own <style> tag
1 parent f82f602 commit 4c81989

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/core_dom/view_factory.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,12 @@ class _ComponentFactory implements Function {
197197
TemplateLoader templateLoader = new TemplateLoader(
198198
async.Future.wait(cssFutures).then((Iterable<String> cssList) {
199199
if (cssList != null) {
200-
var filteredCssList = cssList.where((css) => css != null );
201-
shadowDom.setInnerHtml('<style>${filteredCssList.join('')}</style>',
202-
treeSanitizer: treeSanitizer);
200+
shadowDom.setInnerHtml(
201+
cssList
202+
.where((css) => css != null)
203+
.map((css) => '<style>$css</style>')
204+
.join(''),
205+
treeSanitizer: treeSanitizer);
203206
}
204207
if (viewFuture != null) {
205208
return viewFuture.then((ViewFactory viewFactory) {

test/core/templateurl_spec.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void main() {
227227

228228
expect(element).toHaveText('.hello{}.world{}Simple!');
229229
expect(element.children[0].shadowRoot).toHaveHtml(
230-
'<style>.hello{}.world{}</style><div log="SIMPLE">Simple!</div>'
230+
'<style>.hello{}</style><style>.world{}</style><div log="SIMPLE">Simple!</div>'
231231
);
232232
rootScope.apply();
233233
// Note: There is no ordering. It is who ever comes off the wire first!

0 commit comments

Comments
 (0)