If any of you have visited SimpleBits (the personal site of Dan Cederholm), you’ll probably be aware of their great SimpleQuiz series of discussion-provoking questions that are mostly about semantics. While I’m not a huge semantic nut (though I think semantics are useful, but at times impractical), one quiz caught my attention over the summer, and I’ve still been thinking about its topics for a while.
That quiz would be SimpleQuiz XVI: Launching Windows. It proposes the question of what is the correct way to launch a new window for a hyperlink when it is clicked on. Since XHTML 1.0 Strict and XHTML 1.1 (without the proper module) do not allow the
target attribute, this is a problem when it comes to validation. (HTML 4 Strict does also not allow the
target attribute.) A limited set of solutions is intially proposed, but the comments quickly provoke more questions, such as: Should a website even be able to specify a new window for a link, to the chagrin of some users?
Many users felt that the answer to this such question should be a resounding “No”, as many people seem to be annoyed when the default behaviour of a clicked link is something else than they expect. This is understandable, as most of the people who are responding are undoubtedly “power users” who have plenty of Internet browsing experience and well-defined habits. However, many people are not like that and that nonwithstanding, I still think there are legitimate uses for launching a new window, for example, from a page that has been POST’d to, and as such, the web developer might not want the user to leave the page, which could perhaps expire the data.
Also, using the
target attribute despite the fact that the attribute is not specified in those aforementioned DOCTYPEs is not an acceptable solution for those who take their validation seriously. That leaves the option open to using XHTML 1.0 Transitional, which I don’t believe is a problem, but many people will gawk at this suggestion as well.
_blank. Though, some people will again go back to the first question, and say that you shouldn’t have any links open in a new window by default, and then back up this claim by saying that the “semanticness” is suspect.
But a bigger question that was raised in my mind was regarding the initial topic of separation of behaviour and style. In the current version of CSS, this may not be fully encouraged, in my opinion. The small example I have is of the
:hover pseudo-class used as a selector. As many of you know, it allows the style of elements that recieve an “onmouseover” event to be specified. But, should any style changes be implemented this way, since it explicitly uses CSS to define a behavioural aspect, that is, what happens when the mouse pointer hovers over an element? Don’t get me wrong – I’m not trying to preach to everyone, as I’ve always uses the
But, then again, using the
target attribute is also easier. Right now, I’m sort of confused – both appear to violate the separation of either behaviour and content or behaviour and presentation yet one is apparently condoned on the whole.