File tree 2 files changed +8
-1
lines changed
src/Symfony/Component/DomCrawler
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -588,7 +588,7 @@ public function innerText(/* bool $normalizeWhitespace = true */): string
588
588
$ normalizeWhitespace = 1 <= \func_num_args () ? func_get_arg (0 ) : true ;
589
589
590
590
foreach ($ this ->getNode (0 )->childNodes as $ childNode ) {
591
- if (\XML_TEXT_NODE !== $ childNode ->nodeType ) {
591
+ if (\XML_TEXT_NODE !== $ childNode ->nodeType && \ XML_CDATA_SECTION_NODE !== $ childNode -> nodeType ) {
592
592
continue ;
593
593
}
594
594
if (!$ normalizeWhitespace ) {
Original file line number Diff line number Diff line change @@ -377,6 +377,12 @@ public static function provideInnerTextExamples()
377
377
'' ,
378
378
' ' ,
379
379
],
380
+ [
381
+ '//*[@id="complex-elements"]/*[@class="six"] ' ,
382
+ 'console.log("Test JavaScript content"); ' ,
383
+ 'console.log("Test JavaScript content"); ' ,
384
+ ' console.log("Test JavaScript content"); ' ,
385
+ ],
380
386
];
381
387
}
382
388
@@ -1311,6 +1317,7 @@ public function createTestCrawler($uri = null)
1311
1317
<div class="three"> Parent text <span>Child text</span> Parent text </div>
1312
1318
<div class="four"> <span>Child text</span> </div>
1313
1319
<div class="five"><span>Child text</span> <span>Another child</span></div>
1320
+ <script class="six" type="text/javascript"> console.log("Test JavaScript content"); </script>
1314
1321
</div>
1315
1322
</body>
1316
1323
</html>
You can’t perform that action at this time.
0 commit comments