Hello, I tried HTML example <p> text1 <b> text2 <p> text3 </b> and got text2 and text3 bolded. Opera in its DOM structure shows <p> text1 <b> text2 <p> text3 </p> </b> </p> but is that possible to have paragraph inside paragraph? I thought its actually against the HTML rules and convention. How in this case someone should act according to specification? Could you point me a page where I can read it? I am not sure what are the actual rules when it is about "block inside block" situations. If <p> can't be inside another <p>, how then this example should be handled? Thank you in advance. Best regards,
While Opera may find a place for it in the DOM, how it gets rendered is a different animal and may not be consistent between browsers. You can fit a round peg in a square hole, too, but not sure if you'll like the affect on the peg.
Thanks, but is there some page with specification about that? I would like to know what are the exact rules given by specification. Thanks a lot.
You are looking for the specification for how a browser handles invalid markup in the DOM? The better thing to do is write valid markup and not worry about the rest.
No, I don't care how browser handle something, it was just an example I am interested in specification. I know how I should use paragraph, but I would like to see what specification says. For example, http://www.w3.org/TR/html401/struct/text.html#h-9.3.1 says that p can not contain another p - "It cannot contain block-level elements (including P itself)." And, I am interested in general "contains something" rules. So, I do <b>not</b> care what browsers do, that was just an example
The link you gave is the spec so I don't know what else you want. You can look at the W3C site for the DOM level 0 and level 1 specs, too.
Ok, thanks I just thought there is some kind of summary where are given such rules for which I have asked, but I will carefully read the whole (at at least some parts ) spec in order to find what I need.