Quantcast

Conformance of documents using IDL attributes outside the spec

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Conformance of documents using IDL attributes outside the spec

Jukka K. Korpela-2
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/


Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Conformance of documents using IDL attributes outside the spec

Philip Taylor (Webmaster, Ret'd)
Ignoring the HTML 5 aspects of this question (about which
I know too little to comment meaningfully), on what basis
do you believe that including :


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

in an otherwise-valid HTML document could render it non-
conformant, and similarly on what grounds do you believe
that

> user agents that handle
> onpaste as an event handler [might be] nonconforming

?

Unless I am misunderstanding the whole concept of conformance,
it refers (in this context) to the HTML of which the page is
composed; modifications to the DOM do not affect that HTML,
and therefore a page that was conformant before the script
ran would still be conformant afterwards, would it not ?

Philip Taylor

Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Conformance of documents using IDL attributes outside the spec

Jukka K. Korpela
2013-11-08 15:48, Philip Taylor wrote:

> Unless I am misunderstanding the whole concept of conformance,
> it refers (in this context) to the HTML of which the page is
> composed; modifications to the DOM do not affect that HTML,
> and therefore a page that was conformant before the script
> ran would still be conformant afterwards, would it not ?

My understanding is just the opposite: conformance is defined for
documents, not just for serializations. For example, a document that
inserts, with JavaScript, a title element inside a body element is just
as nonconforming as one with the markup <body><title>foo</title></body>.

Regarding my example that assigns an onpaste event handler, the question
really is whether it counts as an attribute. HTML5 terminology is
somewhat confusing, but presumably "attribute" means both content
attributes and IDL attributes in the requirement

"Authors must not use elements, attributes, or attribute values that are
not permitted by this specification or other applicable specifications"

at 3.2.1 Semantics (http://www.w3.org/TR/html5/dom.html#semantics-0), a
somewhat odd place for a requirement that is (mostly) syntactic.

But does document.body.onpaste mean using an IDL attribute? What
distinguishes this from a simple property assignment?

Yucca


Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Conformance of documents using IDL attributes outside the spec

Philip Taylor (Webmaster, Ret'd)


Jukka K. Korpela wrote:

> My understanding is just the opposite: conformance is defined for
> documents, not just for serializations. For example, a document that
> inserts, with JavaScript, a title element inside a body element is just
> as nonconforming as one with the markup <body><title>foo</title></body>.

Hmm, well, I don't want to derail what is clearly an important question
(otherwise you would not have asked it) with philosophical issues, but
it does seem to me that conformance needs to be a static concept rather
than a dynamic one, otherwise a document that performs a non-conformant
modification of the DOM IFF the date is (or was) 01-01-2000 would
have to be defined to be /conditionally/ conformant (and the same if the
trigger for the non-conformant DOM modification were to find the mouse
at a particular pair of co-ordinates but no other, and so on).

Anyhow, to try to keep the thread on-track, can you refer me to
a W3C (or similar) document that defines conformance in the terms
to which you believe it to refer, rather than one that defines it
in terms of a static serialisation (preferably not an HTML5-related
document, for reasons you fully understand and which we need not go
into here) ?

If you /are/ correct in your hypothesis (which you usually are),
I hold out little hope for there ever being a W3C conformance checker
that will check pages for dynamic conformance under all possible
conditions.

Philip Taylor

Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Conformance of documents using IDL attributes outside the spec

Ernest Cline
In reply to this post by Jukka K. Korpela-2

On first reflection, it seems to me than the issue of nonconformity would lie not with the document, but with any implementation which treated onpaste as an event handler in an HTML5 document.

As for the contract question, I'm not a lawyer, but it likely depends on the language of the contract.  If it merely states that the work must be a conforming HTML5 document, then it would be, but if it states that the work must do certain tasks in any conforming HTML5 implementation, then it doesn't meet that standard.


-----Original Message-----

>From: "Jukka K. Korpela" <[hidden email]>
>Sent: Nov 8, 2013 8:27 AM
>To: [hidden email]
>Subject: 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/
>
>

Loading...