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

Commit

Permalink
feat(view factory): Each css file has its own <style> tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Apr 10, 2014
1 parent f82f602 commit 4c81989
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/core_dom/view_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ class _ComponentFactory implements Function {
TemplateLoader templateLoader = new TemplateLoader(
async.Future.wait(cssFutures).then((Iterable<String> cssList) {
if (cssList != null) {
var filteredCssList = cssList.where((css) => css != null );
shadowDom.setInnerHtml('<style>${filteredCssList.join('')}</style>',
treeSanitizer: treeSanitizer);
shadowDom.setInnerHtml(
cssList
.where((css) => css != null)
.map((css) => '<style>$css</style>')
.join(''),
treeSanitizer: treeSanitizer);
}
if (viewFuture != null) {
return viewFuture.then((ViewFactory viewFactory) {
Expand Down
2 changes: 1 addition & 1 deletion test/core/templateurl_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void main() {

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

0 comments on commit 4c81989

Please sign in to comment.