HTML::O...ttribute(3)
π HTML::O...ttribute(3) β HTML Object Element Attribute Class π
okay bestie so this page is straight out of User Contributed Perl Documentation, and it's all about the β¨ attribute β¨ layer of HTML::Object. sit down, hydrate, let's go π
πΈ NAME πΈ
HTML::Object::Attribute β the HTML Object Element Attribute Class. that's it, that's the name, she's an icon, periodt π
π¦ SYNOPSIS π¦
like, literally the fastest way in:
use HTML::Object::Attribute;
my $attr = HTML::Object::Attribute->new( 'id' );
$attr->value = "hello";
no cap, that's the whole vibe π₯
β VERSION β
v0.3.0 β she's serving version v0.3.0 and she knows it π
π DESCRIPTION π
okay so this class represents an element attribute β like the id="hello" part of a tag, iykyk. it's used as part of HTML::Object, and it also contains methods to interface with HTML::Object::XPath. so she's dual-purpose and honestly? main character energy π
π§ CONSTRUCTOR π§
β¨ new β¨
Creates a new HTML::Object::Attribute object. π«Ά
It may also take an hash like arguments, that also are method of the same name. so you can pass the name straight up or as a named arg, both slay:
my $attr = HTML::Object::Attribute->new( 'id' );
# or
my $attr = HTML::Object::Attribute->new( name => 'id' );
π PROPERTIES π
π nodeValue π
This returns or sets the value of the current node.
For document, element or collection, this returns undef π and for attribute, text or comment, this returns the objct value. (yes, "objct" β i'm not fixing the original's makeup, i don't do that π
)
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue>
π₯ METHODS π₯
π« element π«
Returns the HTML::Object::Element object to which this attribute belongs. her home, her origin story π«Ά
π« getAttributes π«
Returns an array object of the related element's attributes as HTML::Object::Attribute objects. it's giving squad goals β¨
π« getLocalName π«
Returns the attribute name. simple. iconic. no notes.
π« getNextSibling π«
Returns the next attribute object, or undef. sometimes you get a friend, sometimes you get nothing π
π« getParentNode π«
Returns the parent HTML::Object::Element object. found family fr fr π
π« getPreviousSibling π«
Returns the previous attribute object, or undef. the one who came before π
π« getValue π«
Returns the attribute value.
π« isAttributeNode π«
Always returns true. always. she's confident, she knows what she is π
π« is_inside π«
Provided with an HTML::Object::Element and this will return true if this attribute is inside it, or false otherwise. vibe check: are you in your element? literally π¦
π« lineage π«
Add the parent element to our lineage. See "lineage" in HTML::Object::Element β gotta know your roots, bestie πΈ
π« localName π«
Read-only.
A string representing the local part of the qualified name of the attribute.
This is the same as "getName", because this interface does not use xml "prefix".
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName>
π« name π«
Set or get the attribute name.
Normally, under JavaScript, this is read-only, but under perl you can change it. Still be careful. β οΈ like yes you can, but should you? the manpage said be careful and i'm just the messenger π
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/name>
π« namespaceURI π«
Read-only.
A string representing the URI of the namespace of the attribute, or undef if there is no namespace.
This actually always return undef, because this interface does not use xml "prefix". so she's mysterious and unreachable, tragic π
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI>
π« nodeValue π«
This returns or sets the value of the current element.
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue>
π« ownerElement π«
Returns the element object to which this attribute object belongs.
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/ownerElement>
π« prefix π«
Read-only.
This always return undef, because this interface does not use xml "prefix".
Normally, under JavaScript, this would return a string representing the namespace prefix of the attribute, or undef if a namespace without prefix or no namespace are specified.
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix>
π« rank π«
Set or get the attribute rank. This returns a number object. she's got a ranking and she's not sorry π
π« string_value π«
This is an alias for "value".
π« to_boolean π«
Returns the attribute value as a boolean. true or false bestie, binary queen π
π« to_literal π«
Returns the attribute value as a litteral. (yes, "litteral" β again, not my typo to fix, i respect the original's choices π)
π« to_number π«
Returns the attribute value as a number. math era π’
π« toString π«
Returns a stringification of this attribute such as attribute="value" β so she can introduce herself at parties β¨
π« value π«
Set or get the value of this attribute as a scalar object. For example:
$attr->value( "hello" );
See for more information <https://developer.mozilla.org/en-US/docs/Web/API/Attr/value>
π«Ά AUTHOR π«Ά
Jacques Deguest <jack@deguest.jp> β thank you for your service king π
π SEE ALSO π
obsessed with this list, look at all these icons:
HTML::ObjectHTML::Object::AttributeHTML::Object::BooleanHTML::Object::ClosingHTML::Object::CollectionHTML::Object::CommentHTML::Object::DeclarationHTML::Object::DocumentHTML::Object::ElementHTML::Object::ExceptionHTML::Object::LiteralHTML::Object::NumberHTML::Object::RootHTML::Object::SpaceHTML::Object::TextHTML::Object::XQuery
and the reading material π:
- <https://developer.mozilla.org/en-US/docs/Web/API/Attr>
- Mozilla reference <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes>
- W3C standard on attributes <https://html.spec.whatwg.org/multipage/syntax.html#attributes-2>
π COPYRIGHT & LICENSE π
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. slay, open source queen π
ok that's the whole page bestie, go forth and attribute responsibly π β¨
small cute sign-off before you go: this lil beauty is perl v5.42.2, dated 2026-02-15, and filed under HTML::O...ttribute(3) β the truncated name is canon, don't come for her ππ¦
π¦ where this page comes from
- alpine 3.24: perl-html-object-doc 0.6.0-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms