GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::DOM::ELEMENT (3)

.ds Aq ’

NAME

HTML::DOM::Element - A Perl class for representing elements in an HTML DOM tree

CONTENTS

VERSION

Version 0.056

SYNOPSIS



  use HTML::DOM;
  $doc = HTML::DOM->new;
  $elem = $doc->createElement(a);

  $elem->setAttribute(href, http://www.perl.org/);
  $elem->getAttribute(href);
  $elem->tagName;
  # etc



DESCRIPTION

This class represents elements in an HTML::DOM tree. It is the base class for other element classes (see CLASSES AND DOM INTERFACES in HTML::DOM.) It implements the Element and HTMLElement DOM interfaces.

METHODS

    Constructor

You should normally use HTML::DOM’s createElement method. This is listed here only for completeness:



  $elem = new HTML::DOM::Element $tag_name;



$elem will automatically be blessed into the appropriate class for $tag_name.

    Attributes

The following DOM attributes are supported:
tagName Returns the tag name.
id
title
lang
dir
className These five get (optionally set) the corresponding HTML attributes. Note that className corresponds to the class attribute.
style This returns a CSS::DOM::Style object, representing the contents of the ’style’ HTML attribute.
And there is also the following non-DOM attribute:
content_offset This contains the offset (in characters) within the HTML source of the element’s first child node, if it is a text node. This is set (indirectly) by HTML::DOM’s write method. You can also set it yourself.

    Other Methods

getAttribute ( $name ) Returns the attribute’s value as a string.
setAttribute ( $name, $value ) Sets the attribute named $name to $value.
removeAttribute ( $name ) Deletes the $named attribute.
getAttributeNode ( $name ) Returns an attribute node (HTML::DOM::Attr).
setAttributeNode ( $attr ) Sets the attribute whose name is $attr->nodeName to the attribute object itself. If it replaces another attribute object, the latter is returned.
removeAttributeNode ( $attr ) Removes and returns the $attr.
getElementsByTagName ( $tagname) This finds all elements with that tag name under the current element, returning them as a list in list context or a node list object in scalar context.
getElementsByClassName ( $names ) This finds all elements whose class attribute contains all the names in $names, which is a space-separated list; returning the elements as a list in list context or a node list object in scalar context.
hasAttribute ( $name ) Returns true or false, indicating whether this element has an attribute named $name, even one that is implied.
click() (HTML 5) This triggers a click event on the element; nothing more.
trigger_event This overrides HTML::DOM::Node’s method to trigger a DOMActivate event after a click.

SEE ALSO

HTML::DOM

HTML::DOM::Node

HTML::Element

All the HTML::DOM::Element subclasses listed under CLASSES AND DOM INTERFACES in HTML::DOM

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::DOM::ELEMENT (3) 2016-02-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.