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

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

Issue 23190026: Type extension support in polyfill. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 74cc8f7b64f2110c646b6652bc1f26b437aa06ea..6e1165b4eda42a5df4eb91f10b6b8d9e0cc3d0ed 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -354,8 +354,8 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
*
* * [isTagSupported]
*/
- factory $CLASSNAME.tag(String tag) =>
- _$(CLASSNAME)FactoryProvider.createElement_tag(tag);
+ factory $CLASSNAME.tag(String tag, [String typeExtention]) =>
+ _$(CLASSNAME)FactoryProvider.createElement_tag(tag, typeExtention);
/// Creates a new `<a>` element.
///
@@ -672,7 +672,7 @@ $(ANNOTATIONS)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
* The tag should be a valid HTML tag name.
*/
static bool isTagSupported(String tag) {
- var e = _ElementFactoryProvider.createElement_tag(tag);
+ var e = _ElementFactoryProvider.createElement_tag(tag, null);
return e is Element && !(e is UnknownElement);
}
@@ -1315,12 +1315,22 @@ class _ElementFactoryProvider {
$if DART2JS
// Optimization to improve performance until the dart2js compiler inlines this
// method.
- static dynamic createElement_tag(String tag) =>
- // Firefox may return a JS function for some types (Embed, Object).
- JS('Element|=Object', 'document.createElement(#)', tag);
+ static dynamic createElement_tag(String tag, String typeExtension) {
+ // Firefox may return a JS function for some types (Embed, Object).
+ if (typeExtension != null) {
+ return JS('Element|=Object', 'document.createElement(#, #)',
+ tag, typeExtension);
+ }
+ // Should be able to eliminate this and just call the two-arg version above
+ // with null typeExtension, but Chrome treats the tag as case-sensitive if
+ // typeExtension is null.
+ // https://code.google.com/p/chromium/issues/detail?id=282467
+ return JS('Element|=Object', 'document.createElement(#)', tag);
+ }
+
$else
- static Element createElement_tag(String tag) =>
- document.$dom_createElement(tag);
+ static Element createElement_tag(String tag, String typeExtension) =>
+ document.$dom_createElement(tag, typeExtension);
$endif
}
« no previous file with comments | « tools/dom/src/dart2js_CustomElementSupport.dart ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698