HtmlNode.ToString(): fix self-closing tags on empty non-void elements#1413
HtmlNode.ToString(): fix self-closing tags on empty non-void elements#1413cartermp merged 1 commit intofsprojects:mainfrom
Conversation
|
Hey 👋 Noticed that ToString'd script elements aren't getting their closing tag and that broke some HTML I glued together. This fixes it according to the spec. I wasn't sure where to put |
|
Also isVoidElement is a duplicate, just noticed while trying to fix another issue. (Dropped white space in text nodes) https://github.com/fsprojects/FSharp.Data/blob/5a5f3e0/src/Html/HtmlParser.fs#L774 Private helper module at the start of the file? |
6bf7e59 to
d8b7e9a
Compare
|
Added tests |
|
Looks like |
|
Oh right I fixed that locally and probably forgot to push again, will do once I'm at my desk again. Sorry, it's late 😅 |
d8b7e9a to
bbf31f6
Compare
cartermp
left a comment
There was a problem hiding this comment.
Approved with these changes and pending green CI
| result |> should equal """<textarea cols="40" rows="2"></textarea>""" | ||
|
|
||
| [<Test>] | ||
| let ``Renderes self-closing tag for void elements``() = |
There was a problem hiding this comment.
| let ``Renderes self-closing tag for void elements``() = | |
| let ``Renders self-closing tag for void elements``() = |
| html |> should equal $"<%s{name} />") | ||
|
|
||
| [<Test>] | ||
| let ``Renderes no self-closing tag for non-void elements``() = |
There was a problem hiding this comment.
| let ``Renderes no self-closing tag for non-void elements``() = | |
| let ``Renders no self-closing tag for non-void elements``() = |
Quoting from https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#void-element > The following is a complete list of the void elements in HTML: > area, base, br, col, command, embed, hr, img, input, keygen, link, > meta, param, source, track, wbr [...] > Void elements only have a start tag; end tags must not be specified > for void elements. > A non-void element must have an end tag, unless the subsection for > that element in the HTML elements section of this reference indicates > that its end tag can be omitted.
bbf31f6 to
a3434dd
Compare
|
Sorry for the late response, typos are fixed now. |
|
Thank you! |
Quoting from
https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#void-element
[...]