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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11696002: Filling in supported platforms for InputElement types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | sdk/lib/html/dartium/html_dartium.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index a4c0c95ec8e756757f47a3a7a89f130915e7a086..65b14b55f73cf247b1ed926b1c8b84cd5b6b50d0 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -10757,10 +10757,16 @@ class InputElement extends Element implements
///@docsEditable true
factory InputElement({String type}) {
var e = document.$dom_createElement("input");
- if (type != null) e.type = type;
+ if (type != null) {
+ try {
+ // IE throws an exception for unknown types.
+ e.type = type;
+ } catch(_) {}
+ }
return e;
}
+
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
InputElementEvents get on =>
new InputElementEvents(this);
@@ -11160,7 +11166,11 @@ abstract class RangeInputElementBase implements InputElementBase {
/**
* A date and time (year, month, day, hour, minute, second, fraction of a
* second) with the time zone set to UTC.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME, '25')
+@Experimental()
abstract class DateTimeInputElement implements RangeInputElementBase {
factory DateTimeInputElement() => new InputElement(type: 'datetime');
@@ -11172,11 +11182,20 @@ abstract class DateTimeInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'datetime')).type == 'datetime';
+ }
}
/**
* A date (year, month, day) with no time zone.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME, '25')
+@Experimental()
abstract class DateInputElement implements RangeInputElementBase {
factory DateInputElement() => new InputElement(type: 'date');
@@ -11188,11 +11207,20 @@ abstract class DateInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'date')).type == 'date';
+ }
}
/**
* A date consisting of a year and a month with no time zone.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME, '25')
+@Experimental()
abstract class MonthInputElement implements RangeInputElementBase {
factory MonthInputElement() => new InputElement(type: 'month');
@@ -11204,11 +11232,20 @@ abstract class MonthInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'month')).type == 'month';
+ }
}
/**
* A date consisting of a week-year number and a week number with no time zone.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME, '25')
+@Experimental()
abstract class WeekInputElement implements RangeInputElementBase {
factory WeekInputElement() => new InputElement(type: 'week');
@@ -11220,11 +11257,20 @@ abstract class WeekInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'week')).type == 'week';
+ }
}
/**
* A time (hour, minute, seconds, fractional seconds) with no time zone.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME)
+@Experimental()
abstract class TimeInputElement implements RangeInputElementBase {
factory TimeInputElement() => new InputElement(type: 'time');
@@ -11236,12 +11282,21 @@ abstract class TimeInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'time')).type == 'time';
+ }
}
/**
* A date and time (year, month, day, hour, minute, second, fraction of a
* second) with no time zone.
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME, '25')
+@Experimental()
abstract class LocalDateTimeInputElement implements RangeInputElementBase {
factory LocalDateTimeInputElement() =>
new InputElement(type: 'datetime-local');
@@ -11251,11 +11306,20 @@ abstract class LocalDateTimeInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'datetime-local')).type == 'datetime-local';
+ }
}
/**
* A numeric editor control.
*/
+@SupportedBrowser(SupportedBrowser.CHROME)
+@SupportedBrowser(SupportedBrowser.IE)
+@SupportedBrowser(SupportedBrowser.SAFARI)
+@Experimental()
abstract class NumberInputElement implements RangeInputElementBase {
factory NumberInputElement() => new InputElement(type: 'number');
@@ -11267,14 +11331,29 @@ abstract class NumberInputElement implements RangeInputElementBase {
/// @domName HTMLInputElement.required
bool required;
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'number')).type == 'number';
+ }
}
/**
* Similar to [NumberInputElement] but the browser may provide more optimal
* styling (such as a slider control).
+ *
+ * Use [supported] to check if this is supported on the current platform.
*/
+@SupportedBrowser(SupportedBrowser.CHROME)
+@SupportedBrowser(SupportedBrowser.IE, '10')
+@Experimental()
abstract class RangeInputElement implements RangeInputElementBase {
factory RangeInputElement() => new InputElement(type: 'range');
+
+ /// Returns true if this input type is supported on the current platform.
+ static bool get supported {
+ return (new InputElement(type: 'range')).type == 'range';
+ }
}
/**
@@ -13239,6 +13318,7 @@ class MutationObserver native "*MutationObserver" {
static MutationObserver _create(MutationCallback callback) {
// Dummy statement to mark types as instantiated.
JS('MutationObserver|MutationRecord', '0');
+
return JS('MutationObserver',
'new(window.MutationObserver||window.WebKitMutationObserver||'
'window.MozMutationObserver)(#)',
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | sdk/lib/html/dartium/html_dartium.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698