Index: pkg/template_binding/lib/template_binding.dart |
diff --git a/pkg/template_binding/lib/template_binding.dart b/pkg/template_binding/lib/template_binding.dart |
index 61ec19d2570d1113d151105ed107c8b79ff33ce9..97daeabad53b7e1dffa7ae95c3eebf90c1d848d5 100644 |
--- a/pkg/template_binding/lib/template_binding.dart |
+++ b/pkg/template_binding/lib/template_binding.dart |
@@ -25,10 +25,9 @@ import 'dart:svg' show SvgSvgElement; |
import 'package:observe/observe.dart'; |
import 'src/binding_delegate.dart'; |
-import 'src/node_binding.dart'; |
+import 'src/mustache_tokens.dart'; |
export 'src/binding_delegate.dart'; |
-export 'src/node_binding.dart' show NodeBinding; |
part 'src/element.dart'; |
part 'src/input_bindings.dart'; |
@@ -45,6 +44,8 @@ part 'src/text_area_element.dart'; |
// two packages, but this is not easy when we are faking extension methods. |
// Since TemplateElement needs to override Node.bind, it seems like the |
// Node.bind layer must have some innate knowledge of TemplateBinding. |
+// NOTE: I've heard NodeBind might become an internal API, which is all the more |
+// reason to have it in this package. |
/** |
* Provides access to the data binding APIs for the [node]. For example: |
@@ -136,6 +137,12 @@ NodeBindExtension nodeBindFallback(Node node) { |
bool _isAttributeTemplate(Element n) => n.attributes.containsKey('template') && |
_SEMANTIC_TEMPLATE_TAGS.containsKey(n.localName); |
+bool _isSvgTemplate(Element el) => el.tagName == 'template' && |
+ el.namespaceUri == 'http://www.w3.org/2000/svg'; |
+ |
+bool _isHtmlTemplate(Element el) => el.tagName == 'TEMPLATE' && |
+ el.namespaceUri == 'http://www.w3.org/1999/xhtml'; |
+ |
/** |
* Returns true if this node is semantically a template. |
* |
@@ -146,7 +153,7 @@ bool _isAttributeTemplate(Element n) => n.attributes.containsKey('template') && |
* and COL), OPTION, and OPTGROUP. |
*/ |
bool isSemanticTemplate(Node n) => n is Element && |
- (n.localName == 'template' || _isAttributeTemplate(n)); |
+ (_isHtmlTemplate(n) || _isAttributeTemplate(n) || _isSvgTemplate(n)); |
// TODO(jmesserly): const set would be better |
const _SEMANTIC_TEMPLATE_TAGS = const { |