Documentation

DomTool
in package

This class is a wrapper of the DOMWrap\Document tool (which is already a wrapper) by selecting a curated list of methods to manipulate the dom

Tags
see
https://github.com/scotteh/php-dom-wrapper

Table of Contents

Properties

$dom  : Document
The Document object

Methods

addClass()  : NodeList
Adds a css class to a node
append()  : NodeList
Inserts html code ate the end of the contents of an specific dom node
destroy()  : NodeList
Destroy a node
hasClass()  : bool
Checks if a node has a specific css class
init()  : void
Sets the dom object by passing the main html code
prepend()  : NodeList
inserts html code at the beginning of the contents of an specific dom node
removeAttribute()  : NodeList
Removes the attribute and all of his values from a node
removeClass()  : NodeList
Removes a css class from a node
reset()  : void
Re-sets the dom object by passing the main html code
setAttribute()  : Document|string
Sets an attribute value in a node
text()  : string|NodeList
Summary of text

Properties

$dom

The Document object

private Document $dom

Methods

addClass()

Adds a css class to a node

public static addClass(string $input, string $selector, string $class) : NodeList
Parameters
$input : string
$selector : string
$class : string
Return values
NodeList

append()

Inserts html code ate the end of the contents of an specific dom node

public static append(string $input, string $selector, string $append) : NodeList
Parameters
$input : string
$selector : string
$append : string
Return values
NodeList

destroy()

Destroy a node

public static destroy(string $input, string $selector) : NodeList
Parameters
$input : string
$selector : string
Return values
NodeList

hasClass()

Checks if a node has a specific css class

public static hasClass(string $input, string $selector, string $class) : bool
Parameters
$input : string
$selector : string
$class : string
Return values
bool

init()

Sets the dom object by passing the main html code

public static init(string $input) : void
Parameters
$input : string

prepend()

inserts html code at the beginning of the contents of an specific dom node

public static prepend(string $input, string $selector, string $append) : NodeList
Parameters
$input : string
$selector : string
$append : string
Return values
NodeList

removeAttribute()

Removes the attribute and all of his values from a node

public static removeAttribute(string $input, string $selector, string $attribute) : NodeList
Parameters
$input : string
$selector : string
$attribute : string
Return values
NodeList

removeClass()

Removes a css class from a node

public static removeClass(string $input, string $selector, string $class) : NodeList
Parameters
$input : string
$selector : string
$class : string
Return values
NodeList

reset()

Re-sets the dom object by passing the main html code

public static reset(string $input) : void
Parameters
$input : string

setAttribute()

Sets an attribute value in a node

public static setAttribute(string $input, string $selector, string $attribute, string $value) : Document|string
Parameters
$input : string
$selector : string
$attribute : string
$value : string
Return values
Document|string

text()

Summary of text

public static text(string $input, string $selector) : string|NodeList
Parameters
$input : string
$selector : string
Return values
string|NodeList

        
On this page

Search results