Skip to content

Commit a145d42

Browse files
committed
Merge pull request #52 from wjdp/fix/40
2 parents 01148bb + 13ee666 commit a145d42

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

htmltest/check-link.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func (hT *HTMLTest) checkLink(document *htmldoc.Document, node *html.Node) {
2828
document.State.FaviconPresent = true
2929
}
3030

31+
// Ignore if rel=dns-prefetch, see #40. If we have more cases like this a hashable type should be created and
32+
// checked against.
33+
if attrs["rel"] == "dns-prefetch" {
34+
return
35+
}
36+
3137
// Create reference
3238
ref := htmldoc.NewReference(document, node, attrs["href"])
3339

htmltest/check-link_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ func TestLinkHrefBrokenCanonicalOption(t *testing.T) {
438438
tExpectIssueCount(t, hT, 1)
439439
}
440440

441+
func TestLinkRelDnsPrefetch(t *testing.T) {
442+
// ignores links with rel="dns-prefetch"
443+
hT := tTestFile("fixtures/links/link-rel-dns-prefetch.html")
444+
tExpectIssueCount(t, hT, 0)
445+
}
446+
441447
func TestAnchorPre(t *testing.T) {
442448
// works for broken anchors within pre & code
443449
hT := tTestFile("fixtures/links/anchors_in_pre.html")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html lang="en">
2+
<head>
3+
<link rel="dns-prefetch" href="//fonts.googleapis.com/">
4+
</head>
5+
<body>
6+
<p>This page has a hint asking the browser to prefetch the DNS query for fonts.googleapis.com</p>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)