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>
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 250833_glossary-module-fixed-dd_1.patch | 947 bytes | jessebeach |
| #2 | glossary.module.dl-validation.patch | 5.31 KB | harking |
| #1 | glossary.module.dl-validation.patch | 5.22 KB | harking |
Comments
Comment #1
harking commentedI'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.
Comment #2
harking commentedDoh!
I forgot about the single glossary term pages, added dl wrappers for those too.
Comment #3
nancydruWhen 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.
Comment #4
harking commentedYes, 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:
Comment #5
nancydruThanks.
Comment #6
Andreas Wolf commentedI 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.
Comment #7
nancydruSome 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.
Comment #8
nancydruIs 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.
Comment #9
nancydruI 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.
Comment #10
nancydruIt's always nice to fight a core issue while you're trying to fix one of your own. http://drupal.org/node/252277
Comment #11
nancydruI 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.
Comment #12
nancydruComment #13
harking commentedI 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?
Comment #14
nancydruThe 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.
Comment #15
nancydruMy output validates even without check_plain. Typing just an ampersand is not good practice.
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
askibinski commentedI 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 specifiedComment #18
AaronCollier commentedI use 6.1.6 and I think the problem is that the patch above wasn't applied to 6 - the a elements are what are causing many of your errors.
Here's an example of what I get:
The a and div elements before the dt element don't work. I also don't see a closing dd tag, which creates more problems.
I'd suggest removing the empty a elements anyway, and just using ids for the dts.
If I knew much about creating patches, I'd do so now.
Comment #19
phiscock commentedI am also having this problem with version 6.x1.6 which is stopping my page from validating. I have analysed the code to help clarify the problem, but as a Drupal newbie I am not up to writing a patch yet.
The following code is generated on the glossary page:
As far as I can see there are three small errors:
There is an extra problem if you enable the Separate Letters option as it adds in an extra div e.g.
<div class="glossary-letter">d</div>before the dt element which is also not allowed.A solution would be greatly appreciated as due to the constraints on my current project if the module is not producing valid xhtml markup then I will not be able to use it, which would be a pain and a great pity when all the other aspects seem to be working fine.
Comment #20
BarisW commentedCheck out http://drupal.org/project/lexicon which comes with valid HTML and more sweetness!
Comment #21
jessebeach commented@harking re:#2
I'm attaching a small patch to address the missing closing tag for the
<dd>element. I didn't see that in your patch. Otherwise it looked good.Comment #22
daniel wentsch commented@jessebeach thanks, your patch reduced my validation errors from more than 40 to 19 on version 6.x-1.6.
The first patches (#1 and #2) can't be applied for 6.x-1.6, is there any chance those changes can be found in the dev versions?
Comment #23
nancydru