Skip to content

textNode not passed into .filter methodΒ #1867

@jeroentvb

Description

@jeroentvb

The .filter(function) method only gets DOM elements passed in, while .each(function) gets all DOM nodes, including text nodes. This used to work in RC-5, but doesn't in RC-9. And as far as I could tell, this isn't expected behaviour, because I wasn't able to find info indicating that it is in the jQuery docs.

Consider the following html snippet:

<body>
    <div style="color: black;">Hello</div>
    world
    <small>!</small>
</body>

If I were to select the body and .filter its contents, I won't get the world text node in my filter loop. Whereas I will get the world text node in my loop if I use .each on the contents of the body.

I've created a repo demonstrating my findings.

Edit: just checked, it also used to work with RC-6. That means it stopped working with the RC-9 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions