#583 closed defect (fixed)
Tree doesn't work correctly with immediately closed <div> tags
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | General | Version: | 0.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Try the following tree. Note the immediately closed <div> tags for one.1 and one.2
(I tried with the version in SVN repository as of March 28th, 2006.)
<div dojoType="Tree"> <div title="one" dojoType="TreeNode"> <div title="one.1" dojoType="TreeNode"/> <div title="one.2" dojoType="TreeNode"/> </div> </div>
This shows an incorrect parent-child relationship:
> one > one.1 > one.2
Instead of the expected:
> one > one.1 > one.2
However, if I close the <div> tags separately
<div dojoType="Tree"> <div title="one" dojoType="TreeNode"> <div title="one.1" dojoType="TreeNode"></div> <div title="one.2" dojoType="TreeNode"></div> </div> </div>
It works as expect. It looks like a parsing bug.
Change History (4)
comment:1 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 15 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Just trying to understand the comment:
- Isn't <div/> equivalent to <div></div>?
- Isn't <div/> XHTML conformant? XHTML DTD/Schema allows divs to have empty content.
If I were to produce a DOM from <div/></div/> (using a conformant parser), I would correctly get two sibling nodes. If DOJO too were to parse it in the conformant way, tree would show the correct relationship.
The way I am producing the content to be consumed by DOJO, it will be really nice if a conformant DOM is treated correctly. From the producers point-of-view there is absolutely no difference between <div/> and <div></div>.
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
- Isn't <div/> equivalent to <div></div>?
- Isn't <div/> XHTML conformant? XHTML DTD/Schema allows divs to have empty content.
Nope. I don't know how/where it is defined exactly, but my understanding is that, with XHTML, items, such as div, p, etc that can have content (but arent' necessarily required to) need to use <div></div> syntax. Items like <br> that never have content (stand alone) are free to use the <br/> sytnax. Others can probably do a better job of articulating this as it relates to defined XHTML, or if you do a search on the mailing list it has been discussed before. Bottom line is that this isn't a Dojo thing, it is an XHMTL/Browser interpretation of XHTML thing.
Generally, you shouldn't close tags like that while you are in HTML. Maybe DOCTYPE property and XHTML conformance could help.