Closed (won't fix)
Project:
Drupal core
Version:
x.y.z
Component:
base system
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2006 at 06:46 UTC
Updated:
23 Jan 2006 at 19:34 UTC
Some modules, for whatever reason, may set a link as class="active" (in the $attributes argument). But function l() may append ' active' if the url path is equal to current. Here's the code from function l():
if ($path == $_GET['q']) {
if (isset($attributes['class'])) {
$attributes['class'] .= ' active';
}
else {
$attributes['class'] = 'active';
}
}
Here's a possible solution to illustrate what I mean:
if ($path == $_GET['q']) {
if (isset($attributes['class']) && $attributes['class'] != 'active') {
$attributes['class'] .= ' active';
}
else {
$attributes['class'] = 'active';
}
}
Comments
Comment #1
Zen commentedWon't it be better to fix the offending modules instead ?
Cheers :)
-K
Comment #2
varunvnair commentedDoes it really matter? I don't think giving a particular element the same class twice makes any difference. The relevant style will be applied just once.
Comment #3
Stefan Nagtegaal commentedWell, IMO it does make a difference.. We try to keep the code as clean as possible, and applying two of the same classes makes no sense..
Comment #4
markus_petrux commentedZen: In fact, I've seen this problem when testing the taxonomy context module (already branched for 4.7) and reported the issue here: http://drupal.org/node/45941
Still, I think Drupal core should always try to generate clean HTML. So I opened this issue here as well.
Comment #5
chx commentedThis is not the first time asking for cluttering Drupal with fix up code for broken contrib. No.