Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-76002

String comparison in JS when numbers are expected

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" /> 

       

            jpochat Jérôme Pochat
            danielbeck Daniel Beck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: