aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/JSLikeHTMLElement.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/JSLikeHTMLElement.php')
-rw-r--r--inc/JSLikeHTMLElement.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/JSLikeHTMLElement.php b/inc/JSLikeHTMLElement.php
index dfcc1be5..238ba8a8 100644
--- a/inc/JSLikeHTMLElement.php
+++ b/inc/JSLikeHTMLElement.php
@@ -4,7 +4,7 @@
4* 4*
5* This class extends PHP's DOMElement to allow 5* This class extends PHP's DOMElement to allow
6* users to get and set the innerHTML property of 6* users to get and set the innerHTML property of
7* HTML elements in the same way it's done in 7* HTML elements in the same way it's done in
8* JavaScript. 8* JavaScript.
9* 9*
10* Example usage: 10* Example usage:
@@ -15,16 +15,16 @@
15* $doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement'); 15* $doc->registerNodeClass('DOMElement', 'JSLikeHTMLElement');
16* $doc->loadHTML('<div><p>Para 1</p><p>Para 2</p></div>'); 16* $doc->loadHTML('<div><p>Para 1</p><p>Para 2</p></div>');
17* $elem = $doc->getElementsByTagName('div')->item(0); 17* $elem = $doc->getElementsByTagName('div')->item(0);
18* 18*
19* // print innerHTML 19* // print innerHTML
20* echo $elem->innerHTML; // prints '<p>Para 1</p><p>Para 2</p>' 20* echo $elem->innerHTML; // prints '<p>Para 1</p><p>Para 2</p>'
21* echo "\n\n"; 21* echo "\n\n";
22* 22*
23* // set innerHTML 23* // set innerHTML
24* $elem->innerHTML = '<a href="http://fivefilters.org">FiveFilters.org</a>'; 24* $elem->innerHTML = '<a href="http://fivefilters.org">FiveFilters.org</a>';
25* echo $elem->innerHTML; // prints '<a href="http://fivefilters.org">FiveFilters.org</a>' 25* echo $elem->innerHTML; // prints '<a href="http://fivefilters.org">FiveFilters.org</a>'
26* echo "\n\n"; 26* echo "\n\n";
27* 27*
28* // print document (with our changes) 28* // print document (with our changes)
29* echo $doc->saveXML(); 29* echo $doc->saveXML();
30* @endcode 30* @endcode
@@ -59,7 +59,7 @@ class JSLikeHTMLElement extends DOMElement
59 $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); 59 $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');
60 // Using <htmlfragment> will generate a warning, but so will bad HTML 60 // Using <htmlfragment> will generate a warning, but so will bad HTML
61 // (and by this point, bad HTML is what we've got). 61 // (and by this point, bad HTML is what we've got).
62 // We use it (and suppress the warning) because an HTML fragment will 62 // We use it (and suppress the warning) because an HTML fragment will
63 // be wrapped around <html><body> tags which we don't really want to keep. 63 // be wrapped around <html><body> tags which we don't really want to keep.
64 // Note: despite the warning, if loadHTML succeeds it will return true. 64 // Note: despite the warning, if loadHTML succeeds it will return true.
65 $result = @$f->loadHTML('<htmlfragment>'.$value.'</htmlfragment>'); 65 $result = @$f->loadHTML('<htmlfragment>'.$value.'</htmlfragment>');
@@ -86,7 +86,7 @@ class JSLikeHTMLElement extends DOMElement
86 * @code 86 * @code
87 * $string = $div->innerHTML; 87 * $string = $div->innerHTML;
88 * @endcode 88 * @endcode
89 */ 89 */
90 public function __get($name) 90 public function __get($name)
91 { 91 {
92 if ($name == 'innerHTML') { 92 if ($name == 'innerHTML') {