Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Sources/Plot/API/HTMLAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,24 @@ public extension Attribute where Context == HTML.PictureSourceContext {
static func type(_ type: String) -> Attribute {
Attribute(name: "type", value: type)
}

/// A string with a media query describing which image from the `srcset` attribute should be used.
/// - parameter sizes: The sizes used for the of sources that this element should point to.
static func sizes(_ sizes: String) -> Attribute {
Attribute(name: "sizes", value: sizes)
}

/// Assign an integer giving the intinsic height of the `srcset` image in pixels.
/// - parameter height: The height of the image in the source.
static func height(_ height: Int) -> Attribute {
Attribute(name: "height", value: String(height))
}

/// Assign an integer giving the intrinsic width of the `srcset` image in pixels.
/// - parameter width: The width of the image in the source.
static func width(_ width: Int) -> Attribute {
Attribute(name: "width", value: String(width))
}
}

// MARK: - Forms, input and options
Expand Down