From 72ade95c27b060e928486bd4a82980c53715dc9f Mon Sep 17 00:00:00 2001 From: Andrew Seier Date: Sat, 23 Nov 2024 18:35:28 -0800 Subject: [PATCH] =?UTF-8?q?Introduce=20=E2=80=9CUnforgivingHtml=E2=80=9D?= =?UTF-8?q?=20parser.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Goals of the parser: * Tighten control over things like double-quotes & closing tags. * Improve error messaging for malformed markup. * Improve performance. Closes #239. --- CHANGELOG.md | 32 + test/forgiving.js | 275 ++++++ test/test-template-engine.js | 743 +++++++++------- ts/x-template.d.ts | 9 - ts/x-template.d.ts.map | 2 +- tsconfig.json | 2 +- x-template.js | 1545 +++++++++++++++++++++++++++------- 7 files changed, 2010 insertions(+), 598 deletions(-) create mode 100644 test/forgiving.js diff --git a/CHANGELOG.md b/CHANGELOG.md index c5bceee..b86aee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- The current “forgiving” html parser is replaced for a more “unforgiving” html + parser in the default template engine. This is stricter in terms of what + elements are allowed, the formatting of the html, the lower-casing of names, + and the usage of spaces and newlines (#239). + +### Deprecated + +- The `` element and the `svg` tagged template function are deprecated and + will be removed in future versions. The spec and conventions for `svg` + differ a lot from `html` and a faster / more-maintainable parser can be built + if we stop supporting this (#236). +- The `