Closed Bug 148178 Opened 21 years ago Closed 2 years ago

prompt does not support line breaks and other special characters


(Core :: DOM: Core & HTML, defect, P5)

Windows 2000





(Reporter: chris, Unassigned)




take any document with content and type in the url bar javascript: prompt
("innerHTML",document.body.innerHTML), the usual result is an empty field

similarly if you pass a Javascript string with new line characters etc 
e.g. 'hello\nhow are you?\n good bye' you only get the first line in the prompt

neither IE nor Netscape 4 behaved like this and it is inconvenient for 
development as well as some applications (that might produce data to be copy 
and pasted into a text editor etc)

as a side note IE has the nice feature of delivering the text selected for easy 
copying and pasting of large strings
Browser, not engine ---> DOM Level 0. Confirming reported behavior.
I tried this in NN4.7, IE6, and Mozilla trunk binary 20020520xx on WinNT:

    javascript: prompt("test",'hello\nhow are you?\n good bye')

In NN4.7 and IE6, each '\n' was replaced with some type of pipe symbol,
and we could see the whole message in the input line of the prompt.

In Moz, however, each '\n' is expressed literally as a linefeed,
so we only end up seeint 'hello' in the input line of the prompt
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → desale
Mass-reassigning bugs to
Assignee: jst → dom_bugs
Assignee: general → nobody
QA Contact: desale → general

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Closed: 2 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.