{"_id":"classlist","_rev":"9-f12b41ed435d1b21f6afe7fff2c355df","name":"classlist","description":"Element#classList for older browsers.","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"classlist","version":"1.0.0","description":"Not really an Element#classList polyfill.","main":"classlist.js","scripts":{"test":"browserify test/spec.js | testling","build":"browserify -s ClassList classlist.js -o classlist.min.js"},"repository":{"type":"git","url":"https://github.com/lucthev/classlist.git"},"keywords":["classlist","element","class","browser"],"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lucthev/classlist/issues"},"homepage":"https://github.com/lucthev/classlist","dependencies":{"component-indexof":"0.0.3","trim":"0.0.1"},"devDependencies":{"browserify":"~7.0.0","tape":"~3.0.3","testling":"~1.7.1"},"testling":{"files":"test/*.js","browsers":["ie/6..latest","chrome/28..latest","firefox/22..latest","safari/5..latest","opera/11.0..latest"]},"gitHead":"ceef0b3fb507488df2f0864aad022278bee4eb67","_id":"classlist@1.0.0","_shasum":"a7290434dc14ce2098f5eb421ff826350414b54f","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.31","_npmUser":{"name":"lucthev","email":"lucthevenard@gmail.com"},"maintainers":[{"name":"lucthev","email":"lucthevenard@gmail.com"}],"dist":{"shasum":"a7290434dc14ce2098f5eb421ff826350414b54f","tarball":"https://registry.npmjs.org/classlist/-/classlist-1.0.0.tgz","integrity":"sha512-we/msedbxAtru/9E5/fGhgsCs2o2gGLWoedDeUbz3SkiMzoqmvEN7c1RpwC7j7ih3SWY9ilKEMC0w1GUCWVReQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGUEhWAD7p8dJDIwjFqGONA02ur061fyCLGF2kxDRb8bAiAI+MSC8EtJNPFITfsZDr/f1wIMJ8eNQbSUy6Z2Wey+Xw=="}]},"directories":{}},"1.0.1":{"name":"classlist","version":"1.0.1","description":"Not really an Element#classList polyfill.","main":"classlist.js","scripts":{"test":"browserify test/spec.js | testling","build":"browserify -s ClassList classlist.js -o classlist.min.js"},"repository":{"type":"git","url":"https://github.com/lucthev/classlist.git"},"keywords":["classlist","element","class","browser"],"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lucthev/classlist/issues"},"homepage":"https://github.com/lucthev/classlist","dependencies":{"component-indexof":"0.0.3","trim":"0.0.1"},"devDependencies":{"browserify":"~7.0.0","tape":"~3.0.3","testling":"~1.7.1"},"gitHead":"153a2629e3c0b1d649c9175123c588ccaab4ce0c","_id":"classlist@1.0.1","_shasum":"53e1cdf85d5f720eccbcb8805cbeb67ed8df0085","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.31","_npmUser":{"name":"lucthev","email":"lucthevenard@gmail.com"},"maintainers":[{"name":"lucthev","email":"lucthevenard@gmail.com"}],"dist":{"shasum":"53e1cdf85d5f720eccbcb8805cbeb67ed8df0085","tarball":"https://registry.npmjs.org/classlist/-/classlist-1.0.1.tgz","integrity":"sha512-3oDXnn9Z/Ijkrz/96jw86G9TioXrByISxO+FzqOA8Du7p2AE0VnaDSwPw0dN9m2ajU0aiaUdepOhGjifM3PvOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKR8BSCw26oKnfMy4lpjlK1NRdltsGxHRBmg0H+4rQHAIhAM6CletzSVeuqmxmXSgtaew9SevEuKzdNXZucoqzEO1J"}]},"directories":{}},"2.0.0":{"name":"classlist","version":"2.0.0","description":"Element#classList for older browsers.","main":"classlist.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git+https://github.com/lucthev/classlist.git"},"keywords":["classlist","element","class","list","ie8","ie9","polyfill"],"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/lucthev/classlist/issues"},"homepage":"https://github.com/lucthev/classlist","devDependencies":{"browserify":"^16.2.0","tape":"^4.9.0","standard":"^11.0.1"},"gitHead":"115c5b6ee7e9e0bad8e3f45019bb34501cf5faa4","_id":"classlist@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"lucthev","email":"lucthevenard@gmail.com"},"dist":{"integrity":"sha512-u8w9pd3kGZsy2M2NkN01lZA/ykQi0AkopSgQN9Un+7gvieggGzyR5G+19ggedCLLQ5D/eIo/FrP+1b8f7lp04Q==","shasum":"b471a215123ee1cdc2ce11ba3ca8e090af7c9a86","tarball":"https://registry.npmjs.org/classlist/-/classlist-2.0.0.tgz","fileCount":10,"unpackedSize":12048,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa7QWECRA9TVsSAnZWagAALNYP/3oZr2YDMNafLsS5yeZI\nFihfHeUaG9GzgJ4jvExeDbFzLBreOcNKX5rNmWfLifcH+A51t+zf+BFculNN\nOBOmCL2xzrjfV8T8/xvm/9gBE0SFB1cAXkUFoxuG78siz//st7NP/oInaqc9\nNjwm+sCNpQqiD+REiFRwkcZXpzYHFFQ9lfYkcqp701Wq0cFllDdbsjNyZ0yv\nxgs+i/WjP5PKvKEifoMOJar9TT8YDDxaHsTFMhhLwcUD+Hi+dqqeIZ3u8Qhw\nPwkY1BY2JOaG3qf4CjdU0oNAii5IhpLQZGVQV29ZnR8kMgjkJ/yLwWuxvLBC\nTDeE/LOsRyfw5M4PaFd8NbnQKsvZZtSPFjUoP8/8NO8vRpriZ4v2hnzhDSJs\nCTj0i6c6z/54Lk9t6wVlBzRprwhcNhibYkRApufAixEJfhS46Wh7QFrHj7Fg\n/zv/vGr6a9+m91VYSY672gOqeXS8/m9pkliB6b7AIOw4fPHgodYITbX6Q31Q\nC/25gxcjWdkS83WBS+sQ0uu57xH27EuP9HQSqqTvpz7K9++XFuWvYMQnDas7\nKg18z6D4E+5xjWtH1kMbBqpePcFWZHVlJCq1nE0O4rhWW5BcgeECd1Cu2lQR\nbjgVrSteiSIVh7XDzpA3W6T5xSgVnHaEc8JSLpps+r3JVLCAQPG3zlx/9VLG\n3hbc\r\n=QA1M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDN5muZqgLpHmEZbX+frCCM4HbXEYx3Uzv254KoCukxcAIhAMYOLri8juQjrvE/l1HM10/2FR8evhLRCYtAH77iggNK"}]},"maintainers":[{"name":"lucthev","email":"lucthevenard@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/classlist_2.0.0_1525482883255_0.4507637764866539"},"_hasShrinkwrap":false}},"readme":"# ClassList\n\nThis module aims to match the behaviour of [`Element#classList`][classlist], without polyfilling it.\n\nIE9 doesn't have the native `classList`, and other browsers have incomplete implementations. This module tries to bridge the gaps.\n\n## Installation\n\n`npm install classlist` (or `yarn add classlist`)\n\n## Usage\n\nThis module is intended for use in the browser via a module bundler such as [Webpack][webpack] or [Browserify][browserify]. Sample usage:\n\n```js\nvar classList = require('classlist')\n\nvar element = document.querySelector('#id')\nvar list = classList(element)\n\n// Add a class:\nlist.add('foo')\n\n// Remove a class:\nlist.remove('bar')\n\n// Toggle a class:\nlist.toggle('baz')\n\n// Replace class 'foo' with 'bar'\nlist.replace('foo', 'bar')\n\n// Check if the element has a class:\nif (list.contains('bar')) {\n    console.log('Element has class bar')\n}\n```\n\n## API\n\nThis module tries to follow the [native API][classlist] as closely as possible.\n\n- `list = new ClassList(element)`\n\n    Constructor. Create a new `ClassList` object. `new` is optional.\n\n    ```js\n    // Object style, \"new\"\n    var ClassList = require('classlist')\n    var list = new ClassList(element)\n\n    // Function style, no \"new\"\n    var classList = require('classlist')\n    var list = classList(element)\n    ```\n\n- `list.item(index)` or `list[index]`\n\n    Returns the class at the given `index`. Example:\n\n    ```js\n      var div = document.createElement('div')\n      div.className = 'a b'\n      var list = classList(div)\n      list.item(0)  // 'a'\n      list[1]       // 'b'\n    ```\n\n- `list.contains(class)`\n\n    Returns true if the element has the given class; false otherwise.\n\n- `list.add(class1 [, class2 [, ... ]])`\n\n    Adds one or more classes to the element associated with `list`. If the class is already present on the element, it is not added again.\n\n- `list.remove(class1 [, class2 [, ... ]])`\n\n    Removes one or more classes from the element, if present.\n\n- `list.toggle(class [, force ])`\n\n    Toggles the given class; removes the class if it is present, or adds the class if it is not present.\n\n    When `force` is true, the class is always added (i.e. it is equivalent to calling `add`). When `force` is false, the class is always removed (i.e. it is equivalent to calling `remove`). This can be useful when conditioning on an outcome; for example,\n\n    ```js\n      list.toggle('not_empty', counter > 0)\n\n      // is equivalent to:\n      if (counter > 0) {\n        list.add('not_empty')\n      } else {\n        list.remove('not_empty')\n      }\n    ```\n\n    Returns `true` if the class is now present, or `false` otherwise.\n\n- `list.replace(oldClass, newClass)`\n\n    If `oldClass` is present on the element, it is replaced by `newClass`. If `oldClass` is not present, this method has no effect.\n\n    Returns `true` if the class was replaced, `false` otherwise.\n\n## Browser support\n\nThis module has been tested for compatibility with IE8+, and may work in even older browsers. If it doesn't, [open an issue](https://github.com/lucthev/classlist/issues/new).\n\n## License\n\nMIT\n\n[classlist]: https://developer.mozilla.org/docs/Web/API/Element/classList\n[browserify]: http://browserify.org/\n[webpack]: https://webpack.github.io/\n[npm]: https://www.npmjs.com/\n","maintainers":[{"name":"lucthev","email":"lucthevenard@gmail.com"}],"time":{"modified":"2022-06-13T06:06:09.295Z","created":"2014-12-13T18:52:15.652Z","1.0.0":"2014-12-13T18:52:15.652Z","1.0.1":"2014-12-13T19:20:20.741Z","2.0.0":"2018-05-05T01:14:43.313Z"},"homepage":"https://github.com/lucthev/classlist","keywords":["classlist","element","class","list","ie8","ie9","polyfill"],"repository":{"type":"git","url":"git+https://github.com/lucthev/classlist.git"},"author":{"name":"Luc Thevenard","email":"lucthevenard@gmail.com"},"bugs":{"url":"https://github.com/lucthev/classlist/issues"},"license":"MIT","readmeFilename":"README.md","users":{"zuojiang":true}}