fix: <template> tag for browsers that do not suppor them

Closes #3636
This commit is contained in:
Yegor Jbanov 2015-08-13 23:22:00 -07:00 committed by Yegor
parent 3b4965279c
commit ddcfd465ad
1 changed files with 9 additions and 1 deletions

View File

@ -95,6 +95,14 @@ final _keyCodeToKeyMap = const {
145: 'ScrollLock'
};
final bool _supportsTemplateElement = () {
try {
return new TemplateElement().content != null;
} catch(_) {
return false;
}
}();
class BrowserDomAdapter extends GenericBrowserDomAdapter {
js.JsFunction _setProperty;
js.JsFunction _getProperty;
@ -207,7 +215,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
String nodeName(Node el) => el.nodeName;
String nodeValue(Node el) => el.nodeValue;
String type(InputElement el) => el.type;
Node content(TemplateElement el) => el.content;
Node content(TemplateElement el) => _supportsTemplateElement ? el.content : el;
Node firstChild(el) => el.firstChild;
Node nextSibling(Node el) => el.nextNode;
Element parentElement(Node el) => el.parent;