Closed
Bug 797282
Opened 12 years ago
Closed 12 years ago
under windows javascript function substring() is interrupting a new line "\r\n" as "1" character when it should be "2" characters
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jbricci, Unassigned)
Details
(Keywords: regression)
Attachments
(4 files, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 5.2; rv:12.0) Gecko/20100101 Firefox/12.0 Build ID: 20120420145725 Steps to reproduce: made a little highlight a word script to show you the problem... script works fine in all browsers but Firefox. As a side note...this test script works in Firefox up to version 8.0, but not after that. Actual results: wrong result... (spell ~ iframe result) <html> <head> <style> body { background-color : #ffffff; font-family : arial, helvetica, sans-serif; margin : 0px; padding : 4px } .nsw, .swe { font-size : 12px } .nsw { color : #252525 } .tab { padding-left : 3em } .swe { color : #fa6105; border : 1px solid #91d591; padding-left : 2px; padding-right : 2px; background : #e7f4e7 } </style> </head> <body> <div class='nsw'>hippos<br /><br /><br /><br /><br />peopl<span id='highlight' class='swe'>peoplez</span>eep<br /><br />newz<br /></div> </body> </html> Expected results: correct result... (spell ~ iframe result) <html> <head> <style> body { background-color : #ffffff; font-family : arial, helvetica, sans-serif; margin : 0px; padding : 4px } .nsw, .swe { font-size : 12px } .nsw { color : #252525 } .tab { padding-left : 3em } .swe { color : #fa6105; border : 1px solid #91d591; padding-left : 2px; padding-right : 2px; background : #e7f4e7 } </style> </head> <body> <div class='nsw'>hippos<br /><br /><br /><br /><br /><span id='highlight' class='swe'>peoplez</span><br /><br /><br />keeep<br /><br />newz<br /></div> </body> </html>
sorry... fixed test example to remove extra document.write code
Attachment #667367 -
Attachment is obsolete: true
Attachment #667371 -
Attachment mime type: text/plain → text/html
I see the same result with FF8 and FF15. Could you attach a screenshot please.
I have attached a firefox 12 screen shot, and a firefox 3 screen shot. I don't know exactly when the javascript engine changed the way it handles new lines on a windows machine, but it was changed because this script once supported all browsers but now it seems I have to add browser identification hacks because some newer browsers, newer versions of those browsers, are using the newer javascript engine which is interrupting \r\n as a single character and that is wrong.
Okay... after doing a lot of testing, the changed happened in firefox 6.0.2, in firefox 6.0.1 the code works fine, but it stops working in firefox 6.0.2
There is a regression since Firefox 3.7a5pre: m-c 2010-05-03 2010-05-04 http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=83c887dff0da&tochange=d6bb0f9e9519 I'd say the suspected bug is: Olli Pettay — Bug 562013 - parse innerHTML directly to the destination node, p=smaug+hsivonen, r=sicking
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM
Ever confirmed: true
Keywords: regression,
regressionwindow-wanted
Product: Firefox → Core
Version: 12 Branch → 2.0 Branch
Comment 8•12 years ago
|
||
A *minimal* testcase would be great. Bug 562013 has nothing to do with substring(), I wonder what this bug is about.
Comment 9•12 years ago
|
||
The difference is length of "\r\n" in hidden input tag, not substring(). In Firefox3.6 : length of "\r\n" in hidden input tag is treated 2 In Firefox4.0+ : length of "\r\n" in hidden input tag is treated 1
Comment 10•12 years ago
|
||
"\r\n" in hidden input tag is treated 2: http://hg.mozilla.org/mozilla-central/rev/83c887dff0da Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100503 Minefield/3.7a5pre ID:20100503040502 "\r\n" in hidden input tag is treated 1: http://hg.mozilla.org/mozilla-central/rev/3a7920df7580 Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100503 Minefield/3.7a5pre ID:20100503105056 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=83c887dff0da&tochange=3a7920df7580 Triggered by: 358113b3642e Henri Sivonen — Bug 373864 - Enable the HTML5 parser by default. r+sr=jst. And also, the behavior of Firefox4+ is as same as Google Chrome22.0.1229.79 m and Opera12.02.
Comment 11•12 years ago
|
||
http://dev.w3.org/html5/spec/single-page.html#concept-textarea-api-value > The element's API value is defined to be the element's raw value with the following transformation applied: > 1. Replace every U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair from the raw value with a single "LF" (U+000A) character.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Updated•9 years ago
|
Keywords: regressionwindow-wanted
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•