From 38a84d5855ee05c11761fea46e135c3a244f69df Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Wed, 2 Oct 2024 10:10:07 +0200 Subject: [PATCH] Update list of booleanAttributes based on HTML specs --- src/Sutil/DomHelpers.fs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Sutil/DomHelpers.fs b/src/Sutil/DomHelpers.fs index 36d6cff..6c05df5 100644 --- a/src/Sutil/DomHelpers.fs +++ b/src/Sutil/DomHelpers.fs @@ -407,11 +407,32 @@ module ClassHelpers = let internal nullToEmpty s = if isNull s then "" else s let private booleanAttributes = - [ "hidden" + // List based on HTML Standard specs (without ReadOnly attributes from ShadowRoot) + // https://html.spec.whatwg.org/multipage/indices.html#attributes-3 + [ "allowfullscreen" + "async" + "autofocus" + "autoplay" + "checked" + "controls" + "default" + "defer" "disabled" + "formnovalidate" + "inert" + "ismap" + "itemscope" + "loop" + "multiple" + "muted" + "nomodule" + "novalidate" + "open" + "playsinline" "readonly" "required" - "checked" ] |> Set + "reversed" + "selected" ] |> Set let private isBooleanAttribute (name : string) = booleanAttributes.Contains (name.ToLower())