Jsoup div[class=] syntax works whereas div.class syntax doesn't - Why?

For the following HTML snippet:
some inner content
The following Jsoup selector **works**: div[class=class_one class_two class_three classfour classfive classsix] But the equivalent div.class syntax **doesn't** work: div.class_one.class_two.class_three.classfour.classfive.classsix Why? What am I missing? **EDIT**: Based on the feedback I received below, I realize that I failed to explain what "doesn't work" means. This was due to my confusion as to how multiclass selection syntax works. By "not working" I meant that the `.classname` syntax above selects way too many divs than the `class=classname` syntax (with the same exact number of classname and in the same order!) does, because the HTML in question contained additional divs with a 7th class name... It turns out that this is [by design][1]. That's what I was missing, and thanks to @Hovercraft Full Of Eels and @BalusC who helped me discover this. [1]: https://stackoverflow.com/questions/7563421/multiclass-element-selection-clarification/7563453#7563453
That should work. Can you try it with maybe just two classes?

以上就是Jsoup div[class=] syntax works whereas div.class syntax doesn't - Why?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准