Refactor `_validate_fieldset`.

It should now be much easier to add additional validations (asynchronous or
synchronous), or apply the new `repeat`/`length`/`range` validations to both the
script-directive and normal code paths just for uniformity.