Closed Bug 287395 Opened 20 years ago Closed 19 years ago

Setting a div innerText improperly interprets text as HTML

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 264412

People

(Reporter: bgould, Assigned: bugzilla)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

For example:

<HTML>
&nbsp;&nbsp;Men&#x0fa; 
<p>
<DIV ID="menuName">BEFORE &nbsp;&nbsp;Men&#x0fa;</DIV>
<p>
<script>
var foo="AFTER   &nbsp;&nbsp; Men&#x0fa;";
alert("changing content");
document.getElementById("menuName").innerText=foo;
alert("changed");
</script>


The div should show the "&nbsp" and the special character uninterpreted if the
value is set with innerText.  Instead it is doing as if I said to set "innerHTML".

Reproducible: Always

Steps to Reproduce:
1.  Create a div
2.  Set the contents with .innerText using special characters
3.

Actual Results:  
Values appear interpreted

Expected Results:  
Values should appear raw.
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050227
Firefox/1.0+

I am having difficulty seeing precisely what you have done. Does Firefox 
actually implement innerText?

See http://www.reloco.com.ar/mozilla/compat.html 
http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_unsupp and 
http://nexgenmedia.net/evang/iemozguide/

See Bug 254174 "textarea innerText returns undefined in javascript", 
Bug 254174 Comment 1

See Bug 264412 "innerText property on various elements not updatable with 
javascript", Bug 264412  Comment 1

Are you using your own implementation of innerText, and not showing it here?

Does the fix reported for Bug 282317 "IHTMLElement::innerText property 
incorrectly implemented - returns a value including HTML tags" (which I have 
not yet picked up) change anything here?
Firefox does not support innerText, if you somehow emulate this, then attach a
testcase to this bug and reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---

*** This bug has been marked as a duplicate of 254174 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago19 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 264412 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.