Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Wednesday, March 30, 2016

Why is firebug auto-inserting

?

Why is firebug auto-inserting

?


I am using "Edit Html" in firebug and inserting the following bit of code:

  
X

Drew Brees #9

Quarterback

The Saints

However, when I move off of edit html mode, what is actually IN the DOM is this:

X

Drew Brees #9

Quarterback

The Saints

Am I missing something about how the p element works? The MDC says the content can be any flow element. Where are those

s coming from? Is it firefox? firebug?

Edit before I accept the answer: So apparently

cannot nest within

, does that mean that the MDC is wrong or that I am somehow misinterpreting it?

Answer by spraff for Why is firebug auto-inserting

?


It is incorrect to nest

elements.

Firefox parses the HTML to get a DOM tree. The DOM tree is always well-formed even if the source code isn't. This representation might also present whitespace and escape codes differently.

Firebug primarily works with the DOM representation. This

  • is simpler,
  • is less likely to suffer from discrepencies of interpretation,
  • and makes it possible to diagnose poorly-written HTML.

Firebug will refer back to the source only for things like script debugging.

Answer by Jason Gennaro for Why is firebug auto-inserting

?


Probably happening because

are block-level elements and cannot contain other block-level elements.

Firebug is compensating and auto-correcting.

Answer by You for Why is firebug auto-inserting

?


Since the p element isn't allowed inside another p element, and its end tag is optional, Firebug (or rather, the underlying HTML/SGML parser) inserts an end tag where it (correctly) guesses there should be one.

Edit: The HTML 4.01 spec is very clear on this; you cannot nest p elements (and in that respect, the MDC is incorrect). The HTML5 spec, however, is very unclear on the subject (I have submitted feedback on the issue) The HTML5 spec is crystal clear on the subject, I'm just reading it wrong, and common sense as well as typographic effect dictates that a paragraph of text (which the p element represents) cannot contain a second paragraph of text.

Answer by Sotiris for Why is firebug auto-inserting

?


from w3 documentation

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

http://www.w3.org/TR/html401/struct/text.html#h-9.3.1

Answer by Tyler Crompton for Why is firebug auto-inserting

?


X

Drew Brees #9

Quarterback

The Saints


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.