bad display of text in javascript alert window




14 years ago
14 years ago


(Reporter: trigaux.richard, Unassigned)


Windows 2000

Firefox Tracking Flags

(Not tracked)





14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.5) Gecko/20041108 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.5) Gecko/20041108 Firefox/1.0

the alert window displays only one line of text in place of three.
Code used:
alert("      Pour fermer cliquer sur l'image.\r\r                         
--oo--\r\rCopyright Richard Trigaux Mars 2004       ")

-The signs \r (line feed) are ignored.
-The blanc spaces (used here for correct alignment of the text) are ignored.
-A similar bug 248395 is open about uncorrect wrapping of long texts

Reproducible: Always
Steps to Reproduce:
1. open the page
2. the concerned alert window opens automatically when the page opens
3. see the text

Actual Results:  
All the text is displayed on one long line
(see with firefox)

Expected Results:  
the text should appear on three lines and each line centered
(see with Internet Explorer)

A similar bug is open n°248395 about uncorrect wrapping of long texts.

Comment 1

14 years ago
Use \n or \n\r instead, works fine.
You have two separate bugs, both of which are Product: Core, Component: DOM0.

Collapsing multiple spaces is a dup of bug 50348 (and note there's a workaround
in bug 50348 comment 11).

As comment 1 notes, just using \n, which is always a newline, rather than \r,
which is sometimes a carriage return and sometimes nothing, will work fine, but
I don't see anywhere that interpreting \r in DOM0 has been marked INVALID or
WONTFIX, so I'll leave that to someone who knows it better than I.
Assignee: firefox → general
Component: General → DOM: Level 0
Product: Firefox → Core
QA Contact: firefox.general → ian
Version: unspecified → Trunk

Comment 3

14 years ago
\r or \n? Whatever the solution, it must also work with existing browsers 
(mainly netscate and IE). Only IN-TE-RO-PE-RA-BI-LI-TY will save hardship for 
webdesigners. Thanks to heed that. 

Comment 4

14 years ago
As noted by Hanabi (comment #1) \n works at least with Firefox 1.0  IE 6. and 
Netscape 7.0 . But how such tips are difficult to guess!!

And as noted by  Phil Ringnalda  (comment #2) my remark about blank spaces is a 
duplicate of bug 50348.

So I could close this bug, but I prefer to left it open so that specialists of 
the Alert window could confirm that line feed with \n is the "standard" in 
practice (must be implemented in any case).

Thanks all.
\n is the standard DOM linefeed.  \r is not even a valid character in W3C DOM

*** This bug has been marked as a duplicate of 50348 ***
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.