[whatwg] Update to the Adoption Agency Algorithm

Bjoern Hoehrmann derhoermi at gmx.net
Sat Feb 4 01:01:58 PST 2006


* Ian Hickson wrote:
>> Well, if you approach the problem by asking whether it's possible that 
>> things become non-compliant, you'll either have to analyze any and all 
>> dependencies like server-side scripts and workflows or you'd generate 
>> false negatives, since adding some external data to the document is very 
>> likely to generate errors if the external data is non-compliant. The 
>> right approach here is to extend implementations to perform validation, 
>> e.g. after each mutation event.
>
>That still wouldn't work. Take this document:

Yes, as we both point out, you can only approximate a result.


>        if (Math.random() > 0.5)
>          document.write('<div>');
>        else
>          document.write('<\/div>');

>Is it conformant?

Well, as I understand your suggestion you have

  for all possible states s for document d
    if s is an invalid state
      generate error

While I have

  for some possible states s for document d
    if s is an invalid state
      generate error

The most sophisticated implementation of your approach would end up
saying things like

  The document is invalid if and only if the user manages to click
  on 500 rects placed at random positions within two seconds provided
  that some remote resource as specified by the user had a Last-
  Modified header set to some date in 2036. Beware the robots.

If you combine my approach with code coverage analysis you'll probably
end up after some testing with the result that you could not generate
an invalid state but there are unexercised code paths. I'm just saying
that my approach is easier to implement and more relevant to developers
looking for advise how to improve their code.

If the concern here is what the specification should say, then that's
what a valid state is, not what a valid document is, since the class
of "predictably valid" documents does not cover many dynamic documents.
-- 
Björn Höhrmann · mailto:bjoern at hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 



More information about the whatwg mailing list