Skip to content

Non-elements between adjacent and general sibling combinators should be skipped #3

@wooorm

Description

@wooorm
Member

This does not work:

    st.deepEqual(
      select(
        'h1 + p',
        u('root', [
          u('text', '\n'),
          h('p', 'Alpha'),
          u('text', '\n'),
          h('h1', 'Bravo'),
          u('text', '\n'),
          h('p', 'Charlie'),
          u('text', '\n'),
          h('p', 'Delta'),
          u('text', '\n'),
          h('div', [h('p', 'Echo')])
        ])
      ),
      h('p', 'Charlie'),
      'should return adjacent sibling (whitespace)'
    )

It does work if there is no inter-element whitespace.

Affects +, but probably also ~ and >

Activity

wooorm

wooorm commented on Feb 27, 2020

@wooorm
MemberAuthor

To clarify, all non-element siblings are skipped:

<style>
  #a a + b {
    color: red;
  }
  #b a ~ b {
    color: red;
  }
</style>
<div id=a>
  <a>Lorem</a> ipsum <b>dolor</b> sit <i>amet</i> sed <b>do</b> eiusmod <i>tempor</i>.
</div>
<div id=b>
  <a>Lorem</a> ipsum <b>dolor</b> sit <i>amet</i> sed <b>do</b> eiusmod <i>tempor</i>.
</div>

Screenshot 2020-02-27 at 2 29 09 pm

changed the title [-]Inter-element whitespace fails[/-] [+]Non-elements between adjacent and general sibling combinators should be skipped[/+] on Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wooorm

        Issue actions

          Non-elements between adjacent and general sibling combinators should be skipped · Issue #3 · syntax-tree/hast-util-select