PHP Class Readability\JSLikeHTMLElement

This class extends PHP's DOMElement to allow users to get and set the innerHTML property of HTML elements in the same way it's done in JavaScript. Example usage: require_once 'JSLikeHTMLElement.php'; header('Content-Type: text/plain'); $doc = new DOMDocument(); $doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement'); $doc->loadHTML('

Para 1

Para 2

'); $elem = $doc->getElementsByTagName('div')->item(0); print innerHTML echo $elem->innerHTML; // prints '

Para 1

Para 2

' echo "\n\n"; set innerHTML $elem->innerHTML = 'FiveFilters.org'; echo $elem->innerHTML; // prints 'FiveFilters.org' echo "\n\n"; print document (with our changes) echo $doc->saveXML();
See also: http://fivefilters.org (the project this was written for)
Author: Keyvan Minoukadeh - http://www.keyvan.net - [email protected]
Inheritance: extends DOMElement
Mostrar archivo Open project: j0k3r/php-readability

Public Methods

Method Description
__get ( $name ) Used for getting innerHTML like it's done in JavaScript:.
__set ( $name, $value ) Used for setting innerHTML like it's done in JavaScript:.
__toString ( )

Method Details

__get() public method

Used for getting innerHTML like it's done in JavaScript:.
public __get ( $name )

__set() public method

Used for setting innerHTML like it's done in JavaScript:.
public __set ( $name, $value )

__toString() public method

public __toString ( )