Skip to content

<noscript> causes selector to fail #139

@nathan-osman

Description

@nathan-osman

Consider the following program:

package main

import (
	"fmt"
	"strings"

	"github.com/PuerkitoBio/goquery"
)

const data = `<noscript><a href="http://example.org">click this link</a></noscript>`

func main() {
	d, err := goquery.NewDocumentFromReader(strings.NewReader(data))
	if err != nil {
		fmt.Println(err)
		return
	}
	a, ok := d.Find("noscript a").Attr("href")
	fmt.Printf("URL: '%s', %t\n", a, ok)
}

The expected output is:

URL: 'http://example.org', true

But instead the output is:

URL: '', false

Changing noscript to div in both the document and selector causes the expected output, so the problem seems to affect only <noscript> elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions