GithubHelp home page GithubHelp logo

matches-selector's Introduction

matches-selector

Check if an element matches a given selector.

Installation

$ component install component/matches-selector

Example

var matches = require('matches-selector');
matches(el, 'ul li a');
// => true

License

MIT

matches-selector's People

Contributors

antialias avatar henrikjoreteg avatar jonathanong avatar manuelstofer avatar ockham avatar rauchg avatar tj avatar tootallnate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

matches-selector's Issues

matches-selector published to npm (at least) 3 times

@visionmedia @azer @ForbesLindesay can we sort out this madness please?

component/matches-selector is now published on npm in 3 different variants:

  • matches-dom-selector
  • matches-selector
  • matches-selector-2

From these 3 repos:

They're all (mostly) the same damn code.

Now I'm sure this happened because everyone needed a solution asap, I'm not suggesting anyone screwed up, but can we take a moment to detangle?

Ideal solution (please guys):

azer:

  1. unpublish matches-dom-selector

ForbesLindesay:

  1. unpublish matches-selector

visionmedia:

  1. Unpublish matches-selector-2
  2. Add the package.json from matches-selector-2 to component/matches-selector
  3. Rename name 'matches-selector-2' in package.json:
  4. republish to npm under matches-selector name
  5. Consider adding @ForbesLindesay & @azer as collaborators on component/matches-selector to maintain the package.json for browserify/npm compatibility.

Reasonable request?

Element is not defined

Hi there,

Thanks for your work on matches-selector.

When testing some of our React Component that depends on matches-selector, we got the following exception:

> mocha --compilers js:babel-core/register --timeout 10000 app/assets/javascripts/tests/**/**.spec.js app/assets/javascripts/tests/**/**/**.spec.js


/Users/olivier/Documents/sources/outfit_repos/outfit/node_modules/matches-selector/index.js:3
var proto = Element.prototype;
            ^
ReferenceError: Element is not defined
    at Object.<anonymous> (/Users/olivier/Documents/sources/outfit_repos/outfit/node_modules/matches-selector/index.js:3:13)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/olivier/Documents/sources/outfit_repos/outfit/node_modules/babel-core/lib/api/register/node.js:214:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

The only code I need to write to get this error is:

import matches from 'matches-selector';

It would be awesome if requiring this module on Node land would not raise any exception, same way it is possible to require jQuery (which is also meant for browser environment) without generating exceptions.

Thanks for your feedback guys!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.