Skip to content

Commit d18b961

Browse files
forkialfonsogarciacaro
authored andcommitted
use chars
1 parent 00b451a commit d18b961

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/Fable.React/Fable.Helpers.ReactServer.fs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ let inline private addUnit (html:StringBuilder) (key: string) (value: string) =
3939

4040
let private cssProp (html:StringBuilder) (key: string) (value: obj) =
4141
html.Append key |> ignore
42-
html.Append ":" |> ignore
42+
html.Append ':' |> ignore
4343

4444
match value with
4545
| :? int as v -> addUnit html key (string v)
4646
| :? float as v -> addUnit html key (string v)
4747
| _ -> html.Append value |> ignore
4848

49-
html.Append ";" |> ignore
49+
html.Append ';' |> ignore
5050

5151
let private slugRegex = Regex("([A-Z])", RegexOptions.Compiled)
5252
let inline private slugKey key =
@@ -467,7 +467,7 @@ let inline strAttr (html:StringBuilder) (key: string) (value: string) =
467467
html.Append key |> ignore
468468
html.Append "=\"" |> ignore
469469
escapeHtml html value
470-
html.Append "\"" |> ignore
470+
html.Append '"' |> ignore
471471

472472
let inline objAttr (html:StringBuilder) (key: string) (value: obj) = strAttr html key (string value)
473473

@@ -623,7 +623,7 @@ let private renderHtmlAttr (html:StringBuilder) (attr: HTMLAttr) =
623623
for cssProp in cssList do
624624
renderCssProp html cssProp
625625

626-
html.Append "\"" |> ignore
626+
html.Append '"' |> ignore
627627

628628
| HTMLAttr.Custom (key, value) -> strAttr html (key.ToLower()) (string value)
629629
| Data (key, value) -> strAttr html ("data-" + key) (string value)
@@ -723,40 +723,39 @@ let rec private addReactMark htmlNode =
723723
| h -> h
724724

725725
let inline private castHTMLNode (htmlNode: ReactElement): HTMLNode =
726-
if isNull htmlNode
727-
then HTMLNode.Empty
728-
else htmlNode :?> HTMLNode
726+
if isNull htmlNode then
727+
HTMLNode.Empty
728+
else
729+
htmlNode :?> HTMLNode
729730

730731
let renderToString (htmlNode: ReactElement): string =
731732
let htmlNode = addReactMark (castHTMLNode htmlNode)
732733
let html = StringBuilder()
733-
let inline append (text:string) =
734-
html.Append(text) |> ignore
735734

736735
let rec render (htmlNode: HTMLNode) : unit =
737736
match htmlNode with
738737
| HTMLNode.Text str -> escapeHtml html str
739-
| HTMLNode.RawText str -> append str
738+
| HTMLNode.RawText str -> html.Append str |> ignore
740739
| HTMLNode.Node (tag, attrs, children) ->
741-
append "<"
742-
append tag
740+
html.Append '<' |> ignore
741+
html.Append tag |> ignore
743742

744743
let child = renderAttrs html attrs tag
745744

746745
if voidTags.Contains tag then
747-
append "/>"
746+
html.Append "/>" |> ignore
748747
else
749-
append ">"
748+
html.Append '>' |> ignore
750749

751750
match child with
752-
| Some c -> append c
751+
| Some c -> html.Append c |> ignore
753752
| None ->
754753
for child in children do
755754
render (castHTMLNode child)
756755

757-
append "</"
758-
append tag
759-
append ">"
756+
html.Append "</" |> ignore
757+
html.Append tag |> ignore
758+
html.Append '>' |> ignore
760759
| HTMLNode.List nodes ->
761760
for node in nodes do
762761
render (castHTMLNode node)

0 commit comments

Comments
 (0)