NAME

HTML::Object::DOM::Element::Area - HTML Object DOM Area Class

SYNOPSIS

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

VERSION

v0.2.0

DESCRIPTION

This interface provides special properties and methods (beyond those of the regular object HTML::Object::Element interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements.

INHERITANCE

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

PROPERTIES

Inherits properties from its parent HTML::Object::DOM::Element

accessKey

Is a string containing a single character that switches input focus to the control.

See also Mozilla documentation

alt

Is a string that reflects the alt HTML attribute, containing alternative text for the element.

See also Mozilla documentation

coords

Is a string that reflects the coords HTML attribute, containing coordinates to define the hot-spot region.

See also Mozilla documentation

download

Is a string indicating that the linked resource is intended to be downloaded rather than displayed in the browser. The value represent the proposed name of the file. If the name is not a valid filename of the underlying OS, browser will adapt it.

See also Mozilla documentation

hash

Is a string containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced URL.

Example:

<map name="infographic">
    <area id="circle" shape="circle" coords="130,136,60"
    href="https://example.org/#ExampleSection" alt="Documentation" />
</map>

<img usemap="#infographic" src="/some/where/info.png" alt="Infographic" />

my $area = $doc->getElementById('circle');
$area->hash; # returns '#ExampleSection'

See also Mozilla documentation

host

Is a string containing the hostname and port (if it's not the default port) in the referenced URL.

Example:

my $area = $doc->createElement('area');

$area->href = 'https://example.org/some/where';
$area->host == 'example.org';

$area->href = "https://example.org:443/some/where";
$area->host == 'example.org';
# The port number is not included because 443 is the scheme's default port

$area->href = "https://example.org:4097/some/where";
$area->host == 'example.org:4097';

See also Mozilla documentation

hostname

Is a string containing the hostname in the referenced URL.

Example:

# An <area id="myArea" href="https://example.org/some/where"> element is in the document
my $area = $doc->getElementById('myArea');
$area->hostname; # returns 'example.org'

See also Mozilla documentation

href

Is a string containing that reflects the href HTML attribute, containing a valid URL of a linked resource.

Example:

# An <area id="myArea" href="https://example.org/some/where"> element is in the document
my $area = $doc->getElementById("myArea");
$area->href; # returns 'https://example.org/some/where'

See also Mozilla documentation

noHref

Is a boolean flag indicating if the area is inactive (true) or active (false). This is an HTML attribute.

Example:

<map name="SampleMap">
    <area shape="rect" coords="1,1,83,125" alt="rectangle" nohref="">
    <area shape="circle" coords="234,57,30" alt="circle" href="#">
    <area shape="poly" coords="363,37,380,40,399,35,420,47,426,63,423,78,430,94,409,90,395,92,379,84,371,67,370,57" alt="polygon" href="#">
</map>

See also Mozilla documentation

origin

Read-only.

Returns a string containing the origin of the URL, that is its scheme, its domain and its port.

Example:

# An <area id="myArea" href="https://example.org/some/where"> element is in the document
my $area = $doc->getElementById("myArea");
$area->origin; # returns 'https://example.org'

See also Mozilla documentation

password

Is a string containing the password specified before the domain name.

Example:

# An <area id="myArea" href="https://anonymous:flabada@example.org/some/where"> is in the document
my $area = $doc->getElementByID("myArea");
$area->password; # returns 'flabada'

See also Mozilla documentation

pathname

Is a string containing the path name component, if any, of the referenced URL.

Example:

# An <area id="myArea" href="/some/where"> element is in the document
my $area = $doc->getElementById("myArea");
$area->pathname; # returns '/some/where'

See also Mozilla documentation

port

Is a string containing the port component, if any, of the referenced URL.

Example:

# An <area id="myArea" href="https://example.org:443/some/where"> element is in the document
my $area = $doc->getElementByID("myArea");
$area->port; # returns '443'

See also Mozilla documentation

protocol

Is a string containing the protocol component (including trailing colon ':'), of the referenced URL.

Example:

# An <area id="myArea" href="https://example.org/some/where"> element is in the document
my $area = $doc->getElementById("myArea");
$area->protocol; # returns 'https:'

See also Mozilla documentation

referrerPolicy

Is a string that reflects the referrerpolicy HTML attribute indicating which referrer to use when fetching the linked resource.

Example:

<img usemap="#mapAround" width="100" height="100" src="/img/logo@2x.png" />
<map id="myMap" name="mapAround" />>

my $elt = $doc->createElement("area");
$elt->href = "/img2.png";
$elt->shape = "rect";
$elt->referrerPolicy = "no-referrer";
$elt->coords = "0,0,100,100";
my $map = $doc->getElementById("myMap");

$map->appendChild($elt);
# When clicked, the area's link will not send a referrer header.

See also Mozilla documentation

rel

Is a string that reflects the rel HTML attribute, indicating relationships of the current document to the linked resource.

Example:

my $areas = $doc->getElementsByTagName("area");
my $length = $areas->length;
for( my $i = 0; $i < $length; $i++ )
{
    say("Rel: " + $areas->[$i]->rel);
}

See also Mozilla documentation

relList

Returns a HTML::Object::TokenList that reflects the rel HTML attribute, indicating relationships of the current document to the linked resource, as a list of tokens.

Example:

my $areas = $doc->getElementsByTagName("area");
my $length = $areas->length;

for( my $i = 0; $i < $length; $i++ )
{
    my $list = $areas->[$i]->relList;
    my $listLength = $list->length;
    say( "New area found." );
    for( my $j = 0; $j < $listLength; $j++ )
    {
        say( $list->[$j] );
    }
}

See also Mozilla documentation

Is a string containing the search element (including leading question mark '?'), if any, of the referenced URL.

Example:

# An <area id="myArea" href="/some/where?q=123"> element is in the document
my $area = $doc->getElementById("myArea");
$area->search; # returns '?q=123'

See also Mozilla documentation

shape

Is a string that reflects the shape HTML attribute, indicating the shape of the hot-spot, limited to known values.

See also Mozilla documentation

tabIndex

Is a long containing the element's position in the tabbing order.

Example:

my $b1 = $doc->getElementById('button1');
$b1->tabIndex = 1;

See also Mozilla documentation

target

Is a string that reflects the target HTML attribute, indicating the browsing context in which to open the linked resource.

See also Mozilla documentation

username

Is a string containing the username specified before the domain name.

Example:

# An <area id="myArea" href="https://anonymous:flabada@example.org/some/where"> element is in the document
my $area = $doc->getElementByID("myArea");
$area->username; # returns 'anonymous'

See also Mozilla documentation

METHODS

Inherits methods from its parent HTML::Object::DOM::Element

toString

Returns a string containing the whole URL of the script executed in the Worker. It is a synonym for "href" in HTML::Object::DOM::Element::Area.

Example:

# An <area id="myArea" href="/some/where"> element is in the document
my $area = $doc->getElementById("myArea");
$area->toString(); # returns 'https://example.org/some/where'

See also Mozilla documentation

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Mozilla documentation, Mozilla documentation on area element

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.