Skip to content

andSelf() adds 'self' element to end of stack, instead of document order #95

Open
@erilot

Description

@erilot

In jQuery, the addSelf() method puts the 'self' element into the stack in document order; in QueryPath, it seems to be adding it to the end. Example:

  <p class="class-1">This is first</p>
  <p class="class-2">This is second</p>
  <p class="class-3">This is third</p>
  <p class="class-4">This is last</p>

in jQuery, $('.class-1').nextUntil('.class-4').andSelf().wrapAll('<div class="NewWrapper"/>') gives me

  <div class="NewWrapper">
    <p class="class-1">This is first</p>
    <p class="class-2">This is second</p>
    <p class="class-3">This is third</p>
  </div>
  <p class="class-4">This is last</p>

in QueryPath, the equivalent $qp->find('.class-1')->nextUntil('.class-4')->andSelf()->wrapAll('<div class="NewWrapper"/>') returns

  <div class="NewWrapper">
    <p class="class-2">This is second</p>
    <p class="class-3">This is third</p>
    <p class="class-1">This is first</p>
  </div>
  <p class="class-4">This is last</p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions