Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!