Home > Web Front-end > JS Tutorial > body text

NextSibling in javascript uses trap (keng)_javascript skills

WBOY
Release: 2016-05-16 16:50:04
Original
1017 people have browsed it

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 …

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!