lib/kissy/5.0.0-alpha.3/lib/build/dom/selector.js
function matchImmediate(el, match) {
        var matched = 1, startEl = el, relativeOp, startMatch = match;
        do {
            matched &= singleMatch(el, match);
            if (matched) {
                // advance
                match = match && match.prev;
                if (!match) {
                    return true;
                }
                relativeOp = relativeExpr[match.nextCombinator];
                el = dir(el, relativeOp.dir);
                if (!relativeOp.immediate) {
                    return {
                        // advance for non-immediate
                        el: el,
                        match: match
                    };
                }
            } else {
                relativeOp = relativeExpr[match.nextCombinator];
                if (relativeOp.immediate) {
                    // retreat but advance startEl
                    return {
                        el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
                        match: startMatch
                    };
                } else {
                    // advance (before immediate match + jump unmatched)
                    return {
                        el: el && dir(el, relativeOp.dir),
                        match: match
                    };
                }
            }
        } while (el);    // only occur when match immediate
        // only occur when match immediate
        return {
            el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
            match: startMatch
        };
    }
function matchImmediate(el, match) {
        var matched = 1, startEl = el, relativeOp, startMatch = match;
        do {
            matched &= singleMatch(el, match);
            if (matched) {
                // advance
                match = match && match.prev;
                if (!match) {
                    return true;
                }
                relativeOp = relativeExpr[match.nextCombinator];
                el = dir(el, relativeOp.dir);
                if (!relativeOp.immediate) {
                    return {
                        // advance for non-immediate
                        el: el,
                        match: match
                    };
                }
            } else {
                relativeOp = relativeExpr[match.nextCombinator];
                if (relativeOp.immediate) {
                    // retreat but advance startEl
                    return {
                        el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
                        match: startMatch
                    };
                } else {
                    // advance (before immediate match + jump unmatched)
                    return {
                        el: el && dir(el, relativeOp.dir),
                        match: match
                    };
                }
            }
        } while (el);    // only occur when match immediate
        // only occur when match immediate
        return {
            el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
            match: startMatch
        };
    }
function matchImmediate ( el , match ) { var matched = 1 , startEl = el , relativeOp , startMatch = match ; do { matched &= singleMatch ( el , match ) ; if ( matched ) { // advance match = match && match . prev ; if ( ! match ) { return true ; } relativeOp = relativeExpr [ match . nextCombinator ] ; el = dir ( el , relativeOp . dir ) ; if ( ! relativeOp . immediate ) { return { // advance for non-immediate el : el , match : match } ; } } else { relativeOp = relativeExpr [ match . nextCombinator ] ; if ( relativeOp . immediate ) { // retreat but advance startEl return { el : dir ( startEl , relativeExpr [ startMatch . nextCombinator ] . dir ) , match : startMatch } ; } else { // advance (before immediate match + jump unmatched) return { el : el && dir ( el , relativeOp . dir ) , match : match } ; } } } while ( el ) ; // only occur when match immediate // only occur when match immediate return { el : dir ( startEl , relativeExpr [ startMatch . nextCombinator ] . dir ) , match : startMatch } ; }
match by adjacent immediate single selector match match by adjacent immediate single selector match
match by adjacent immediate single selector match match by adjacent immediate single selector match