diff --git a/Sources/Plot/API/HTML.swift b/Sources/Plot/API/HTML.swift
index b4df976..7f54f10 100644
--- a/Sources/Plot/API/HTML.swift
+++ b/Sources/Plot/API/HTML.swift
@@ -122,6 +122,8 @@ public extension HTML {
enum ListContext: HTMLStylableContext {}
/// The context within an HTML ` ` element.
enum MetaContext: HTMLNamableContext {}
+ /// The contect within an HTML `` element.
+ enum ObjectContext: HTMLDimensionContext, HTMLTypeContext {}
/// The context within an HTML `` element.
enum OptionContext: HTMLValueContext {}
/// The context within an HTML `` element.
diff --git a/Sources/Plot/API/HTMLAttributes.swift b/Sources/Plot/API/HTMLAttributes.swift
index f16cc8b..a7d3f52 100644
--- a/Sources/Plot/API/HTMLAttributes.swift
+++ b/Sources/Plot/API/HTMLAttributes.swift
@@ -239,6 +239,22 @@ public extension Node where Context: HTMLMediaContext {
}
}
+public extension Attribute where Context == HTML.ObjectContext {
+ /// Assign an external resource to the element, using its `data` attribute.
+ /// - parameter url: The data URL to assign.
+ static func data(_ url: URLRepresentable) -> Attribute {
+ Attribute(name: "data", value: url.string)
+ }
+}
+
+public extension Node where Context == HTML.ObjectContext {
+ /// Assign an external resource to the element, using its `data` attribute.
+ /// - parameter url: The data URL to assign.
+ static func data(_ url: URLRepresentable) -> Node {
+ .attribute(named: "data", value: url.string)
+ }
+}
+
public extension Attribute where Context == HTML.AudioSourceContext {
/// Assign a type to this audio source. See `HTMLAudioFormat` for more info.
/// - parameter format: The audio format to assign.
diff --git a/Sources/Plot/API/HTMLElements.swift b/Sources/Plot/API/HTMLElements.swift
index 9b5a6b2..315b84c 100644
--- a/Sources/Plot/API/HTMLElements.swift
+++ b/Sources/Plot/API/HTMLElements.swift
@@ -310,6 +310,12 @@ public extension Node where Context: HTML.BodyContext {
static func noscript(_ nodes: Node...) -> Node {
.element(named: "noscript", nodes: nodes)
}
+
+ /// Add an `` HTML element within the current context.
+ /// - parameter nodes: The element's attributes and child elements.
+ static func object(_ nodes: Node...) -> Node {
+ .element(named: "object", nodes: nodes)
+ }
/// Add an `` HTML element within the current context.
/// - parameter nodes: The element's attributes and child elements.
diff --git a/Tests/PlotTests/HTMLTests.swift b/Tests/PlotTests/HTMLTests.swift
index 35dab2e..a1e032e 100644
--- a/Tests/PlotTests/HTMLTests.swift
+++ b/Tests/PlotTests/HTMLTests.swift
@@ -882,6 +882,19 @@ final class HTMLTests: XCTestCase {