What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

A userscript I've been working on enhances the Related Tags and similar "modules" in the Stack Exchange sidebar on the right side of each page.

When I noticed it wasn't modifying the Related Tags on a "tag info" page I investigated and found that though I was looking for the correct ID for that module, that the same ID was incorrectly used for the Stats module on the same page.

Naturally this means document.getElementById() and any jQuery which calls it will only get the first element with this ID, which in my case is the wrong one.

The Stats module should have some unique ID such as h-stats etc.

Here's the relevant HTML for each module with the IDs pointed out in HTML comments:

Stats module HTML:

<div class="module">
    <h4 id="h-related-tags">Stats</h4>
    <!--   ^^^^^^^^^^^^^^^         --> 
    <table id="qinfo">
        <tbody><tr>
            <td><p class="label-key">created</p></td>
            <td style="padding-left:10px"><p class="label-key" title="2012-08-01 09:38:15Z"><b>3 months ago</b></p></td>
        </tr>
        <tr>
            <td><p class="label-key">viewed</p></td>

            <td style="padding-left:10px"><p class="label-key"><b>4 times</b></p></td>
        </tr>
        <tr>
            <td><p class="label-key">active</p></td>
            <td style="padding-left:10px"><p class="label-key"><b>3 months ago</b></p></td>
        </tr>
        <tr>
            <td><p class="label-key">editors</p></td>
            <td style="padding-left:10px"><p class="label-key"><b>1</b></p></td>
        </tr>
    </tbody></table>

</div>

Related Tags module HTML:

<div class="module">

<h4 id="h-related-tags">Related Tags</h4>
<!--    ^^^^^^^^^^^^^^                -->
            <a href="/tags/puppet/info" class="post-tag" title="" rel="tag">puppet</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">3</span></span><br>
            <a href="/tags/ruby/info" class="post-tag" title="" rel="tag">ruby</a>&nbsp;<br>
            <a href="/tags/gem/info" class="post-tag" title="" rel="tag">gem</a>&nbsp;<br>
            <a href="/tags/configuration/info" class="post-tag" title="" rel="tag">configuration</a>&nbsp;<br>
            <a href="/tags/regex/info" class="post-tag" title="tag wiki for 'regex'" rel="tag">regex</a>&nbsp;<br>


<br>
<br>
</div>
share|improve this question
1  
I was going to close as off topic thinking it's programming question, then after second read realized the real meaning. Hopefully adding the userscript tag will help others to avoid falling into the same trap. :) –  Shadow Wizard Nov 5 '12 at 9:09
    
Feel free to retag as you think is best, I don't know the ropes here on meta as well as on my usual sites. –  hippietrail Nov 5 '12 at 9:09
2  
Already done before posting the comment. You seem to be just fine with the ropes here! :-) –  Shadow Wizard Nov 5 '12 at 9:12

1 Answer 1

up vote 4 down vote accepted

Apparently that used to be there for a reason (a bad CSS-y reason, but a reason), but it's completely pointless now.

It will be fixed in the next build.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .