开发者

Twitters strange choice of markup

Viewing the Twitter source and i came across this. Strange to see an 'a' element without a href attribute. When the user clicks the link, all that happens is a pop up appears, it doesn't go to a different page, a la normal hyperlinks. Are they gaining any semantic kudos by using an 'a' element without a href or is this very very bad markup? Why would they not just use the span with an id?

<a id="new-tweet" original-title="New Tweet">
      开发者_JAVA技巧<span>New Tweet</span>
</a>


An anchor is giving them the click appearance without having to style it in (e.g. cursor: pointer; cursor: hand;). It also allows them to make a more uniform feel across the page, instead of styling the "normal links" and ajax links separately.

A's can be used without a href attribute (they used to be used to reference sections of a page (combined with the name attribute, then link.html#name) before IDs started being the more definitive way to reference portions of a page).

I would say they're just keeping it "slim and trim".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜