isValid(_:)
Determines if the input document is valid, against the whitelist. It is considered valid if all the tags and attributes in the input HTML are allowed by the whitelist.
func isValid(_ dirtyDocument: Document) throws -> Bool
Parameters
- dirtyDocument
document to test
Returns
true if no tags or attributes need to be removed; false if they do
This method can be used as a validator for user input forms. An invalid document will still be cleaned successfully using the clean(_:)
document. If using as a validator, it is recommended to still clean the document to ensure enforced attributes are set correctly, and that the output is tidied.