From 01be293188f4ca4aadcc6f6488e920d74c2ef0af Mon Sep 17 00:00:00 2001 From: nkalvi Date: Fri, 24 Feb 2023 05:34:52 -0800 Subject: [PATCH 1/6] Add support for wrapping description list elements inside div. The proposed solution is a workaround the current requirement for ElementDefinition. --- Sources/Plot/API/HTMLElements.swift | 11 ++++++ Tests/PlotTests/HTMLTests.swift | 53 +++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/Sources/Plot/API/HTMLElements.swift b/Sources/Plot/API/HTMLElements.swift index 9b5a6b2..2857485 100644 --- a/Sources/Plot/API/HTMLElements.swift +++ b/Sources/Plot/API/HTMLElements.swift @@ -426,6 +426,17 @@ public extension Node where Context == HTML.DescriptionListContext { } } +public extension Node where Context == HTML.DescriptionListContext { + /// The `
` element wraps a group, that is part of a term-description group in a description list (`
` element). + /// + /// This is allowed according to the HTML spec: // https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element + /// + /// - parameter nodes: The element's attributes and child elements (`
` or `
` elements). + static func dlDiv(_ nodes: Node...) -> Node { + .element(named: "div", nodes: nodes) + } +} + public extension Node where Context: HTMLOptionListContext { /// Add an `