betty.html.attributes module

Provide the HTML API, for generating HTML pages.

final class betty.html.attributes.Attributes

Bases: object

Manage attributes for an HTML element.

__init__(**kwargs: Unpack[_AttributesKwargs])
format() str

Format the HTML attributes to a string.

get_data(attribute_name: str) str | None

Get the value for the given HTML data attribute.

html_accept
html_accept_charset
html_accesskey
html_action
html_allow
html_alt
html_aria_controls
html_aria_expanded
html_as
html_async
html_autocapitalize
html_autocomplete
html_autoplay
html_capture
html_charset
html_checked
html_cite
html_class
html_cols
html_colspan
html_content
html_contenteditable
html_controls
html_coords
html_crossorigin
html_data
html_datetime
html_decoding
html_default
html_defer
html_dir
html_dirname
html_disabled
html_download
html_draggable
html_enctype
html_enterkeyhint
html_for
html_formaction
html_formenctype
html_formmethod
html_formnovalidate
html_formtarget
html_headers
html_height
html_hidden
html_high
html_href
html_hreflang
html_http_equiv
html_id
html_inputmode
html_integrity
html_ismap
html_itemprop
html_kind
html_label
html_lang
html_list
html_loading
html_loop
html_low
html_max
html_maxlength
html_media
html_method
html_min
html_minlength
html_multiple
html_muted
html_name
html_novalidate
html_open
html_optimum
html_pattern
html_ping
html_placeholder
html_playsinline
html_poster
html_preload
html_readonly
html_referrerpolicy
html_rel
html_required
html_reversed
html_role
html_rows
html_rowspan
html_sandbox
html_scope
html_selected
html_shape
html_size
html_sizes
html_slot
html_span
html_spellcheck
html_src
html_srcdoc
html_srclang
html_srcset
html_start
html_step
html_style
html_tabindex
html_target
html_title
html_translate
html_type
html_usemap
html_value
html_width
html_wrap
set(**attributes: Unpack[_AttributesKwargs]) None

Set values for the given HTML attributes.

set_data(**attributes: str) None

Set values for the given HTML data attributes.

setdefault(**attributes: Unpack[_AttributesKwargs]) None

Set values for the given HTML attributes, but only for those attributes that do not already have a value set.