DocumentAS.continuousValidityChecking in DOM Level 3 ASLS

Throwing an exception either before or after document becomes invalid in a continuous checking mode seems problematic.  Trying to predict that a change would invalid an object would be difficult if there were unique or key/keyref constraints, then those constraints must look ahead to the tree to come.  Throwing an exception afterwards and leaving the tree in an invalid state isn't good either.

Throwing exceptions would also mean that only code that was specifically written to keep the tree always in compliance could be called once anyone had turned on continuous checking.  So if you had existing code that, for example, added required attributes after adding an element to the document temporarily making the document invalid, that code could not be called.

It seems that using events to notify on the transitions would be preferrable.  The event notifying that the document has become invalid could contain a reference to a DOMMutationEvent responsible for making the document invalid.  Code that made the document transitorily invalid could still be used, it would generate annoying events instead of breaking behaviors.

Received on Thursday, 7 June 2001 23:07:54 UTC