Re: onselectstart attribute on <div> element

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 UTC