class ElementInspector

Properties

static protected array $htmlElements

This is an abridged version of the HTML5 content models and rules, with some liberties taken.

Methods

static bool
closesParent(DOMElement $child, DOMElement $parent)

Test whether given child element closes given parent element

static bool
disallowsText(DOMElement $element)

Test whether given element disallows text nodes

static string
getAllowChildBitfield(DOMElement $element)

Return the "allowChild" bitfield for given element

static string
getCategoryBitfield(DOMElement $element)

Return the "category" bitfield for given element

static string
getDenyDescendantBitfield(DOMElement $element)

Return the "denyDescendant" bitfield for given element

static bool
isBlock(DOMElement $element)

Test whether given element is a block element

static bool
isEmpty(DOMElement $element)

Test whether given element uses the empty content model

static bool
isFormattingElement(DOMElement $element)

Test whether given element is a formatting element

static bool
isTextOnly(DOMElement $element)

Test whether given element only accepts text nodes

static bool
isTransparent(DOMElement $element)

Test whether given element uses the transparent content model

static bool
isVoid(DOMElement $element)

Test whether given element uses the void content model

static bool
preservesWhitespace(DOMElement $element)

Test whether given element preserves whitespace in its content

static bool
evaluate(string $query, DOMElement $element)

Evaluate an XPath query using given element as context node

static string
getBitfield(DOMElement $element, string $name)

Get the bitfield value for a given element

static array
getProperties(DOMElement $element)

Return the properties associated with given element

static bool
hasProperty(DOMElement $element, string $propName)

Test whether given element has given property in context

static string
toBin(string $raw)

Convert a raw string to a series of 0 and 1 in LSB order

static string
toRaw(string $bin)

Convert a series of 0 and 1 in LSB order to a raw string

Details

at line 180
static bool closesParent(DOMElement $child, DOMElement $parent)

Test whether given child element closes given parent element

Parameters

DOMElement $child
DOMElement $parent

Return Value

bool

at line 194
static bool disallowsText(DOMElement $element)

Test whether given element disallows text nodes

Parameters

DOMElement $element

Return Value

bool

at line 205
static string getAllowChildBitfield(DOMElement $element)

Return the "allowChild" bitfield for given element

Parameters

DOMElement $element

Return Value

string

at line 216
static string getCategoryBitfield(DOMElement $element)

Return the "category" bitfield for given element

Parameters

DOMElement $element

Return Value

string

at line 227
static string getDenyDescendantBitfield(DOMElement $element)

Return the "denyDescendant" bitfield for given element

Parameters

DOMElement $element

Return Value

string

at line 238
static bool isBlock(DOMElement $element)

Test whether given element is a block element

Parameters

DOMElement $element

Return Value

bool

at line 249
static bool isEmpty(DOMElement $element)

Test whether given element uses the empty content model

Parameters

DOMElement $element

Return Value

bool

at line 260
static bool isFormattingElement(DOMElement $element)

Test whether given element is a formatting element

Parameters

DOMElement $element

Return Value

bool

at line 271
static bool isTextOnly(DOMElement $element)

Test whether given element only accepts text nodes

Parameters

DOMElement $element

Return Value

bool

at line 282
static bool isTransparent(DOMElement $element)

Test whether given element uses the transparent content model

Parameters

DOMElement $element

Return Value

bool

at line 293
static bool isVoid(DOMElement $element)

Test whether given element uses the void content model

Parameters

DOMElement $element

Return Value

bool

at line 304
static bool preservesWhitespace(DOMElement $element)

Test whether given element preserves whitespace in its content

Parameters

DOMElement $element

Return Value

bool

at line 316
static protected bool evaluate(string $query, DOMElement $element)

Evaluate an XPath query using given element as context node

Parameters

string $query

XPath query

DOMElement $element

Context node

Return Value

bool

at line 330
static protected string getBitfield(DOMElement $element, string $name)

Get the bitfield value for a given element

Parameters

DOMElement $element

Context node

string $name

Bitfield name: either 'c', 'ac' or 'dd'

Return Value

string

at line 357
static protected array getProperties(DOMElement $element)

Return the properties associated with given element

Returns span's properties if the element is not defined

Parameters

DOMElement $element

Return Value

array

at line 369
static protected bool hasProperty(DOMElement $element, string $propName)

Test whether given element has given property in context

Parameters

DOMElement $element

Context node

string $propName

Property name, see self::$htmlElements

Return Value

bool

at line 382
static protected string toBin(string $raw)

Convert a raw string to a series of 0 and 1 in LSB order

Parameters

string $raw

Return Value

string

at line 399
static protected string toRaw(string $bin)

Convert a series of 0 and 1 in LSB order to a raw string

Parameters

string $bin

Return Value

string