By macunni on
I searched but did not see any postings on this issue. I hope I got the right forum.
I noticed when viewing the source of a web page that comments are generated with an empty anchor tag, like so:
...
</div>
<a id="comment-5"></a>
<div class="comment ">
...
This can also be seen by viewing the source of the Drupal pages with comments, such as these forums.
I ran across this line of code in the comments.module in function comment_render (around line 742) that appears to do this on purpose:
$output .= "<a id=\"comment\"></a>\n";
Does this blank anchor serve some purpose? Or is this a "bug" of some sort?
Comments
More than one line of code in comments.module doing this
It appears there's more than one line of code in comments.module that is producing empty anchor tags. The other is at line 744.
Mark
Yes, those are anchor tags
Those are anchor tags for navigating within the document. For example:
http://drupal.org/node/32205#comment-55999
... links directly to your comment.
Yes, they're anchors, but...
Yes, they're anchors, but not like you demonstrated. At least yours had something to click on that did something. The code being produced doesn't have anything in it to click on.
I would expect something to click on, like:
<a id="comment-5">Click Here</a>not,
<a id="comment-5"></a>which is what it is happening. Perhaps I should have worded the question differently; why is a link being generated with nothing to click on?
Mark