Conformance of documents using IDL attributes outside the spec

A document using an attribute like onpaste=... is of course 
nonconforming, and HTML5 validators reject it. What if a document 
assigns an onpaste event handler to an element purely in JavaScript? 
Example:

<script>
document.body.onpaste = function () { alert('No paste!'); return false }
</script>

I suppose the answer is that it, too, is nonconforming, but on what 
grounds? Is there an explicit statement that one could refer to, say, in 
court, if a contract says that pages must conform to HTML5?

Or is it so that the document is conforming, but user agents that handle 
onpaste as an event handler are nonconforming?

As such, the statement simply assigns a property to an object (though in 
practice, it is based on the assumption that a paste event may get fired 
in some browsers at least so that it gets handled by this handler). So 
if it is nonconforming, would document.body.foobar = 42 also make a 
document nonconforming?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Received on Friday, 8 November 2013 13:27:52 UTC