{"id":16690606,"url":"https://github.com/jonkemp/style-selector","last_synced_at":"2025-12-30T03:15:23.531Z","repository":{"id":26119830,"uuid":"29564317","full_name":"jonkemp/style-selector","owner":"jonkemp","description":"CSS selector constructor","archived":false,"fork":false,"pushed_at":"2020-10-09T02:00:51.000Z","size":150,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T21:38:56.222Z","etag":null,"topics":["inline-css","slick"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonkemp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-21T01:17:41.000Z","updated_at":"2023-08-24T03:11:08.000Z","dependencies_parsed_at":"2022-08-30T00:12:06.578Z","dependency_job_id":null,"html_url":"https://github.com/jonkemp/style-selector","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonkemp%2Fstyle-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonkemp%2Fstyle-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonkemp%2Fstyle-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonkemp%2Fstyle-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonkemp","download_url":"https://codeload.github.com/jonkemp/style-selector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243475330,"owners_count":20296714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inline-css","slick"],"created_at":"2024-10-12T16:04:29.388Z","updated_at":"2025-12-30T03:15:23.503Z","avatar_url":"https://github.com/jonkemp.png","language":"JavaScript","readme":"# style-selector [![Build Status](https://travis-ci.org/jonkemp/style-selector.svg?branch=master)](https://travis-ci.org/jonkemp/style-selector) [![Coverage Status](https://coveralls.io/repos/jonkemp/style-selector/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/jonkemp/style-selector?branch=master)\n\n[![NPM](https://nodei.co/npm/style-selector.png?downloads=true)](https://nodei.co/npm/style-selector/)\n\n\u003e CSS selector constructor\n\nUses [Slick](https://github.com/subtleGradient/slick) to parse and tokenize the CSS selectors.\n\n## Install\n\nInstall with [npm](https://npmjs.org/package/style-selector)\n\n```\nnpm install --save style-selector\n```\n\n## Usage v2\n\n```js\nvar selector = require('style-selector'),\n    bodySelector = selector('body', [ 0, 0, 0, 1 ]);\n\nconsole.log(bodySelector);                  // { text: 'body', spec: [ 0, 0, 0, 1 ] }\nconsole.log(bodySelector.parsed());         // { '0': { combinator: ' ', tag: 'body' }, length: 1 }\nconsole.log(bodySelector.specificity());    // [ 0, 0, 0, 1 ]\n```\n\n## Usage v1\n\n```js\nvar Selector = require('style-selector'),\n    bodySelector = new Selector('body', [ 0, 0, 0, 1 ]);\n\nconsole.log(bodySelector);                  // { text: 'body', spec: [ 0, 0, 0, 1 ] }\nconsole.log(bodySelector.parsed());         // { '0': { combinator: ' ', tag: 'body' }, length: 1 }\nconsole.log(bodySelector.specificity());    // [ 0, 0, 0, 1 ]\n```\n\n## v2 API\n\n### selector(text, spec)\n\nCSS selector constructor\n\n#### text\n\nType: `String`  \nDefault: `none`\n\nSelector text\n\n#### spec\n\nType: `Array`  \nDefault: `none`\n\nOptional, precalculated specificity\n\n### selector.parsed()\n\nGet parsed selector\n\n### selector.specificity()\n\nLazy specificity getter\n\n## v1 API\n\n### Selector(text, spec)\n\nCSS selector constructor\n\n#### text\n\nType: `String`  \nDefault: `none`\n\nSelector text\n\n#### spec\n\nType: `Array`  \nDefault: `none`\n\nOptional, precalculated specificity\n\n### Selector.prototype.parsed()\n\nGet parsed selector\n\n### Selector.prototype.specificity()\n\nLazy specificity getter\n\n## Credit\n\nThe code for this module was originally taken from the [Juice](https://github.com/Automattic/juice) library.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonkemp%2Fstyle-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonkemp%2Fstyle-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonkemp%2Fstyle-selector/lists"}