Skip to content

Fix the css selector #15

@Krugloff

Description

@Krugloff

The ~ selector is not working as expected.

I'm trying to extract only the blocks that appear before the .more-news element. This works in the browser but doesn't behave as expected in my code.

Environment

  • OS: MacOS Ventura 13.5
  • Ruby version: 2.7.8
  • Nokolexbor version: 0.5.4

Additional context

test_string = <<-STR
<div>
<div class="newscard position1"></div>
<div class="newscard position2"></div>
<div class="more-news"></div>
<div class="newscard position3"></div>
<div class="newscard position4"></div>
<div>
STR

require 'nokolexbor'

doc = Nokolexbor::HTML(test_string)
doc.css(".newscard:not(.more-news ~ .newscard)").count # => 4 (should be 2)

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions