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

Fix error in parsing incorrectly declared attributes. #17

Merged
merged 1 commit into from
Jun 13, 2017

Conversation

josteink
Copy link
Contributor

@josteink josteink commented Jun 13, 2017

When parsing incorrectly declared attributes, HtmlAgilityPack currently omits one character from the attribute-name.

Consider the following example:

<html>
   <body>
    <img src='http://boo'/onerror='moo'>
  </body>
</html>

When parsed this will result in two attributes for the img node:

  • src
  • nerror (note missing leading o)

Expected outcome should be:

  • src
  • onerror

This patch fixes the output to match what you would expect (and how browser handle similarly formatted data). This closes #16.

Note: In lack of a test-suite for this project, I cannot reliably tell if I've broken other expected behaviour in the process.

Are there any recommended test-procedures I should follow, or is this good as is?

@JonathanMagnan JonathanMagnan self-assigned this Jun 13, 2017
@JonathanMagnan
Copy link
Member

JonathanMagnan commented Jun 13, 2017

Hello @josteink ,

Thank you for this pull request, I will try to review & merge it today or tomorrow.

There are no test-procedures to follow currently. I'm normally a big fan of unit test (by example, Entity Framework Extensions has over 10k unit tests!) however this library lack of it. Probably during the summer, we will choose if we re-write a v2.x for this library and create unit test on this version or add unit test on the v1.x

Best Regards,

Jonathan

@josteink
Copy link
Contributor Author

Awesome. Thanks!

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

Successfully merging this pull request may close these issues.

When an attribute is immediately preceded by "/", first character is cut off from the attribute's name
2 participants