Last Comment Bug 769357 - Implement <input type=date> min attribute
: Implement <input type=date> min attribute
Status: RESOLVED FIXED
: doc-bug-filed
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla20
Assigned To: Raphael Catolino (:raphc)
:
: Andrew Overholt [:overholt]
Mentors:
Depends on: 769355 769385
Blocks: 769352 769359
  Show dependency treegraph
 
Reported: 2012-06-28 10:47 PDT by Raphael Catolino (:raphc)
Modified: 2013-04-27 13:28 PDT (History)
3 users (show)
mounir: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (5.57 KB, patch)
2012-07-25 03:37 PDT, Raphael Catolino (:raphc)
mounir: feedback+
Details | Diff | Splinter Review
patch (5.66 KB, patch)
2012-08-08 08:38 PDT, Raphael Catolino (:raphc)
mounir: review+
Details | Diff | Splinter Review
patch (5.65 KB, patch)
2012-08-08 12:17 PDT, Raphael Catolino (:raphc)
raphael.catolino: review+
Details | Diff | Splinter Review
patch (5.65 KB, patch)
2012-08-16 11:33 PDT, Raphael Catolino (:raphc)
no flags Details | Diff | Splinter Review

Description Raphael Catolino (:raphc) 2012-06-28 10:47:03 PDT

    
Comment 1 Raphael Catolino (:raphc) 2012-07-25 03:37:53 PDT
Created attachment 645694 [details] [diff] [review]
patch

This patch applies on top of the one in bug 769355.
Comment 2 Mounir Lamouri (:mounir) 2012-08-06 04:39:51 PDT
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
Comment 3 Raphael Catolino (:raphc) 2012-08-08 08:38:29 PDT
Created attachment 650141 [details] [diff] [review]
patch
Comment 4 Mounir Lamouri (:mounir) 2012-08-08 09:37:00 PDT
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".
Comment 5 Raphael Catolino (:raphc) 2012-08-08 12:17:42 PDT
Created attachment 650249 [details] [diff] [review]
patch
Comment 6 Raphael Catolino (:raphc) 2012-08-16 11:33:27 PDT
Created attachment 652509 [details] [diff] [review]
patch

Updated patch.
Comment 7 Mounir Lamouri (:mounir) 2012-12-28 04:58:27 PST
https://hg.mozilla.org/mozilla-central/rev/5705bb322879
Comment 8 Florian Scholz [:fscholz] (MDN) 2013-04-27 13:28:18 PDT
See bug 866440 for documentation.

Note You need to log in before you can comment on or make changes to this bug.