diff --git a/property_test.go b/property_test.go index 2dd52b4..d6355a4 100644 --- a/property_test.go +++ b/property_test.go @@ -61,3 +61,16 @@ func TestHtml(t *testing.T) { } } } + +func TestNbsp(t *testing.T) { + src := `
Some text
` + d, err := NewDocumentFromReader(strings.NewReader(src)) + if err != nil { + t.Fatal(err) + } + txt := d.Find("p").Text() + ix := strings.Index(txt, "\u00a0") + if ix != 4 { + t.Errorf("expected a non-breaking space at index 4, got %d", ix) + } +} diff --git a/traversal.go b/traversal.go index f8d919e..8fbeddf 100644 --- a/traversal.go +++ b/traversal.go @@ -492,8 +492,6 @@ func getChildrenWithSiblingType(parent *html.Node, st siblingType, skipNode *htm // Not a valid node, try again from this one cur = ret } - // For Go 1.0 compatibility - panic("Unreachable code reached.") } for c := iter(nil); c != nil; c = iter(c) {