Closed Bug 769357 Opened 12 years ago Closed 12 years ago

Implement <input type=date> min attribute

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: raphc, Assigned: raphc)

References

Details

(Keywords: doc-bug-filed)

Attachments

(1 file, 3 obsolete files)

      No description provided.
Depends on: 769385
Attached patch patch (obsolete) — Splinter Review
This patch applies on top of the one in bug 769355.
Attachment #645694 - Flags: feedback?(mounir)
Depends on: 769355
Blocks: 769359
Comment on attachment 645694 [details] [diff] [review]
patch

Review of attachment 645694 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +4597,5 @@
> +        double min = GetMinAsDouble();
> +        MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(min));
> +
> +        minStr.AppendFloat(min);
> +      } else {

else if (mType == NS_FORM_INPUT_DATE)
and:
} else {
MOZ_NOTREACHED();
}

::: content/html/content/test/forms/test_min_attribute.html
@@ +151,5 @@
> +
> +    input.min = '0050-01-01';
> +    checkValidity(input, true, apply, apply);
> +
> +    input.val = '0049-01-01';

input.value
Attachment #645694 - Flags: feedback?(mounir) → feedback+
Attached patch patch (obsolete) — Splinter Review
Attachment #645694 - Attachment is obsolete: true
Attachment #650141 - Flags: review?(mounir)
Comment on attachment 650141 [details] [diff] [review]
patch

Review of attachment 650141 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +1257,5 @@
>    GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
>  
> +  double min;
> +  bool result = ConvertStringToNumber(minStr, min);
> +  return result ? min : MOZ_DOUBLE_NaN();

Could be:
return ConvertStringToNumber(minStr, min) ? min : MOZ_DOUBLE_NaN();

@@ +4625,5 @@
> +        minStr.AppendFloat(min);
> +      } else if (mType == NS_FORM_INPUT_DATE) {
> +        GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
> +      } else {
> +        NS_NOTREACHED("Invalid input type");

nit: change the error message to "Unexpected input type".
Attachment #650141 - Flags: review?(mounir) → review+
Attached patch patch (obsolete) — Splinter Review
Attachment #650141 - Attachment is obsolete: true
Attachment #650249 - Flags: review+
Attached patch patchSplinter Review
Updated patch.
Attachment #650249 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/5705bb322879
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
See bug 866440 for documentation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: