Bug Tracker

Opened 7 years ago

Closed 6 years ago

#13141 closed bug (invalid)

customizing slectors

Reported by: lepelerin@… Owned by: lepelerin@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:


dear support,

The very simple script below does not give same result !! expected result: only even divs have orange background. obtained result: all divs have orange background. workaround: using jQuery-1.7.1.js solves the issue. test env: Windows 8, IE10 and Chrome.

thanks and best regards,


(function ($) {

$.expr:?.myEven = function(elem,idx,meta,items){

return (idx % 2 === 0);



$(document).ready(function () { $('div:myEven').css('background-color', 'orange'); });


<h1> Custom selector </h1> <div> Div01 </div> <div> Div02 </div> <div> Div03 </div> <div> Div04 </div> <div> Div05 </div> <div> Div06 </div> <div> Div07 </div> <div> Div08 </div> <div> Div09 </div> <div> Div10 </div>

Change History (3)

comment:1 Changed 7 years ago by anonymous

They changed Sizzle. The new syntax is:

(function ($) {
    // Both functions need to be marked as a pseudo, otherwise you don't have access to the indexes
    $.expr.pseudos.myEven = $.expr.createPseudo(function() {
        return $.expr.createPseudo(function(input, output){
            for(var i = 0; i < input.length; i += 2) {

comment:2 Changed 7 years ago by dmethvin

Owner: set to lepelerin@…
Status: newpending

Please provide a a test case in jsfiddle.net.


Resolution: invalid
Status: pendingclosed


Note: See TracTickets for help on using tickets.