iabudiab / HTMLKit

An Objective-C framework for your everyday HTML needs.
MIT License
239 stars 27 forks source link

HTMLKit erroneous HTMLText serialization and entity decoding #16

Closed dsanghan closed 6 years ago

dsanghan commented 6 years ago

Let's say you have the following html:

<html>
  <body>
    <div> &lt;example&gt; </div>
  </body>
</html>

Then on:

HTMLDocument *doc = [HTMLDocument documentWithString:html];

and printing out the html via doc.rootElement.outerHTML you get partially decoded entities: <html><head></head><body> <div>&lt;example></div> </body></html> where &lt; is left as is, and &gt; is decoded.

Not sure what the correct thing to do here is.

iabudiab commented 6 years ago

@dsanghan Hey there! I'll take a look at this as soon as I get home. I'll keep you posted.

iabudiab commented 6 years ago

@dsanghan Hey again! It's a 🐛 But don't worry, I've already fixed it and a new version is being released. Thanks a lot for reporting this 👍

I've also revisited all the other serialization methods and guess what? HTMLElement suffers from the same bug.

I'll close this once the code is pushed and released.