File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
src/Html2OpenXml/Expressions Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ private void MarkAllBookmarks()
105
105
var links = node . QuerySelectorAll ( "a[href^='#']" ) ;
106
106
if ( links . Length == 0 ) return ;
107
107
108
- foreach ( var link in links . Cast < IHtmlAnchorElement > ( ) )
108
+ foreach ( var link in links . Cast < IHtmlAnchorElement > ( ) . Where ( l => l . Hash . Length > 0 ) )
109
109
{
110
110
var id = link . Hash . Substring ( 1 ) ;
111
111
var target = node . Owner ! . GetElementById ( id ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ public void ExternalLink_ShouldSucceed (string link)
38
38
39
39
[ TestCase ( @"<a href=""javascript:alert()"">Js</a>" ) ]
40
40
[ TestCase ( @"<a href=""site.com"">Unknown site</a>" ) ]
41
+ [ TestCase ( @"<a href=''>Empty link</a>" ) ]
42
+ [ TestCase ( @"<a href='#'>Empty bookmark</a>" ) ]
41
43
public void InvalidLink_ReturnsSimpleRun ( string html )
42
44
{
43
45
// invalid link leads to simple Run with no link
You can’t perform that action at this time.
0 commit comments