Skip to content

Commit 2da3852

Browse files
committed
Assign the ismap attribute to the image element
1 parent f15c950 commit 2da3852

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

Sources/HTMLKit/Abstraction/Attributes/BasicAttributes.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,14 +1087,22 @@ extension IdentifierAttribute where Self: EmptyNode {
10871087
}
10881088
}
10891089

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

1094-
/// The function represents the html-attribute 'ismap'.
1095-
///
1096-
/// ```html
1097-
/// <tag ismap />
1094+
/// Mark an element as a server-side image map.
1095+
///
1096+
/// It enables the element to send click coordinates to the server,
1097+
/// allowing interactions with the element.
1098+
///
1099+
/// ```swift
1100+
/// Anchor {
1101+
/// Image()
1102+
/// .source("...png")
1103+
/// .isMap()
1104+
/// }
1105+
/// .reference("https://...")
10981106
/// ```
10991107
func isMap() -> Self
11001108
}

Sources/HTMLKit/Abstraction/Elements/BodyElements.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15337,7 +15337,7 @@ public struct Image: EmptyNode, HtmlElement, BodyElement, FormElement, FigureEle
1533715337
}
1533815338
}
1533915339

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

1534215342
public func accessKey(_ value: Character) -> Image {
1534315343
return mutate(accesskey: value)
@@ -15415,6 +15415,10 @@ extension Image: GlobalAttributes, GlobalEventAttributes, GlobalAriaAttributes,
1541515415
public func id(_ value: String) -> Image {
1541615416
return mutate(id: value)
1541715417
}
15418+
15419+
public func isMap() -> Image {
15420+
return mutate(ismap: "ismap")
15421+
}
1541815422

1541915423
public func language(_ value: Values.Language) -> Image {
1542015424
return mutate(lang: value.rawValue)

0 commit comments

Comments
 (0)