diff --git a/jael/CHANGELOG.md b/jael/CHANGELOG.md index b740aa63..fcb450c2 100644 --- a/jael/CHANGELOG.md +++ b/jael/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.0 +* Fixed handling of `if` in non-strict mode. +* + # 2.0.1 * Fixed bug where the `textarea` name check would never return `true`. diff --git a/jael/lib/src/renderer.dart b/jael/lib/src/renderer.dart index 82675562..06b013a6 100644 --- a/jael/lib/src/renderer.dart +++ b/jael/lib/src/renderer.dart @@ -211,12 +211,14 @@ class Renderer { Element element, CodeBuffer buffer, SymbolTable scope, bool html5) { var attribute = element.attributes.singleWhere((a) => a.name == 'if'); - var v = attribute.value.compute(scope) as bool; + var vv = attribute.value.compute(scope); if (scope.resolve('!strict!')?.value == false) { - v = v == true; + vv = vv == true; } + var v = vv as bool; + if (!v) return; var otherAttributes = element.attributes.where((a) => a.name != 'if');