AnewtXHTMLElement class

Base XHTML element class.

Class Overview

Base XHTML element class.

This class is extended by all of the XHTML element classes. AnewtXHTMLElement provides functionality shared by all XHTML element classes.

Class methods

These methods can be used to manipulate the class attribute of an element. These methods are here for convenience only, since the attributes methods of the AnewtXMLDomElement class van be used as well to set the value of the class attribute.

set_class($class_name)

Set a class for this element.

Parameters

$class_name

The class name to set.

add_class($class_name)

Add a class to this element.

The current classes are left as-is.

Parameters

$class_name

The class name to add.

remove_class($class_name=null)

Remove class attribute(s) from this element.

If no parameters are specified, the class attribute is removed.

If a class name is provided, it will be removed from the current classes of this element. If the provided class name was not set on this element, nothing happens.

Parameters

$class_name

The class to remove (optional). If not given (or null), all classes are removed.

Protected Methods

__construct($children=null, $attributes=null) [protected]

Create a new XHTML element.

This constructor accepts a variable number of arguments. Each argument is appended as a child node, but the last argument is handled differently. If the last argument is an associative array, its values are used as attribute names and values. If it's not an associative array, it is treated just as the other arguments and appended as a child node.

The AnewtXHTMLElement class is abstract and cannot be instantiated directly. Use one of its descendants instead (all XHTML element classes extend AnewtXHTMLElement); there is one class for each XHTML element in the HTML specification.

Parameters

$children

One or more child nodes (optional).

$attributes

Associative array with element attributes (optional).

Public Attributes

$always_render_closing_tag

Whether the closing tag for this element should always be rendered in full instead of using shorthand notation.

This is needed for e.g. the script tag in XHTML because of browser imcompatibilities.

Protected Attributes

$must_be_empty [protected]

Whether this node can contain children.

Inheritance

Base Classes

Inherited members