From b846bea0fde6b14f63194450e4a77693c3a039a2 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Fri, 27 Sep 2013 13:49:57 -0400 Subject: [PATCH] Spinner: Only format the value when there is one. Fixes #9573 - Spinner: forces a field validation in Firefox before field loses focus or form is submitted (cherry picked from commit e6360ab846c6d0248d6013d005d2c178906ca692) --- ui/jquery.ui.spinner.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 644b652395a..aa284f09587 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -55,8 +55,12 @@ $.widget( "ui.spinner", { this._setOption( "min", this.options.min ); this._setOption( "step", this.options.step ); - // format the value, but don't constrain - this._value( this.element.val(), true ); + // Only format if there is a value, prevents the field from being marked + // as invalid in Firefox, see #9573. + if ( this.value() !== "" ) { + // Format the value, but don't constrain. + this._value( this.element.val(), true ); + } this._draw(); this._on( this._events );