parent.numInvalidElements was not updated if  element was removed from it's parent from VALIDATED event handler. That lead to infinite document.queueValidation() call.
In particular it was the case when the element had a pattern fill. SVGPattern is attached and then detached in patternValidated function.
Merge branch 'validationbug' into patternbug