W3C home > Mailing lists > Public > www-validator@w3.org > October 2012

Re: onselectstart attribute on <div> element

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 21 Oct 2012 00:27:15 +0300
Message-ID: <50831733.7090309@cs.tut.fi>
To: Dark Water <darkwater124@gmail.com>
CC: www-validator@w3.org
2012-10-18 16:55, Dark Water wrote:

> I checked one of my website's pages
> (http://www.novaember.com/servers/minecraft/) with the W3C Markup
> Validator. It said that attribute onselectstart isn't allowed on a <div>
> element. I think this is incorrect as it's a Javascript event and should
> be applicable to <div> elements.
> Am I correct?

The onselectstart attribute is not part of HTML5, which is the version 
of HTML you are effectively declaring - and other published versions of 
HTML have smaller sets of allowed event attributes (on...).

Note that the attribute, and the corresponding DOM property, is an IE 
invention and not necessarily supported by other browsers. For a 
discussion of ways to simulate it in other browsers, see e.g.
http://www.mindfiresolutions.com/Using-of-onselectstart-and-its-alternative-for-Firefox-239.php
http://stackoverflow.com/questions/1637298/imitate-onselectstart-return-false-using-css-or-other-non-js-approach

(The attribute is probably most often used in attempts at preventing 
copying of web page content with cut & paste. Though it does not 
effectively prevent anything (the user can always disable JavaScript), 
it tends to act as a signal: the content is not worth copying.)

Yucca
Received on Saturday, 20 October 2012 21:27:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 October 2012 21:28:00 GMT