Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
Bizarre behavior with :select in .find()

I'm in the process of updating a site that currently uses jQuery 1.3.2 to at least 1.10.2. When I do, the site chokes on commands like this:

this.form.find(':select[name="fieldtype"]');

This shouldn't work - it should be: this.form.find('select[name="fieldtype"]'); - without the colon - but it in fact works.

I've found nothing that suggests ':select...' is valid. Is it possible that the colon was simply ignored in jQ 1.3.2?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

EDIT:

I completely forgot about custom pseudo selectors. If, for legacy purposes you need a newer version of jQuery to treat :select like select, you can do this:

jQuery.extend(jQuery.expr[':'], {
    select: function (el) {
        return jQuery(el).is('select');
    }
});

And now jQuery(':select') and jQuery('select') are equivalent expressions.

Explanation

It appears to be an error with the sizzle css selector engine used by jquery, so that jquery could select dom elements before document.querySelectorAll was a thing (or a widely available thing). jQuery 1.3.2 uses sizzle 0.9.3 (pre version 1!), the next version of jQuery, 1.4.0, uses sizzle 1.0.0, where the bug is not present.

The bug specifically seems to be that proper tags prefixed with a ":" will be interpreted as a tag rather than an invalid pseudo

You can verify sizzle being the culprit:

  • Download jquery 1.3.2 and jquery 1.4
  • Copy the sizzle 1.0.0 block out of 1.4 and replace the sizzle 0.9.3 block in 1.3.2

Your "hybrid 1.3.2" version will now also reject the selector.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda