attributes(_:when:)

Adds the specified attribute to the element.

Html+Attributes.swift:88
func attributes(_ attribute: HTMLAttribute<Tag>, when condition: Bool = true) -> _AttributedElement<Self>

Parameters

attribute

The attribute to add to the element.

condition

If set to false, the attribute will not be added.

Returns

A new element with the specified attribute added.