Giter Club home page Giter Club logo

Comments (4)

anaskhan96 avatar anaskhan96 commented on September 15, 2024 1

Fixed it in the above commit, and renamed them to FindNextElementSibling() and FindPrevElementSibling()
I'll be implementing the actual FindNextSibling() and FindPrevSibling() in the upcoming commits.

from soup.

anaskhan96 avatar anaskhan96 commented on September 15, 2024

Thanks for reporting it. I'll try to fix it as soon as possible.

from soup.

ShevaXu avatar ShevaXu commented on September 15, 2024

I think the fix d325696 does not work because it is r.Pointer.NextSibling might be nil, and calling .NextSibling on it causing the nil pointer dereference crash/panic.

Maybe try this:

func (r Root) FindNextSibling() Node {
	nextSibling := r.Pointer.NextSibling
	if nextSibling == nil {
		log.Fatal("No next sibling found")
	}
	// try to find next element-node?
	if nextSibling.Type == html.ElementNode {
	       return Root{nextSibling}
	} else {
	       // keep looking
	}
}

from soup.

anaskhan96 avatar anaskhan96 commented on September 15, 2024

Ah, I see it now. I'll make the fixes accordingly.

from soup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.