Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign the ismap attribute #157

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
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: 13 additions & 5 deletions Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1087,14 +1087,22 @@ extension IdentifierAttribute where Self: EmptyNode {
}
}

/// The protocol provides the element with the ismap handler.
/// A type that provides the `isMap` modifier.
@_documentation(visibility: internal)
public protocol IsMapAttribute: Attribute {

/// The function represents the html-attribute 'ismap'.
///
/// ```html
/// <tag ismap />
/// Mark an element as a server-side image map.
///
/// It enables the element to send click coordinates to the server,
/// allowing interactions with the element.
///
/// ```swift
/// Anchor {
/// Image()
/// .source("...png")
/// .isMap()
/// }
/// .reference("https://...")
/// ```
func isMap() -> Self
}
Expand Down
6 changes: 5 additions & 1 deletion Sources/HTMLKit/Abstraction/Elements/BodyElements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15337,7 +15337,7 @@ public struct Image: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle
}
}

extension Image: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes, AlternateAttribute, SourceAttribute, SizesAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, FetchPriorityAttribute & LoadingAttribute & SourceSetAttribute & DecodingAttribute {
extension Image: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes, AlternateAttribute, SourceAttribute, SizesAttribute, WidthAttribute, HeightAttribute, ReferrerPolicyAttribute, FetchPriorityAttribute & LoadingAttribute & SourceSetAttribute & DecodingAttribute & IsMapAttribute {

public func accessKey(_ value: Character) -> Image {
return mutate(accesskey: value)
Expand Down Expand Up @@ -15415,6 +15415,10 @@ extension Image: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes,
public func id(_ value: String) -> Image {
return mutate(id: value)
}

public func isMap() -> Image {
return mutate(ismap: "ismap")
}

public func language(_ value: Values.Language) -> Image {
return mutate(lang: value.rawValue)
Expand Down
Loading