Filter partial results based on resultTypes
Axe-core's resultTypes run option can tell axe not to return pass and incomplete. Doing so improve's axe-core's performance a bit. Generating selectors for elements is quite a slow operation. So if axe doesn't need selectors for pass and incomplete results, this saves up some time.
Axe-core generates selectors for elements in three places:
- in axe.run, as part of the reporter
- when partial results get sent to the parent frame
- at the end of runPartial
Currently, resultTypes is only used in the reporter (1). This means selectors get generated for nodes that may get filtered by the reporter at a later stage. It also means lots of passes are returned by runPartial, and frameMessenger that later get ignored. This results in a lot of unnecessary data getting sent between frames too.
This can be improved by having Audit.run filter its results before passing them back, either to the parent frame or to runPartial. This will have to consider which checks have after methods on them. Passes on checks with after methods can be changed to fails later. But this is a relatively small subset of checks.
Bonus points
If incomplete is turned off by resultTypes then I think all reviewOnFail rules should be disabled. There's no reason to run those if incomplete results are just going to get filtered.
If incomplete is turned off by resultTypes then I think all reviewOnFail rules should be disabled. There's no reason to run those if incomplete results are just going to get filtered.
I'm not sure we can get away with this. It would be a breaking change to how resultTypes works - it doesn't completely omit the unspecified types, it just limits the results such that at most one node of the unspecified types are returned.
Fair point! I forgot about that.
A related point here. Even for nodes that are used in the end result, on checks without after methods we don't need to pass nodeIndexes across frame boundaries. Nor ancestry / xpath if those are turned off. There is a bunch of filtering that can be done even on default configuration.