Invalid HTML produced for glossary overview.
harking - April 24, 2008 - 18:25
| Project: | Glossary |
| Version: | 6.x-1.6 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
When viewing the default glossary/ page, invalid html is generated in the form of a
<dl>
<a id="lettera"></a>
<a id="term1"></a>
<dt>Term Title</dt>
<dd>Term description...</dd>
</dl>According to the html spec, a tags can't go inside of dl elements. I suggest that the dl is moved into the letter sections and is replaces outside with a div with the same ids/classes. we can then leave one anchor tag in place (letter) and move the term anchor tag into the dt.
Something simiar to:
<div id="glossary-list">
<a id="lettera"></a>
<dl>
<dt><a id="term1"></a>Term Title</dt>
<dd>Term description...</dd>
</dl>
</div>
#1
I've attached a patch which performs the structure changes to make the document valid.
Needs testing as I'm not familiar with all of the glossary options/combinations. Works well on our setup.
#2
Doh!
I forgot about the single glossary term pages, added dl wrappers for those too.
#3
When you submit a patch, please set the status to "patch (code needs review)" and assign the issue to yourself.
Did you actually try a validation? Does it validate after this change? It would seem that there is not much difference with this patch and that validation would still have a problem.
#4
Yes, I tested validation after the patch and it passed. Pages tested include the overview and the individual term. I also varied the different display options for the overview and it still validated.
Each change this patch made helps in validation. List of changes:
#5
Thanks.
#6
I ran into the same validation issue and tried this patch.
1) I can confirm that the view of Glossary Terms validates as XHTML 1.0 strict.
2) The glossary overview is broken for me, but this is another bug unrelated to this patch, as I found out. I'm going to submit a patch right after this.
After resolving my overview issue, the overview validates as XHTML 1.0 strict, too.
I don't set the status of this issue to reviewed, because of my problems with the overview.
#7
Some follow up questions for you guys:
1. Term synonyms are treated as though they are the terms themselves, so should we change the "synonyms: abc, def..." to additional <dt> tags?
2. Should we consider something similar with related terms and move them into additional <dd> tags?
Also, some confusion on your mention of "ul" within "dl":
According to the W3C recommendations:
"Block-level content" may be a nested list. Indeed the examples on the above page show an unordered list within a definition list.
#8
Is this necessary? That was in there before and I changed it so that HTML could be used and so that HTML entities would display correctly.
#9
I applied the patch, but it is not producing the <dl> or </dl> elements on the overview.
Also, you are clearly not using Taxonomy Image or the "Show detailed descriptions on the Glossary page" option. They introduce even more validation problems.
#10
It's always nice to fight a core issue while you're trying to fix one of your own. http://drupal.org/node/252277
#11
I have just committed the fix to -dev on both branches. Please test and let me know how it goes. Also there are some questions above.
#12
#13
I think it is necessary. The way I tested it was to place an & in my term name. When the term was rendered to the glossary and I validated it, the validation complained that the & was not converted to an HTML entity. I added the check_plain() and it took care of it.
There might be a different function that should have been used?
#14
The problem is that check_plain will make HTML entities display as text. For example, é will display exactly that way rather than as é. There is another issue already open about this.
#15
My output validates even without check_plain. Typing just an ampersand is not good practice.
#16
Automatically closed -- issue fixed for two weeks with no activity.
#17
I found this issue for the 5.x version but the Drupal 6 version also generates errors, so I reopened it for 6.
Most of them are:
document type does not allow element "dt" here; assuming missing "dl" start-tagand
end tag for "dd" omitted, but OMITTAG NO was specifiedYou can view a W3C validation example here. (1 letter overview with 6 errors)