-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow optional elements to skip sanitisation #203
Allow optional elements to skip sanitisation #203
Conversation
e9bf230
to
5e514e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🍏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff Ed, a few comments that I hopefully get in before you merge.
test "it can exclude stipulated elements from sanitization" do | ||
document = Govspeak::Document.new("<uncommon-element>some content</uncommon-element>", relaxed_sanitization_elements: %w[uncommon-element]) | ||
assert_equal "<uncommon-element>some content</uncommon-element>", document.to_html.strip | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 👍
5e514e4
to
7b497c0
Compare
This change allows an optional array of `allowed_elements` to be passed to a new Document, and these will be excluded from HTML sanitization.
7b497c0
to
03e9d88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 👍🏻
This change allows an optional array of
relaxed_sanitization_elements
to be passed to a new Document, and these will be excluded from HTML sanitization.There is a use-case where Whitehall is submitting a
<details>
element which is being stripped by sanitization.Trello