Closed Bug 241921 Opened 20 years ago Closed 20 years ago

Copying text to a textarea with javascript - Mozilla puts tags around the text if an unclosed tag is above the text that you are copying

Categories

(SeaMonkey :: General, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: thesh_bugs, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 If you set up a function to copy the text from a div to a textarea and there is an unclosed tag directly above the div, Mozilla will put tags around the text in the div. I believe this is only for tags which directly effect the font (<b>, <i>, <font>, etc.). If there is another <div> or <span> or similar tag after it. Testcase coming soon. Reproducible: Always Steps to Reproduce:
Attached file Testcase. (deleted) —
The first text normal, and has no unlcosed tags above it. The second has an unclosed <b> tag. I believe that Mozilla should copy only what is in the div and not add tags that aren't there.
Summary: Copying text from div to textarea - Mozilla adds <*></*> if unclosed tag is above the div. → Copying text to a textarea with javascript - Mozilla puts tags around the text if an unclosed tag is above the text that you are copying
use innerTEXT instead of innerHTML. innerHTML gives you HTML formating
The tags are added so that the text will be bold. <b> is not allowed to contain <div> in HTML, so the parser fixes that markup up to be: <b></b> <div> <b> Text </b> </div> And so the innerHTML of the div does in fact have a <b> in it. Using valid HTML will help prevent such surprises when looking at the DOM.... Konstantin, you do realize that Mozilla does not support innerText, right? We do support the standard textContent property, however.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: