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

[Bug Report] mango.attribute does not work correctly with certain strings. #320

Closed
Elastic1 opened this issue Jul 16, 2022 · 2 comments · Fixed by #321 or #322
Closed

[Bug Report] mango.attribute does not work correctly with certain strings. #320

Elastic1 opened this issue Jul 16, 2022 · 2 comments · Fixed by #321 or #322
Labels
bug Something isn't working

Comments

@Elastic1
Copy link

Describe the bug
mango.attribute does not work correctly with certain strings.

To Reproduce

var html = '<img src="data:image/svg+xml,<svg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 1 1 \'></svg>" data-src="https://example.com/1.jpg" class="size-full wp-image-105 aligncenter lazy image-vertical" alt="">'
var src = mango.attribute(html, 'data-src') // null (expected: https://example.com/1.jpg)

In my plugin, I currently deal with this by removing the src="..."
Environment (please complete the following information):

  • OS: CentOS Stream release 8
  • Browser: chrome
  • Mango Version: 0.6.2
@Elastic1 Elastic1 added the bug Something isn't working label Jul 16, 2022
@hkalexling
Copy link
Member

Thanks for the bug report! mango.attribute uses an XML parser and it doesn't like the < and > characters in attribute values. I will replace it with a proper HTML parser and it should resolve the issue.

@mango-assistant
Copy link

Hi there! The issue has been fixed in v0.27.0. Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants