func addElement(elems []string, u *url.URL, n *html.Node, attr string) []string {
    if val := findAttribute(n, attr); val != "" {
        if strings.HasPrefix(val, "//") {
            val = u.Scheme + ":" + val
        } else if strings.HasPrefix(val, "/") || strings.HasPrefix(val, "#") {
            val = u.Scheme + "://" + u.Host + val
        } else if !hasProtocolAsPrefix(val) {
            val = u.Scheme + "://" + u.Host + "/" + val
        }

        elems = append(elems, val)
    }
    return elems
}
// addElement adds a string to a given string slice if matches the
// given attribute within the given Node.
// If starts with slash or hashmeans that is a external element, so is appended to
// the root URL
// If it doesn't fit the previous case and it does not have a protocol prefix,
// then it is appended to the root URL as well
addElement adds a string to a given string slice if matches the
given attribute within the given Node.
If starts with slash or hashmeans that is a external element, so is appended to
the root URL
If it doesn't fit the previous case and it does not have a protocol prefix,
then it is appended to the root URL as well
// addElement adds a string to a given string slice if matches the // given attribute within the given Node . // If starts with slash or hashmeans that is a external element so is appended to // the root URL // If it doesn ' t fit the previous case and it does not have a protocol prefix // then it is appended to the root URL as well
func addElement(elems []string, u *url.URL, n *html.Node, attr string) []string {
    if val := findAttribute(n, attr); val != "" {
        if strings.HasPrefix(val, "//") {
            val = u.Scheme + ":" + val
        } else if strings.HasPrefix(val, "/") || strings.HasPrefix(val, "#") {
            val = u.Scheme + "://" + u.Host + val
        } else if !hasProtocolAsPrefix(val) {
            val = u.Scheme + "://" + u.Host + "/" + val
        }
        elems = append(elems, val)
    }
    return elems
}
func addElement ( elems [ ] string , u * url . URL , n * html . Node , attr string ) [ ] string { if val := findAttribute ( n , attr ) ; val != " " { if strings . HasPrefix ( val , " " ) { val = u . Scheme + " " + val } else if strings . HasPrefix ( val , " " ) || strings . HasPrefix ( val , " " ) { val = u . Scheme + " " + u . Host + val } else if ! hasProtocolAsPrefix ( val ) { val = u . Scheme + " " + u . Host + " " + val } elems = append ( elems , val ) } return elems }
addElement adds a string to a given string slice if matches the
given attribute within the given Node.
addElement adds a string to a given string slice if matches the given attribute within the given Node .