File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ class Dom {
5656 */
5757 protected $ globalOptions = [];
5858
59+ /**
60+ * A persistent option object to be used for all options in the
61+ * parsing of the file.
62+ *
63+ * @var Options
64+ */
65+ protected $ options ;
66+
5967 /**
6068 * A list of tags which will always be self closing
6169 *
Original file line number Diff line number Diff line change @@ -156,4 +156,26 @@ public function testGetElementsByClass()
156156 $ dom ->load ('<div class="all"><p>Hey bro, <a href="google.com" id="78">click here</a></div><br /> ' );
157157 $ this ->assertEquals ('<p>Hey bro, <a href="google.com" id="78">click here</a></p> ' , $ dom ->getElementsByClass ('all ' )[0 ]->innerHtml );
158158 }
159+
160+ public function testConfigGlobalNoWhitespaceTextNode ()
161+ {
162+ $ dom = new Dom ;
163+ $ dom ->setOptions ([
164+ 'whitespaceTextNode ' => false ,
165+ ]);
166+ $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' );
167+ $ this ->assertEquals ('Ya you! ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
168+ }
169+
170+ public function testConfigLocalOverride ()
171+ {
172+ $ dom = new Dom ;
173+ $ dom ->setOptions ([
174+ 'whitespaceTextNode ' => false ,
175+ ]);
176+ $ dom ->load ('<div><p id="hey">Hey you</p> <p id="ya">Ya you!</p></div> ' , [
177+ 'whitespaceTextNode ' => true ,
178+ ]);
179+ $ this ->assertEquals (' ' , $ dom ->getElementById ('hey ' )->nextSibling ()->text );
180+ }
159181}
You can’t perform that action at this time.
0 commit comments