Hello there,
This is a very minor report, and mainly just an FYI post than a question, but when I implement the table of contents on my site, my Mozilla Addon catches an HTML warning on this line:
<div class="toc-title">Contents<span class="toc-toggle-message"> </span></div>
The issue that it has is that there is no content between the span tags. While poking through the code to find a potential fix, I found these lines in tableofcontents.pages.inc:
function theme_tableofcontents_toc($toc) {
// TODO: at this time, the hideshow works with all TOCs at once
if ($toc->hideshow) {
//$hs = '<span class="toc-toggle-message"> [<a href="#" class="toc-toggle">' . $label . '</a>]</span>';
$hs = '<span class="toc-toggle-message"> </span>';
$js = '<script type="text/javascript">toc_collapse=' . ($toc->collapsed ? 1 : 0) . ';</script>';
}
If you take a look at the $hs variables, there are two lines of code; one commented, one not. If I uncomment the currently commented one, and then comment the other - my HTML warning disappears, mainly because there is now content between the span tags.
So I guess there is a small question in here: is there a reason why there are two listed $hs tags? Does it have something to do with the TODO comment above the code? Am I okay with fixing this error by switching around which line is commented?
Thanks,
Emily
Comments
Comment #1
AlexisWilke commentedHi Emily,
I did not notice an error with SeaMonkey in that regard. I don't see why an empty tag would generate an error anyway...
The tag is used by the script to hide/show ($hs) the hide/show toggle link. I make it hidden by default now. The Javascript will show it. The idea is actually that if JavaScript is turned off, then there is no point in showing a link that won't work (and you as the website provider, you cannot know whether someone will have their JavaScript turn on or off...) So that's a feature. It would be interesting to know whether there is a way to get rid of the warning. Maybe by adding a character?
The commented out line was mainly for reference. The TODO is in regard to having a separate hide/show toggle for each individual TOC. But I don't think too many people include more than one TOC on the screen.
Thank you.
Alexis
Comment #2
EmJay7 commentedAlexis,
Thank you for your input. By adding a
character between the tags, it did take away the warning. Like I said, it was a very minor thing, but thanks again anyways!All the best,
Emily
Comment #3
AlexisWilke commentedEmily,
It's checked in. Thank you for the report.
Alexis