diff --git a/README.md b/README.md
index c395af4..25668cb 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,12 @@
# CSS selectors in Go
+This library is a fork of [github.com/ericchiang/css](https://github.com/ericchiang/css) fixing issues experienced using [Gost-DOM](https://github.com/gost-dom/browser).
+
+Note. This fork starts at version 0.1.0, as I imagine adding significant chagnes
+to the public API, allowing it consume an interface; rather than the specific golang.org/x/net/html
+
+---
+
[](https://pkg.go.dev/github.com/ericchiang/css)
This package implements a CSS selector compiler for Go's HTML parsing package golang.org/x/net/html.
diff --git a/css.go b/css.go
index d84ad49..82401d8 100644
--- a/css.go
+++ b/css.go
@@ -753,7 +753,7 @@ func (c *compiler) typeSelector(s *typeSelector) *typeSelectorMatcher {
if s.value == "*" {
m.allAtoms = true
} else {
- a := atom.Lookup([]byte(s.value))
+ a := atom.Lookup([]byte(strings.ToLower(s.value)))
if a == 0 {
if c.errorf(s.pos, "unrecognized node name: %s", s.value) {
return nil
diff --git a/css_test.go b/css_test.go
index 4de7ea1..9e84025 100644
--- a/css_test.go
+++ b/css_test.go
@@ -99,6 +99,11 @@ type selectorTest struct {
}
var selectorTests = []selectorTest{
+ {
+ "A",
+ `
`,
+ []string{``},
+ },
{
"a",
`
`,
@@ -333,7 +338,7 @@ var selectorTests = []selectorTest{
},
},
{
- "body p em", // https://github.com/ericchiang/css/issues/7
+ "body p em", // https://github.com/gost-dom/css/issues/7
`
@@ -801,7 +806,13 @@ func TestSelector(t *testing.T) {
got = append(got, b.String())
}
if diff := cmp.Diff(test.want, got); diff != "" {
- t.Errorf("Selecting %q (%s) from %s returned diff (-want, +got): %s", test.sel, s, in, diff)
+ t.Errorf(
+ "Selecting %q (%s) from %s returned diff (-want, +got): %s",
+ test.sel,
+ s,
+ in,
+ diff,
+ )
}
}
}
@@ -821,11 +832,21 @@ func TestBadSelector(t *testing.T) {
}
var perr *ParseError
if !errors.As(err, &perr) {
- t.Errorf("Expected parsing %s to return error of type *ParseError, got %T: %v", test.sel, err, err)
+ t.Errorf(
+ "Expected parsing %s to return error of type *ParseError, got %T: %v",
+ test.sel,
+ err,
+ err,
+ )
continue
}
if test.pos != perr.Pos {
- t.Errorf("Parsing %s returned unexpected position, got=%d, want=%d", test.sel, perr.Pos, test.pos)
+ t.Errorf(
+ "Parsing %s returned unexpected position, got=%d, want=%d",
+ test.sel,
+ perr.Pos,
+ test.pos,
+ )
}
}
}
diff --git a/go.mod b/go.mod
index c4242b3..56bc534 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/ericchiang/css
+module github.com/gost-dom/css
go 1.15