New compilation technique, possible minor breaking changes, performance summary
🫳 Dropped BS4 (BeautifulSoup4) for HTML parsing in the compilation step.
This was due to:
- Increasing number of patches to control BS4's parsing and validating of the HTML
- Inability to support some planned features of cotton, without some extensive patching of BS4 base classes, specifically for now [supporting quoteless attributes](https://github.com/wrabit/django-cotton/discussions/141)
⚠️ Minor changes:
- Attribute casing is now preserved. `<div SomeAttribute="1">` would have previously been lowercased.
- Whitespace behaviour is now more in-line with your template, this should not affect the view, but may affect things like tests if you have any changing HTML
- Whitespacing around attributes in some of the tags have changed which again may affect tests
🏎️ Performance summary
A fix for a [recent issue](165) allowed us to improve performance and we're now on par with (and sometimes outperforming) Django for the render load tests. (scope of tests have room for improving)
Running benchmarks with 5 runs, 5000 iterations each
---
Native Django {% for %} loop: 38.59 ms
Cotton equivalent: 28.34 ms
---
Native {% include %}: 28.64 ms
Cotton equivalent: 28.98 ms
---
Native {% block %} and {% extends %}: 90.44 ms
Cotton equivalent: 103.65 ms
**Full Changelog**: https://github.com/wrabit/django-cotton/compare/v1.0.12...v1.1.0