File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1277,8 +1277,8 @@ public function parseRelsAndAlternates() {
12771277 $ rel_attributes ['type ' ] = $ hyperlink ->getAttribute ('type ' );
12781278 }
12791279
1280- if ($ hyperlink ->nodeValue ) {
1281- $ rel_attributes ['text ' ] = $ hyperlink ->nodeValue ;
1280+ if (strlen ( $ hyperlink ->textContent ) > 0 ) {
1281+ $ rel_attributes ['text ' ] = $ hyperlink ->textContent ;
12821282 }
12831283
12841284 if ($ this ->enableAlternates ) {
Original file line number Diff line number Diff line change @@ -209,4 +209,14 @@ public function testRelURLsNoDuplicates() {
209209 $ this ->assertEquals ($ output ['rels ' ]['a ' ], array ('#a ' , '#b ' ));
210210 }
211211
212+ public function testRelURLsFalsyTextVSEmpty () {
213+ $ input = '<a href="#a" rel="a">0</a>
214+ <a href="#b" rel="b"></a> ' ;
215+ $ parser = new Parser ($ input );
216+ $ output = $ parser ->parse ();
217+ $ this ->assertArrayHasKey ('text ' , $ output ['rel-urls ' ]['#a ' ]);
218+ $ this ->assertEquals ($ output ['rel-urls ' ]['#a ' ]['text ' ], '0 ' );
219+ $ this ->assertArrayNotHasKey ('text ' , $ output ['rel-urls ' ]['#b ' ]);
220+ }
221+
212222}
You can’t perform that action at this time.
0 commit comments