File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -544,16 +544,18 @@ protected function parse(): void
544544
545545 // check if it was a closing tag
546546 if ($ info ['closing ' ]) {
547- $ originalNode = $ activeNode ;
547+ $ foundOpeningTag = true ;
548+ $ originalNode = $ activeNode ;
548549 while ($ activeNode ->getTag ()->name () != $ info ['tag ' ]) {
549550 $ activeNode = $ activeNode ->getParent ();
550551 if (is_null ($ activeNode )) {
551552 // we could not find opening tag
552553 $ activeNode = $ originalNode ;
554+ $ foundOpeningTag = false ;
553555 break ;
554556 }
555557 }
556- if ( ! is_null ( $ activeNode ) ) {
558+ if ($ foundOpeningTag ) {
557559 $ activeNode = $ activeNode ->getParent ();
558560 }
559561 continue ;
Original file line number Diff line number Diff line change @@ -294,6 +294,13 @@ public function testScriptCleanerScriptTag()
294294 $ this ->assertEquals ('.... ' , $ dom ->getElementsByTag ('p ' )[1 ]->innerHtml );
295295 }
296296
297+ public function testClosingSpan ()
298+ {
299+ $ dom = new Dom ;
300+ $ dom ->load ("<div class='foo'></span>sometext</div> " );
301+ $ this ->assertEquals ('sometext ' , $ dom ->getElementsByTag ('div ' )[0 ]->innerHtml );
302+ }
303+
297304 public function testMultipleDoubleQuotes ()
298305 {
299306 $ dom = new Dom ;
You can’t perform that action at this time.
0 commit comments