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

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 17917002: Continue updating MDV. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 6 months 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
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index ecc640eeca3a073b08f2ba4456291cc962567b21..8e4757c36b6aa766d6aaee104fee6cc05387815a 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -676,6 +676,7 @@ $endif
bool _templateIsDecorated;
+
/**
* Gets the template this node refers to.
* This is only supported if [isTemplate] is true.
@@ -687,7 +688,19 @@ $endif
Element ref = null;
var refId = attributes['ref'];
if (refId != null) {
- ref = document.getElementById(refId);
+ var treeScope = this;
+ while (treeScope.parentNode != null) {
+ treeScope = treeScope.parentNode;
+ }
+
+ // Note: JS code tests that getElementById is present. We can't do that
+ // easily, so instead check for the types known to implement it.
+ if (treeScope is Document ||
+ treeScope is ShadowRoot ||
+ treeScope is svg.SvgSvgElement) {
+
+ ref = treeScope.getElementById(refId);
+ }
}
return ref != null ? ref : _templateInstanceRef;
@@ -740,7 +753,8 @@ $endif
};
bool get _isAttributeTemplate => attributes.containsKey('template') &&
- (localName == 'option' || _TABLE_TAGS.containsKey(localName));
+ (localName == 'option' || localName == 'optgroup' ||
+ _TABLE_TAGS.containsKey(localName));
/**
* Returns true if this node is a template.
@@ -749,7 +763,7 @@ $endif
* 'template' attribute and this tag supports attribute form for backwards
* compatibility with existing HTML parsers. The nodes that can use attribute
* form are table elments (THEAD, TBODY, TFOOT, TH, TR, TD, CAPTION, COLGROUP
- * and COL) and OPTION.
+ * and COL), OPTION, and OPTGROUP.
*/
// TODO(jmesserly): this is not a public MDV API, but it seems like a useful
// place to document which tags our polyfill considers to be templates.
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698