Closed Bug 444576 Opened 16 years ago Closed 16 years ago

div.innerHTML = "<p>&nbsp;x</p>"

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 445166

People

(Reporter: dkoning, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

JavaScipt:

if you want to set the innerHTML of a dom element and the string contains '&nbsp;' an error will occur.
Do you know a nice way to fix this?

Reproducible: Always

Steps to Reproduce:
write the javascript:

var div = document.createElement("div");
div.innerHTML = "<p>&nbsp;x</p>";
Actual Results:  
(using firebug)
uncaught exception: [Exception... "Component returned failure code: 0x80004003 
(NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://localhost/petreltrunk/jscript/common.js :: setInnerHTML :: line 1062" data: no]
[Break on this error] undefined
Attached file Testcase
WFM: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Dirk, do you get the error when you load the attachment in comment 1?
yes, that code runs... but it doesn't in the asp project I'm working on. So now I see the error is a combination of FF and the asp code. I'm trying to debug it, so you can wait for a while.
Ok, please file a new bug report when you figure it out so that the bug is easy to follow.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
the content-type was set to application/xhtml+xml

maybe you can add a warning when this happens
> the content-type was set to application/xhtml+xml

That was it, thanks for figuring it out!  I do think it's a bug.  I filed a clean bug report, bug 445166.
Resolution: INVALID → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: