Closed Bug 535448 Opened 15 years ago Closed 14 years ago

simple innerHTML ok on all browsers but Firefox

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tchvil, Unassigned)

References

()

Details

(Whiteboard: [fixed by the HTML5 parser])

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

IE, Safari, Chrome and Opera do not have this problem.

Firefox adds a tag while using innerHTML on a simple DOM manipulation.
This tag has a special attribute: _moz-rs-heading=""
<a _moz-rs-heading="">some H1</a>

Reproducible: Always

Steps to Reproduce:
1. Create an HTML page and paste the code from the url.
2. Open it in Firefox:

The H1 tag in all browser becomes:
<h1>some H1</h1>

While in Firefox it is polluted with an 'a' tag:
<h1><a _moz-rs-heading="">some H1</a></h1>


Here is the code of the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<title></title>
  </head>
  <body>
	<div>
		<a><h1></h1><div>abc</div></a>
	</div>
	<script>
		//this line fails
		document.getElementsByTagName('h1')[0].innerHTML = 'some H1';

		//show the result
		document.write(document.getElementsByTagName('div')[0].innerHTML.replace(/</g, '&lt;').replace(/>/g, '&gt;'));
	</script>
  </body>
</html>
Actual Results:  
<h1><a _moz-rs-heading="">some H1</a></h1>

Expected Results:  
<h1>some H1</h1>

using appendChild with a textNode is ok
Version: unspecified → 3.5 Branch
This was fixed by the HTML5 parser
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: General → HTML: Parser
Depends on: html5-parsing
OS: Mac OS X → All
Product: Firefox → Core
QA Contact: general → parser
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [fixed by the HTML5 parser]
Version: 3.5 Branch → Trunk
You need to log in before you can comment on or make changes to this bug.