<?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>9403</bug_id>
          
          <creation_ts>2010-04-04 12:29:18 +0000</creation_ts>
          <short_desc>The output element example is confusing</short_desc>
          <delta_ts>2010-10-04 14:55:39 +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>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://dev.w3.org/html5/spec/forms.html#the-output-element</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</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>ian</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</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>34512</commentid>
    <comment_count>0</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2010-04-04 12:29:18 +0000</bug_when>
    <thetext>In the specifications, the example for the output element is:
&lt;form onsubmit=&quot;return false&quot;&gt;
 &lt;input name=a type=number step=any&gt; +
 &lt;input name=b type=number step=any&gt; =
 &lt;output onforminput=&quot;value = a.value + b.value&quot;&gt;&lt;/output&gt;
&lt;/form&gt;

However, &quot;a.value + b.value&quot; is a string concatenation so if a.value=&apos;1&apos; and b.value=&apos;2&apos; we are getting &quot;12&quot; in output. It sounds the example idea is to show &quot;3&quot; instead of &quot;12&quot;.

There are two solutions:
 1. using * instead of + so there will be no more confusion with + method of the string concatenation.
 2. changing onforminput to &quot;value = parseFloat(a.value) + parseFloat(b.value);&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34518</commentid>
    <comment_count>1</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2010-04-04 18:36:58 +0000</bug_when>
    <thetext>Or even better, make it
 &lt;output onforminput=&quot;value = a.valueAsNumber + b.valueAsNumber&quot;&gt;&lt;/output&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34521</commentid>
    <comment_count>2</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2010-04-04 21:29:43 +0000</bug_when>
    <thetext>Indeed, .valueAsNumber is even better ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34820</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-04-12 23:39:05 +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: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34822</commentid>
    <comment_count>4</comment_count>
    <who name="">contributor</who>
    <bug_when>2010-04-12 23:40:30 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r5005.
Check-in comment: Make the example make more sense.
http://html5.org/tools/web-apps-tracker?from=5004&amp;to=5005</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>