HTML::O...ttribute(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’… 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::Object
  • HTML::Object::Attribute
  • HTML::Object::Boolean
  • HTML::Object::Closing
  • HTML::Object::Collection
  • HTML::Object::Comment
  • HTML::Object::Declaration
  • HTML::Object::Document
  • HTML::Object::Element
  • HTML::Object::Exception
  • HTML::Object::Literal
  • HTML::Object::Number
  • HTML::Object::Root
  • HTML::Object::Space
  • HTML::Object::Text
  • HTML::Object::XQuery

and the reading material πŸ“š:


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