<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>12151</bug_id>
          
          <creation_ts>2011-02-22 00:08:17 +0000</creation_ts>
          <short_desc>:in-range and :out-of-range should only apply to input elements with a type for which min or max apply</short_desc>
          <delta_ts>2011-08-04 05:17:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mounir Lamouri">mounir</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>mathias</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>45911</commentid>
    <comment_count>0</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2011-02-22 00:08:17 +0000</bug_when>
    <thetext>According to CSS3-UI [1], &quot;The :in-range and :out-of-range pseudo-classes apply only to elements that have range limitations.&quot; but according to HTML specs [2], :in-range and :out-of-range apply to all elements that are candidates for constraint validation (then one will apply or the other).

It seems better to have those pseudo-classes only apply to input elements with a type for which min or max apply (number, range and all date/time types).

[1] http://www.w3.org/TR/css3-ui/#pseudo-range
[2] http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#pseudo-classes</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45912</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-02-22 00:27:14 +0000</bug_when>
    <thetext>So you&apos;re saying that it should apply to all of:

&lt;input type=number max=&quot;4711&quot;&gt;
&lt;input type=number min=&quot;4711&quot;&gt;
&lt;input type=number min=&quot;17&quot; max=&quot;4711&quot;&gt;

but not apply to any of:

&lt;input type=number&gt;
&lt;input type=text max=&quot;14&quot;&gt;
&lt;input type=date&gt;
&lt;input type=time&gt;

?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45913</commentid>
    <comment_count>2</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2011-02-22 00:34:13 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; So you&apos;re saying that it should apply to all of:
&gt; 
&gt; &lt;input type=number max=&quot;4711&quot;&gt;
&gt; &lt;input type=number min=&quot;4711&quot;&gt;
&gt; &lt;input type=number min=&quot;17&quot; max=&quot;4711&quot;&gt;

Yes.

&gt; but not apply to any of:
&gt; 
&gt; &lt;input type=number&gt;
&gt; &lt;input type=text max=&quot;14&quot;&gt;
&gt; &lt;input type=date&gt;
&gt; &lt;input type=time&gt;

I agree for &lt;input type=&apos;text&apos; max=&apos;14&apos;&gt; for the others, those types can be limited (min and max apply to them). My original comment ask to have the pseudo-classes always applying to number, range and date/times types (even if min and max isn&apos;t present). I wouldn&apos;t disagree to have them apply only if min or max is present but in that case, what should we do if min or max isn&apos;t valid? (&lt;input type=&apos;number&apos; max=&quot;foo&quot;&gt; for example).
I think it&apos;s easier to understand and implement to have these pseudo-classes applying to some types instead of applying for some types if a specific attribute is present and valid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45916</commentid>
    <comment_count>3</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-02-22 05:47:40 +0000</bug_when>
    <thetext>To me it seems most consistent to have them apply only if there in fact is a range.

While it&apos;s more common to talk about ranges of numbers, in database contexts it&apos;s quite common to talk about ranges of strings. For example you can request all records between &quot;a&quot; and &quot;c&quot; which would include &quot;aa&quot; and &quot;azzz&quot;, but not &quot;d&quot;.

So I think it&apos;s most consistent if the classes apply only if an actual range limitation is imposed on the submitted value. Which would mean for:

&lt;input type=number max=4711&gt;
&lt;input type=date min=&quot;1987-06-06&quot;&gt;

but not for any of

&lt;input type=number&gt;
&lt;input type=number max=&quot;foo&quot;&gt;
&lt;input type=date min=&quot;yesterday-ish&quot;&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45942</commentid>
    <comment_count>4</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2011-02-22 23:07:35 +0000</bug_when>
    <thetext>I would be fine with that too but I&apos;m wondering how is that more consistent? I mean, is there anything similar in HTML/CSS specs?
The closest thing I see is :valid/:invalid but we can&apos;t really use it for consistency because of setCustomValidity() that can make any element invalid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45943</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-02-23 00:13:12 +0000</bug_when>
    <thetext>It just seems more consistent to me that the range selectors only apply if there is an actual range requirement.

If you want them to apply &quot;when there could be ranges&quot; you get into the somewhat fuzzy discussion of which types can have ranges.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45944</commentid>
    <comment_count>6</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2011-02-23 00:27:15 +0000</bug_when>
    <thetext>I think the input types that can have ranges are those that can have min and max applying.
But, to be clear, I&apos;m fine with your proposition. It seems more complex than just doing it per-type but it also makes more sense (at least, the logic is more strict).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45947</commentid>
    <comment_count>7</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-02-23 02:49:41 +0000</bug_when>
    <thetext>More complex in what sense? To implement or to use? If it&apos;s the former then that doesn&apos;t worry me so much. Unless you think it&apos;s prohibitively complex (e.g. perf). You&apos;re likely the one to implement in gecko, so you&apos;re the best judge of that ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46019</commentid>
    <comment_count>8</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2011-02-25 00:28:13 +0000</bug_when>
    <thetext>Both actually.
That would be the first pseudo-class I see that applies or not depending on so much conditions (has to be &lt;input&gt;, with type={number,range,...}, with max or min defined and set to a valid value, then depending on the element&apos;s value, one of the two classes will apply). But I&apos;m far from being experienced on that field so I trust your judgment.
For implementation, the real issue is the min/max validity which can&apos;t be checked too often so depending on the UA, it might be more or less a pain. For Gecko, we will have to keep a flag telling us if those attributes have valid values for the current type.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46732</commentid>
    <comment_count>9</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-03-15 21:02:07 +0000</bug_when>
    <thetext>I&apos;m not sure I agree that it&apos;s that many conditions. Conceptually it&apos;s just one condition, &quot;has a defined range&quot;. What you are proposing is &quot;is of type that supports ranges&quot; which IMHO isn&apos;t obviously a simpler condition.

Additionally, the :-moz-ui-invalid pseudo classes we have in gecko have a much more complex set of conditions, though there too the concept is the simpler &quot;does it make sense to render invalid-UI&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48226</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-05-06 20:08:47 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: I tightened up the definitions to match CSS3 UI more closely (which basically means I did what Jonas suggested).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48227</commentid>
    <comment_count>11</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-05-06 20:09:37 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6106.
Check-in comment: Make :in-range and :out-of-range definitions match the spec that introduced them.
http://html5.org/tools/web-apps-tracker?from=6105&amp;to=6106</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53782</commentid>
    <comment_count>12</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:17:18 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>