You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2012/04/03 22:02:02 UTC
svn commit: r1309121 -
/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
Author: gcrawford
Date: Tue Apr 3 20:02:01 2012
New Revision: 1309121
URL: http://svn.apache.org/viewvc?rev=1309121&view=rev
Log:
TRINIDAD-2219 Negative numbers for Bidi/RTL languages are not handled correctly
Thanks to Bino
Modified:
myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js?rev=1309121&r1=1309120&r2=1309121&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js Tue Apr 3 20:02:01 2012
@@ -1016,14 +1016,19 @@ function _decimalParse(
// JIRA TRINIDAD-2219: When the string is a negative bidi number, e.g. "1-", the
//(numberString*numberString) and (numberString / numberString) return NaN
- // and is unable to parse it so additional handling is needed for such cases.
- var negativeSuffix = symbols.getNegativeSuffix();
- var numberStringLength = numberString.length ;
-
- if(negativeSuffix != null && numberString.lastIndexOf(negativeSuffix) == (numberStringLength - 1))
+ // and is unable to parse it so in Bidi, we check if the number is of the format "X-"
+ // and convert it to "-X" which Javascript can understands. .
+ var isLTR = document.documentElement["dir"].toUpperCase() == "LTR";
+
+ if(!isLTR)
{
- numberString = "-" + numberString.substring(0, numberStringLength - 1);
- }
+ var numberStringLength = numberString.length ;
+
+ if(numberString.lastIndexOf("-") == (numberStringLength - 1))
+ {
+ numberString = "-" + numberString.substring(0, numberStringLength - 1);
+ }
+ }//end of isLTR check
}
// OK; it's non-empty. Now, disallow exponential