Skip to content

Commit

Permalink
Merge pull request #95 from MangelMaxime/patch-1
Browse files Browse the repository at this point in the history
Update list of booleanAttributes based on HTML specs
  • Loading branch information
davedawkins authored Oct 9, 2024
2 parents 3762155 + 38a84d5 commit 73eb78e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Sutil/DomHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 73eb78e

Please sign in to comment.