GithubHelp home page GithubHelp logo

element-class's Introduction

element-class

like .addClass, .removeClass .toggleClass and .hasClass from jquery but without dependencies

testling badge

npm install element-class
var elementClass = require('element-class')

// get an element
var foo = document.querySelector('.foo')

// remove a class
elementClass(foo).remove('foo')

// add a class
elementClass(foo).add('foo')

// toggle a class
elementClass(foo).toggle('foo')

// check if element has a class
elementClass(foo).has('foo')

license

BSD

element-class's People

Contributors

bjoerge avatar davidtheclark avatar kesla avatar max-mapper avatar okdistribute avatar terinjokes avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

element-class's Issues

No license file

The README indicates BSD licensing, but that usually requires copyright attribution. Could you add a proper LICENSE file with an appropriate Copyright line so correct attribution can be given? Also, the package.json indicates ISC license which disagrees with the README.
Thanks!

Removing Multiple Classes

Hi,

I've been playing around with the library today and everything seems great so far. However I've hit a slight weirdness that I wonder if you can help with!

I noticed in the source that you should be able to add/remove multiple classes if they're separated via a space.

e.g the example I'm using resembles something like

classes('body').add('overflow-hidden height-100vh')

which works absolutely fine and I end up with

home

However when I try remove them with

classes('body').remove('overflow-hidden height-100vh')

It doesn't do anything at all.

If i do

classes('body').remove('height-100vh')
classes('body').remove('overflow-hidden')

It works as expected.

Do you have any ideas what could be the issue here?

Thanks

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.