Closed
Bug 826305
Opened 12 years ago
Closed 12 years ago
.valueAsDate shouldn't set the value to the empty string if the passed value isn't a Date
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: mounir, Assigned: mounir)
References
Details
(Keywords: doc-bug-filed)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
bzbarsky
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
It should set the value to the empty string if the passed value is null or a Date with NaN value. Otherwise, it should throw a TypeError, per WebIDL spec.
Attachment #697484 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 1•12 years ago
|
||
(I forgot to refresh the patch...)
Assignee: nobody → mounir
Attachment #697484 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #697484 -
Flags: review?(bzbarsky)
Attachment #697485 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•12 years ago
|
Keywords: dev-doc-needed
Comment 2•12 years ago
|
||
Comment on attachment 697485 [details] [diff] [review]
Patch
>+ if (aDate.isNull()) {
isNullOrUndefined(), please.
>+ ok(caught, "Setting " + value + " to .valueAsDate should throw");
Either s/Setting/Assigning/ or "setting .valueAsDate to " + value + " should throw".
r=me with those nits.
Attachment #697485 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #2)
> Comment on attachment 697485 [details] [diff] [review]
> Patch
>
> >+ if (aDate.isNull()) {
>
> isNullOrUndefined(), please.
The HTML specs say:
"if the new value is null or a Date object representing the NaN time value, then set the value of the element to the empty string".
As far as I understand it, that means "undefined" should be considered as a TypeError. Or did I missed something?
I've added a test for this to make it clearer that undefined should throw.
Comment 4•12 years ago
|
||
> "if the new value is null
That's the IDL value, not the JS value. Nullable IDL values turn both JS null and JS undefined into null IDL values. If you were actually using our WebIDL bindings, this would happen automatically before you ever got into this code.
Specifically, see http://dev.w3.org/2006/webapi/WebIDL/#es-nullable-type step 3 under "An ECMAScript value V is converted to an IDL nullable type T? value (where T is the inner type) as follows".
Assignee | ||
Comment 5•12 years ago
|
||
Fixed. Thanks for the explanations :)
Assignee | ||
Comment 6•12 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla20
Comment 7•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: mozilla20 → mozilla21
Assignee | ||
Comment 8•12 years ago
|
||
Comment on attachment 697485 [details] [diff] [review]
Patch
[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 769370
User impact if declined: adding a new feature with a known bug
Testing completed (on m-c, etc.): m-c
Risk to taking this patch (and alternatives if risky): low, we could introduce another bug in the feature by fixing that one but we have a pretty good test coverage
String or UUID changes made by this patch: none
Attachment #697485 -
Flags: approval-mozilla-aurora?
Comment 9•12 years ago
|
||
Comment on attachment 697485 [details] [diff] [review]
Patch
Low risk uplift for a new feature in Fx20.Approving on aurora.
Attachment #697485 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 10•12 years ago
|
||
status-firefox20:
--- → fixed
status-firefox21:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•