Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:37:03+00:00 2026-05-23T09:37:03+00:00

I have observed how firefox can move text and element nodes, listed before the

  • 0

I have observed how firefox can move text and element nodes, listed before the BODY element in a HTML document, to become direct children of the BODY element.

I’m using xulrunner 2.0.1 (Firefox 4.0), Although I have observed IE also moving text, but not elements.

Here are some examples of FF doing this:

Example HTML Document 1 (text nodes and title element moved inside body):

"<html>abc<title>def</title>hij<body>inn<span>e</span>r</body>klm</html>"

Querying nsIDOMNSHTMLElement.innerHTML on the Body element using gives:

"abc<title>def</title>hijinn<span>e</span>rklm"

Iterating through Body child elements gives:

Text : "abc"
Element : "def"
Text : "hijinn"
Element : "e"
Text : "rklm"

Example HTML Document 2 (text node moved inside body but title isn’t):

"<html><title>def</title>hij<body>inn<span>e</span>r</body>klm</html>"

Querying nsIDOMNSHTMLElement.innerHTML on the Body element using gives:

"hijinn<span>e</span>rklm"

Iterating through Body child elements gives:

Text : "hijinn"
Elemnt : "e"
Text : "rklm"

My question is why is this happening? I would have expected innerHTML just to display what between the two body tags?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:37:04+00:00Added an answer on May 23, 2026 at 9:37 am

    The basic answer is “because the HTML5 parsing algorithm says so”. To be more specific, only certain tags are allowed outside of <body>, and everything else gets put inside <body> even though it wasn’t there in the original data stream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In testing document.location.href, I have observed that when the user initiates an action that
In my firefox extension I'm creating a xul:browser element. I want to have an
I have observed the following behavior in Firefox 4 and Chrome 7: If the
I have a listbox and a html <map> element on my page. The list
I have observed that, very infrequently, Internet Explorer (7 or 8, it does not
I have a view (actually, it's a table valued function, but the observed behavior
I have made a generic Observer interface and an Observable class, but can't compile
I want to implement the header as like twitter has. I have observed couple
I have observed following error logs in one of log files 2012-01-31 10:52:46,424 IST
I have observed that windowWillClose is called when the user closes a window but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.