\WebinoDraw\DomNodeList

Batch DOMElement manipulation

Summary

Methods
Properties
Constants
getEscapeHtml()
setEscapeHtml()
__construct()
create()
getNodes()
setNodes()
getIterator()
setValue()
setHtml()
appendHtml()
setAttribs()
replace()
remove()
each()
toArray()
No public properties found
No constants found
No protected methods found
$escapeHtml
$nodes
$locator
N/A
No private methods found
No private properties found
N/A

Properties

$escapeHtml

$escapeHtml : \Zend\View\Helper\EscapeHtml

Type

\Zend\View\Helper\EscapeHtml

$nodes

$nodes : \IteratorIterator

Type

\IteratorIterator

Methods

getEscapeHtml()

getEscapeHtml() : \Zend\View\Helper\EscapeHtml

Returns

\Zend\View\Helper\EscapeHtml

setEscapeHtml()

setEscapeHtml(\Zend\View\Helper\EscapeHtml  $escapeHtml) : $this

Parameters

\Zend\View\Helper\EscapeHtml $escapeHtml

Returns

$this

__construct()

__construct(\WebinoDraw\Dom\Locator  $locator, array|\DOMNodeList  $nodes = null) 

Parameters

\WebinoDraw\Dom\Locator $locator
array|\DOMNodeList $nodes

DOMNodes in array or DOMNodeList

create()

create(array|\DOMNodeList  $nodes) : $this

Parameters

array|\DOMNodeList $nodes

DOMNodes in array or DOMNodeList

Returns

$this

getNodes()

getNodes() : \IteratorIterator

Returns

\IteratorIterator

setNodes()

setNodes(array|\DOMNodeList|\IteratorIterator  $nodes) : $this

Parameters

array|\DOMNodeList|\IteratorIterator $nodes

Throws

\WebinoDraw\Exception\InvalidArgumentException

Returns

$this

getIterator()

getIterator() : \Traversable

Returns

\Traversable

setValue()

setValue(string  $value, Callable  $preSet = null) : $this

Set nodes text value

Parameters

string $value
Callable $preSet

Modify and return value, passed parameters $node, $value

Returns

$this

setHtml()

setHtml(string  $xhtml, Callable  $preSet = null) : $this

Set nodes html value

Parameters

string $xhtml
Callable $preSet

Modify and return xhtml, passed parameters $node, $xhtml

Returns

$this

appendHtml()

appendHtml(string  $xhtml) : $this

Append XHTML to nodes

Parameters

string $xhtml

Valid XHTML

Returns

$this —

Newly created nodes

setAttribs()

setAttribs(array  $attribs, Callable  $preSet = null) : $this

Set nodes attributes

Parameters

array $attribs

Attributes to set

Callable $preSet

Modify and return value, assed parameters $node, $value

Returns

$this

replace()

replace(string  $xhtml, Callable  $preSet = null) : $this

Replace node with XHTML code

Parameters

string $xhtml

XHTML to replace node

Callable $preSet

Modify and return xhtml, assed parameters $node, $xhtml

Returns

$this

remove()

remove(string  $locator = '.') : $this

Remove target nodes

Parameters

string $locator

CSS selector or XPath (xpath=)

Returns

$this

each()

each(string  $locator, Callable  $callback) : $this

Perform callback on each node that match the locator

Parameters

string $locator
Callable $callback

The NodeList parameter is passed

Throws

\WebinoDraw\Exception\RuntimeException

Returns

$this

toArray()

toArray() : array

Return nodes in array

Error-free nodes manipulation in a loop.

Returns

array