Elements
class Elements
This class provides general information about HTML5 elements, including syntactic and semantic issues.
Parsers and serializers can use this class as a reference point for information about the rules of various HTML5 elements.
Constants
KNOWN_ELEMENT |
Indicates an element is described in the specification. |
TEXT_RAW |
Indicates the contained text should be processed as raw text. |
TEXT_RCDATA |
Indicates the contained text should be processed as RCDATA. |
VOID_TAG |
Indicates the tag cannot have content. |
AUTOCLOSE_P |
Indicates that if a previous event is for a P tag, that element should be considered closed. |
TEXT_PLAINTEXT |
Indicates that the text inside is plaintext (pre). |
BLOCK_TAG |
Indicates that the tag is a block. |
BLOCK_ONLY_INLINE |
Indicates that the tag allows only inline elements as child nodes. |
Properties
static array | $html5 | The HTML5 elements as defined in http://dev.w3.org/html5/markup/elements.html. | |
static array | $mathml | The MathML elements. | |
static array | $svg | The svg elements. | |
static | $svgCaseSensitiveAttributeMap | Some attributes in SVG are case sensetitive. | |
static | $svgCaseSensitiveElementMap | Some SVG elements are case sensetitive. |
Methods
Check whether the given element meets the given criterion.
Test if an element is a valid html5 element.
Test if an element name is a valid MathML presentation element.
Test if an element is a valid SVG element.
Is an element name valid in an html5 document.
Get the element mask for the given element name.
Normalize a SVG element name to its proper case and form.
Normalize a SVG attribute name to its proper case and form.
Normalize a MathML attribute name to its proper case and form.
Details
at line line 486
static
boolean
isA(
string $name,
int $mask)
Check whether the given element meets the given criterion.
Example:
Elements::isA('script', Elements::TEXT_RAW); // Returns true.
Elements::isA('script', Elements::TEXT_RCDATA); // Returns false.
at line line 503
static
bool
isHtml5Element(
string $name)
Test if an element is a valid html5 element.
at line line 518
static
bool
isMathMLElement(
string $name)
Test if an element name is a valid MathML presentation element.
at line line 532
static
boolean
isSvgElement(
string $name)
Test if an element is a valid SVG element.
at line line 549
static
bool
isElement(
string $name)
Is an element name valid in an html5 document.
This includes html5 elements along with other allowed embedded content such as svg and mathml.
at line line 562
static
int
element(
string $name)
Get the element mask for the given element name.
at line line 585
static
string
normalizeSvgElement(
string $name)
Normalize a SVG element name to its proper case and form.
at line line 603
static
string
normalizeSvgAttribute(
string $name)
Normalize a SVG attribute name to its proper case and form.
at line line 623
static
string
normalizeMathMlAttribute(
string $name)
Normalize a MathML attribute name to its proper case and form.
Note, all MathML element names are lowercase.