Skip to content
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

Empty data attributes are stripped #215

Closed
ryanb opened this issue Aug 10, 2021 · 5 comments · Fixed by #216
Closed

Empty data attributes are stripped #215

ryanb opened this issue Aug 10, 2021 · 5 comments · Fixed by #216

Comments

@ryanb
Copy link

ryanb commented Aug 10, 2021

Is there a reason why empty data attributes are stripped?

Loofah.fragment('<div data-foo></div>').scrub!(:prune).to_s
 #=> "<div></div>"
Loofah.fragment('<div data-foo="bar"></div>').scrub!(:prune).to_s
 #=> "<div data-foo=\"bar\"></div>"

From what I can tell, empty data attributes are valid in HTML 5.

@flavorjones
Copy link
Owner

Hi @ryanb, thanks for reporting this. I agree, empty data-* attributes are valid and I think this behavior is just an oversight. Support for data-* attributes was added in #59 and expanded in #84 but at no point were empty attributes tested.

I think I can get to this in the next day or two, hang tight!

@flavorjones
Copy link
Owner

flavorjones commented Aug 11, 2021

PR is #216 going through CI now. If it goes green, I'll ship it in v2.12.0 shortly thereafter.

@flavorjones
Copy link
Owner

v2.12.0 has been released with a fix: Release 2.12.0 / 2021-08-11 · flavorjones/loofah

@ryanb
Copy link
Author

ryanb commented Aug 11, 2021

Wow thanks for the fast turnaround! I really appreciate the work you put into loofah.

@flavorjones
Copy link
Owner

Ah, thanks for the kind words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants