Chromium Code Reviews| Index: lib/src/emitters.dart |
| diff --git a/lib/src/emitters.dart b/lib/src/emitters.dart |
| index 06679870853efd0a7f442e99855b8b41e0072e74..0c643ad5d58755916542b02e3c12d097da17eedd 100644 |
| --- a/lib/src/emitters.dart |
| +++ b/lib/src/emitters.dart |
| @@ -413,27 +413,6 @@ class WebComponentEmitter extends RecursiveEmitter { |
| } |
| if (info.template != null && !elemInfo.childrenCreatedInCode) { |
| - // TODO(jmesserly): scoped styles probably don't work when |
| - // childrenCreatedInCode is true. |
| - if (info.styleSheet != null) { |
| - var tag = cssPolyfill ? info.tagName : null; |
| - // TODO(jmesserly): csslib+html5lib should work together. We shouldn't |
| - // need to call a different function to serialize CSS. |
| - // Calling innerHTML on a StyleElement should be |
| - // enought - like a real browser. CSSOM and DOM |
| - // should work together in the same tree. |
| - // TODO(terry): Consider not emitting <style> tag inside of component. |
| - // Maybe we can generate a .css file that has all the CSS |
| - // polyfill. The style tag can change the rendering a bit. |
| - var styleSheet = |
| - '<style>\n' |
| - '${emitStyleSheet(info.styleSheet, tag)}' |
| - '\n</style>'; |
| - var template = elemInfo.node; |
| - template.insertBefore(new Element.html(styleSheet), |
| - template.children[0]); |
| - } |
| - |
| _context.statics.add('final', '__shadowTemplate', |
| elemInfo.node.sourceSpan, |
| "new autogenerated.DocumentFragment.html('''" |
| @@ -551,13 +530,19 @@ class MainPageEmitter extends RecursiveEmitter { |
| }); |
| document.queryAll('link').forEach((tag) { |
| var href = tag.attributes['href']; |
| - if (tag.attributes['rel'] == 'components') { |
| + var rel = tag.attributes['rel']; |
| + if (rel == 'components') { |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
do you mind adding rel == 'component' too, I think
terry
2013/03/08 20:11:24
Done.
|
| tag.remove(); |
| + } else if (rel == 'stylesheet' && !href.startsWith('http')) { |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
let's check also that && cssPolyfill is true, othe
terry
2013/03/08 20:11:24
I didn't think of this as polyfill but more of how
|
| + tag.remove(); |
| } else if (href != null && rewriteUrls) { |
| tag.attributes['href'] = pathInfo.transformUrl(_fileInfo.path, href); |
| } |
| }); |
| + var linkElem = new Element.html('<link rel="stylesheet" type="text/css"' |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
likewise - we should only add this new link if css
terry
2013/03/08 20:11:24
Done.
|
| + ' href="${_fileInfo.path.filename}.css">'); |
| + document.head.insertBefore(linkElem, null); |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
should this be done as the first child so that the
terry
2013/03/08 20:11:24
Good idea to make it first.
On 2013/03/07 22:14:20
|
| var codeInfo = _fileInfo.userCode; |
| if (codeInfo == null) { |