String comparison in JS when numbers are expected

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      https://github.com/jenkinsci/jenkins/blob/f49b4b9418e0246463dd4e50bf9f3a076c3e488a/war/src/main/webapp/scripts/hudson-behavior.js#L828 compares min and max, which are strings.

      "5" would be greater than "10" here, because they're compared by character, not numeric value.

      To reproduce, compare form validation behavior of e.g.

      <f:number min="10" max="20" clazz="positive-number-required" />

      and

      <f:number min="5" max="10" clazz="positive-number-required" /> 

       

            Assignee:
            Jérôme Pochat
            Reporter:
            Daniel Beck
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: