How to use the sizzle.matches function in sizzle

To help you get started, we’ve selected a few sizzle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keen / keen-tracking.js / lib / browser-events.js View on Github external
function handleEvent(e){
    var evt, target, match;

    evt = e ? e : window.event;
    // target = (evt.currentTarget) ? evt.currentTarget : (evt.srcElement || evt.target);

    match = Sizzle.matches(selector, [evt.target]);
    // https://github.com/jquery/sizzle/wiki

    if (match.length) {

      if ('click' === action && 'A' === evt.target.nodeName) {
        return handleClickEvent(evt, evt.target, callback);
      }
      else if ('submit' === action && 'FORM' === evt.target.nodeName) {
        return handleFormSubmit(evt, evt.target, callback);
      }
      else {
        callback(evt);
      }

    }
    else if ('window' === selector) {
github kissyteam / kissy / build / dom.js View on Github external
return clsRe && tagRe;
                    }
                } else if (id && !tag && !cls) {
                    filter = function(elem) {
                        return elem.id === id;
                    };
                }
            }

            if (S.isFunction(filter)) {
                ret = S.filter(elems, filter);
            }
            // 其它复杂 filter, 采用外部选择器
            else if (filter && sizzle) {
                ret = sizzle.matches(filter, elems);
            }
            // filter 为空或不支持的 selector
            else {
                error(filter);
            }

            return ret;
        },

sizzle

A pure-JavaScript, bottom-up CSS selector engine designed to be easily dropped in to a host library.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis