shithub: mycel

Download patch

ref: b909983f2fb87c116fc225b34eb19909275862a6
parent: 62b73b4e51b6d2db873956a9df9671e9cc2116c4
author: Philip Silva <philip.silva@protonmail.com>
date: Sun Jan 9 13:25:09 EST 2022

ignore non css style tags

--- a/browser/browser_test.go
+++ b/browser/browser_test.go
@@ -126,6 +126,11 @@
 			href:   "info",
 			expect: "https://example.com/info",
 		},
+		item{
+			orig:   "https://example.com",
+			href:   "/path/info",
+			expect: "https://example.com/path/info",
+		},
 	}
 
 	for _, i := range items {
--- a/browser/website.go
+++ b/browser/website.go
@@ -163,7 +163,9 @@
 	inls := ntAll.FindAll("style")
 
 	for _, inl := range inls {
-		inlines = append(inlines, inl.ContentString(true))
+		if t := strings.ToLower(inl.Attr("type")); t == "" || t == "text/css" {
+			inlines = append(inlines, inl.ContentString(true))
+		}
 	}
 	csss = make([]string, 0, len(inlines)+len(cssHrefs))
 	csss = append(csss, style.AddOnCSS)