HTML::Object::Attribute - HTML Object Element Attribute Class
use HTML::Object::Attribute; my $attr = HTML::Object::Attribute->new( 'id' ); $attr->value = "hello";
v0.2.0
This class represent an element attribute. it is used as part of HTML::Object, and also contains methods to interface with HTML::Object::XPath
Creates a new HTML::Object::Attribute objects.
HTML::Object::Attribute
It may also take an hash like arguments, that also are method of the same name.
my $attr = HTML::Object::Attribute->new( 'id' ); # or my $attr = HTML::Object::Attribute->new( name => 'id' );
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.
undef
See for more information
Returns the HTML::Object::Element object to which this attribute belongs.
Returns an array object of the related element's attributes as HTML::Object::Attribute objects.
Returns the attribute name.
Returns the next attribute object, or undef.
Returns the parent HTML::Object::Element object.
Returns the previous attribute object, or undef.
Returns the attribute value.
Always returns true.
Provided with an HTML::Object::Element and this will return true if this attribute is inside it, or false otherwise.
Add the parent element to our lineage. See "lineage" in HTML::Object::Element
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
prefix
Set or get the attribute name.
Normally, under JavaScript, this is read-only, but under perl you can change it. Still be careful.
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
This returns or sets the value of the current element.
Returns the element object to which this attribute object belongs.
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 c<undef> if a namespace without prefix or no namespace are specified.
Set or get the attribute rank. This returns a number object
This is an alias for "value"
Returns the attribute value as a boolean
Returns the attribute value as a litteral
Returns the attribute value as a number
Returns a stringification of this attribute such as attribute="value"
attribute="value"
Set or get the value of this attribute as a scalar object. For example:
$attr->value( "hello" );
Jacques Deguest <jack@deguest.jp>
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
https://developer.mozilla.org/en-US/docs/Web/API/Attr
Mozilla reference
W3C standard on attributes
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.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.