Closed
Bug 470480
Opened 16 years ago
Closed 16 years ago
Linebreaks do not seem to be being counted properly when using javascript length property
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 188015
People
(Reporter: bartspublicaddress, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Linebreaks do not seem to be being counted properly when using javascript length property. Running the following input through the example code below results in different length values when done in IE7 versus Firefox. Environment: IE7 - 7.0.5730.13 Input Scenario 1: 1carriageReturnHere 2 Result: 3 Input Scenario 2: 1carriageReturnHere 2carriageReturnHere 3 Result: 5 Environment: Firefox - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Input Scenario 1: 1carriageReturnHere 2 Result: 4 Input Scenario 2: 1carriageReturnHere 2carriageReturnHere 3 Result: 7 Function that displays the scenario: function callMe(inputField) { var inputFieldVal = inputField.value; if( inputFieldVal.length > 0 ) { alert('inputFieldVal is ' + inputFieldVal); alert('inputFieldVal.length = ' + inputFieldVal.length); } } Reproducible: Always Steps to Reproduce: 1. Enter text with linebreak such as: 1carriageReturnHere 2noCarriageReturn 2. Examine length with javascript function. Actual Results: Received a length of 3. Expected Results: I expected a length of 4. For a quick test to see this bug in action in code other than my own, I used the following site for external validation. Same behavior witnessed. http://www.javascriptkit.com/script/script2/charcount.shtml
Updated•16 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•