Home > Article > Web Front-end > NextSibling in javascript uses trap (keng)_javascript skills
I encountered a trap (keng) when writing js today
About HTML/XML nodes
It is said that nextSibling will not return text nodes in IE, but Chrome or Firefox will return text nodes...
This has brought about very serious problems in my work
I found many processing methods on the Internet, all of which add various packages to js Function...
Later I found out that there is a nextElementSibling method...
This will not return text nodes, no matter what browser it is...
What a big pitfall
Similarly, there is a corresponding firstElementChild for fistChild. Other functions that select nodes should also have corresponding Element methods, but I haven’t tried it yet...
Then I suddenly found fistChildElement()... ⊙﹏⊙bhan, I guess this is in c …