Skip to content

Standardize custom pseudo object #2073

@gibson042

Description

@gibson042

cc @timmywil @scottgonzalez

The Sizzle pseudos object is exposed on jQuery.expr as three distinct properties:

  • jQuery.expr.pseudos
  • jQuery.expr.filters
  • jQuery.expr[":"]

Sizzle defines the first two, and jQuery defines the third.

None of them appear in the current jQuery documentation, though Sizzle documents the object as pseudos (and separately documents the related setFilters), and I'm sure we have published instructions on how to define a custom pseudo at least once, which would necessarily reference one of them. We also have internal uses in at least two libraries:

  • core
    • defines jQuery.expr[":"] from jQuery.expr.pseudos
    • defines :hidden, :visible, and :animated by extending jQuery.expr.filters
    • calls jQuery.expr.filters.hidden in the :visible pseudo
  • UI
    • defines :data, :focusable, :tabbable, and widget pseudos by extending $.expr[ ":" ]
    • replaces the :animated filter at $.expr.filters.animated
    • calls $.expr.filters.visible and $.expr.filters.hidden

So now that this issue affects three source repositories and jquery/api.jquery.com, here's the crux of it: can we standardize on one internally and deprecate the others? All things considered, my vote would be on filters.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions