NAME

HTML::HTML5::DOM::HTMLElement - implementation of the HTMLElement interface of the HTML DOM

DESCRIPTION

HTML::HTML5::DOM::HTMLElement is an implementation of the HTMLElement interface of the HTML DOM. See HTML::HTML5::DOM for a list of the conventions that have been used when translating the DOM to Perl.

HTML Elements

This class applies to the following HTML elements.

  • {http://www.w3.org/1999/xhtml}abbr

  • {http://www.w3.org/1999/xhtml}address

  • {http://www.w3.org/1999/xhtml}article

  • {http://www.w3.org/1999/xhtml}aside

  • {http://www.w3.org/1999/xhtml}b

  • {http://www.w3.org/1999/xhtml}bdi

  • {http://www.w3.org/1999/xhtml}bdo

  • {http://www.w3.org/1999/xhtml}cite

  • {http://www.w3.org/1999/xhtml}code

  • {http://www.w3.org/1999/xhtml}dd

  • {http://www.w3.org/1999/xhtml}dfn

  • {http://www.w3.org/1999/xhtml}dt

  • {http://www.w3.org/1999/xhtml}em

  • {http://www.w3.org/1999/xhtml}figcaption

  • {http://www.w3.org/1999/xhtml}figure

  • {http://www.w3.org/1999/xhtml}footer

  • {http://www.w3.org/1999/xhtml}header

  • {http://www.w3.org/1999/xhtml}hgroup

  • {http://www.w3.org/1999/xhtml}i

  • {http://www.w3.org/1999/xhtml}kbd

  • {http://www.w3.org/1999/xhtml}mark

  • {http://www.w3.org/1999/xhtml}nav

  • {http://www.w3.org/1999/xhtml}noscript

  • {http://www.w3.org/1999/xhtml}rp

  • {http://www.w3.org/1999/xhtml}rt

  • {http://www.w3.org/1999/xhtml}ruby

  • {http://www.w3.org/1999/xhtml}s

  • {http://www.w3.org/1999/xhtml}samp

  • {http://www.w3.org/1999/xhtml}section

  • {http://www.w3.org/1999/xhtml}small

  • {http://www.w3.org/1999/xhtml}strong

  • {http://www.w3.org/1999/xhtml}sub

  • {http://www.w3.org/1999/xhtml}summary

  • {http://www.w3.org/1999/xhtml}sup

  • {http://www.w3.org/1999/xhtml}u

  • {http://www.w3.org/1999/xhtml}var

  • {http://www.w3.org/1999/xhtml}wbr

Inheritance

HTML::HTML5::DOM::HTMLElement inherits methods from the following Perl classes.

Additional Methods

As well as its inherited methods, this class provides the following methods.

  • accessKey

    Called with no arguments, is a shortcut for $elem->getAttribute("accesskey"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • classList

    Splits $elem->getAttribute("class") into a list on whitespace.

  • className

    Called with no arguments, is a shortcut for $elem->getAttribute("class"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • compareDocumentPosition

    Compares this node with another based on document order.

  • dataset

    Gets a hashref based on data-foo attributes. This is currently read-only, but in future may be implemented as a tied hash to allow read/write access.

  • dir

    Called with no arguments, is a shortcut for $elem->getAttribute("dir"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • getElementById

    The world-famous getElementById method. The default XML::LibXML implementation of this does not work with HTML::HTML5::Parser documents, because HTML::HTML5::Parser lacks the ability to inform libxml which element to use as an ID. (libxml defaults to xml:id.) This implementation is XPath-based, thus slower.

  • getElementsByClassName

    Given one or more class names, returns a list of elements bearing those classes.

  • getFeature

    Acts as a shortcut for $element->ownerDocument->implementation->getFeature.

  • getUserData

    Not implemented - perhaps never will be. Try dataset instead.

  • hidden

    Called with no arguments, is a shortcut for $elem->hasAttribute("hidden"). If called with a true argument, will setAttribute; if called with a false argument will removeAttribute.

  • id

    Called with no arguments, is a shortcut for $elem->getAttribute("id"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • innerHTML

    When called without arguments, serialises the contents of the element (but not the element itself) to a single string. When called with a string argument, parses the string as HTML and uses it to set the content of this element. When possible, attempts to use polyglot HTML (i.e. markup that works as HTML and XHTML).

  • isDefaultNamespace

    Given a URI, returns true if that is the default namespace prefix.

  • isSupported

    Acts as a shortcut for $element->ownerDocument->implementation->hasFeature.

  • lang

    Called with no arguments, is a shortcut for $elem->getAttribute("lang"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • lookupPrefix

    Alias for lookupNamespacePrefix.

  • outerHTML

    As per innerHTML, but includes the element itself. Can be used as a setter, but that's a bit of a weird thing to do.

  • p5_ancestors

    Returns a (Perl or XML::LibXML::NodeList) list of this element's ancestors - i.e. the parentNode, the parentNode of the parentNode, etc.

  • p5_contains

    Given an argument, returns true if that argument is an element nested within this element.

  • schemaTypeInfo

    Not implemented.

  • setIdAttribute

    Not implemented.

  • setIdAttributeNS

    Not implemented.

  • setIdAttributeNode

    Not implemented.

  • setUserData

    Not implemented - perhaps never will be. Try dataset instead.

  • tabIndex

    Called with no arguments, is a shortcut for $elem->getAttribute("tabindex"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • title

    Called with no arguments, is a shortcut for $elem->getAttribute("title"). Called with a defined argument, acts as setAttribute. Called with undef as an argument, acts as removeAttribute.

  • translate

    Called with no arguments, is a shortcut for $elem->hasAttribute("translate"). If called with a true argument, will setAttribute; if called with a false argument will removeAttribute.

BUGS

http://rt.cpan.org/Dist/Display.html?Queue=HTML-HTML5-DOM.

SEE ALSO

HTML::HTML5::DOM.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2012, 2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.