Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Unified Diff: pkg/polymer/lib/src/declaration.dart

Issue 77373002: "Reverting 30388" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/lib/src/build/linter.dart ('k') | pkg/polymer/test/build/linter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/declaration.dart
diff --git a/pkg/polymer/lib/src/declaration.dart b/pkg/polymer/lib/src/declaration.dart
index 030333bb4ebb3abfcce330a5554d1602de1be872..024c872ef56ca8fdd3a975fe0ac4c96ef374349c 100644
--- a/pkg/polymer/lib/src/declaration.dart
+++ b/pkg/polymer/lib/src/declaration.dart
@@ -365,7 +365,7 @@ class PolymerDeclaration extends HtmlElement {
void installLocalSheets() {
var sheets = this.sheets.where(
(s) => !s.attributes.containsKey(_SCOPE_ATTR));
- var content = this.templateContent;
+ var content = templateContent;
if (content != null) {
var cssText = new StringBuffer();
for (var sheet in sheets) {
@@ -380,8 +380,8 @@ class PolymerDeclaration extends HtmlElement {
}
List<Element> findNodes(String selector, [bool matcher(Element e)]) {
- var nodes = this.queryAll(selector).toList();
- var content = this.templateContent;
+ var nodes = this.querySelectorAll(selector).toList();
+ var content = templateContent;
if (content != null) {
nodes = nodes..addAll(content.queryAll(selector));
}
@@ -554,7 +554,7 @@ String _removeEventPrefix(String name) => name.substring(_EVENT_PREFIX.length);
void _shimShadowDomStyling(DocumentFragment template, String name,
String extendee) {
if (js.context == null || template == null) return;
- if (js.context.hasProperty('ShadowDOMPolyfill')) return;
+ if (!js.context.hasProperty('ShadowDOMPolyfill')) return;
Siggi Cherem (dart-lang) 2013/11/21 01:46:13 ! o u c h
var platform = js.context['Platform'];
if (platform == null) return;
@@ -570,12 +570,39 @@ const _SCOPE_ATTR = 'polymer-scope';
const _STYLE_SCOPE_ATTRIBUTE = 'element';
const _STYLE_CONTROLLER_SCOPE = 'controller';
-String _cssTextFromSheet(Element sheet) {
- if (sheet == null || js.context == null) return '';
- var resource = new js.JsObject.fromBrowserObject(sheet)['__resource'];
- return resource != null ? resource : '';
+String _cssTextFromSheet(LinkElement sheet) {
+ if (sheet == null) return '';
+
+ // TODO(jmesserly): sometimes the href property is wrong after deployment.
+ var href = sheet.href;
+ if (href == '') href = sheet.attributes["href"];
+
+ if (js.context != null && js.context.hasProperty('HTMLImports')) {
+ var jsSheet = new js.JsObject.fromBrowserObject(sheet);
+ var resource = jsSheet['__resource'];
+ if (resource != null) return resource;
+ _sheetLog.fine('failed to get stylesheet text href="$href"');
+ return '';
+ }
+ // TODO(jmesserly): it seems like polymer-js is always polyfilling
+ // HTMLImports, because their code depends on "__resource" to work.
+ // We work around this by using a sync XHR to get the stylesheet text.
+ // Right now this code is only used in Dartium, but if it's going to stick
+ // around we will need to find a different approach.
+ try {
+ return (new HttpRequest()
+ ..open('GET', href, async: false)
+ ..send())
+ .responseText;
+ } on DomException catch (e, t) {
+ _sheetLog.fine('failed to get stylesheet text href="$href" error: '
+ '$e, trace: $t');
+ return '';
+ }
}
+final Logger _sheetLog = new Logger('polymer.stylesheet');
+
const _OBSERVE_SUFFIX = 'Changed';
// TODO(jmesserly): is this list complete?
« no previous file with comments | « pkg/polymer/lib/src/build/linter.dart ('k') | pkg/polymer/test/build/linter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698