HTML::O...t::Label(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’… NAME

okay so bestie, gather round: HTML::Object::DOM::Element::Label β€” the HTML Object DOM Label Class. it's the whole vibe for <label> elements. periodt. πŸŽ€


✨ SYNOPSIS

use HTML::Object::DOM::Element::Label;
my $label = HTML::Object::DOM::Element::Label->new ||
    die( HTML::Object::DOM::Element::Label->error, "\n" );

like, that's literally it. construct it, or die trying (with the error message, obviously) πŸ’€


🌸 VERSION

v0.2.0

she's v0.2.0 and she's serving 🫢


πŸ¦‹ DESCRIPTION

okay so this interface gives you access to the properties that are specific to <label> elements β€” like, the stuff that's just for labels, not for every element ever. it inherits methods and properties from the base HTML::Object::Element interface, because of course it does, family tree and all that πŸ‘‘


🌈 INHERITANCE

the glow-up lineage, in all its glory β€” read it left to right, babes:

+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +-----------------------------------+
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Label |
+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +-----------------------------------+

she's at the end of the chain and she ate πŸ’…


πŸ”₯ PROPERTIES

inherits properties from its parent HTML::Object::DOM::Element β€” yeah yeah, we know, mother provides πŸ™ˆ

πŸ‘‘ control

read-only, bestie.

it's a HTML::Object::Element representing the control that this label is associated with. it returns "undef" if the "for" attribute has no id set, or if no associated element could be found in the DOM. no cap β€” sometimes the control just isn't there and you get undef, that's the deal 🫠

see also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control>

πŸŽ€ form

read-only too, obviously.

it's a HTML::Object::DOM::Element::Form object representing the form that the labeled control is associated with β€” or "undef" if there's no associated control, or if that control isn't associated with a form. like, if there's no control, there's no form to speak of, right? πŸ€·β€β™€οΈ

in other words, it's just a shortcut for:

$e->control->form

see also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/form>

⭐ htmlFor

it's a string containing the ID of the labeled control β€” this reflects the for attribute. iykyk, it's the for attribute's whole personality ✨

example:

<label for="inputId">Enter your name</label>
my $label = $doc->getElementsByTagName( 'label' )->first;
say( "ID is: ", $label->htmlFor );

see also Mozilla documentation <https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/htmlFor>


πŸ’– METHODS

inherits methods from its parent HTML::Object::DOM::Element β€” again, mother provides, we don't reinvent the wheel here 🧚


πŸ“ AUTHOR

Jacques Deguest <jack@deguest.jp> β€” shoutout to the icon who wrote this 🫢


πŸ’œ SEE ALSO

go read the docs, bestie, they're literally right there πŸ“š


Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

like, fr fr, it's free software β€” use it, share it, remix it, just keep the same terms as Perl itself and we're all good πŸ’…

and that's the whole page, babe β€” she's perl v5.42.2, dated 2026-02-15, and she's iconic. mwah πŸ˜˜πŸŽ€

πŸ“¦ where this page comes from