{"id":37021928,"url":"https://github.com/d3/d3-selection-multi","last_synced_at":"2026-01-14T02:36:39.352Z","repository":{"id":31932598,"uuid":"35502102","full_name":"d3/d3-selection-multi","owner":"d3","description":"Multi-value syntax for d3-selection and d3-transition.","archived":true,"fork":false,"pushed_at":"2019-10-22T14:43:31.000Z","size":35,"stargazers_count":75,"open_issues_count":3,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-11T19:33:53.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d3.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-05-12T17:17:38.000Z","updated_at":"2025-10-14T15:41:25.000Z","dependencies_parsed_at":"2022-09-10T23:41:47.127Z","dependency_job_id":null,"html_url":"https://github.com/d3/d3-selection-multi","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/d3/d3-selection-multi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3%2Fd3-selection-multi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3%2Fd3-selection-multi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3%2Fd3-selection-multi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3%2Fd3-selection-multi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d3","download_url":"https://codeload.github.com/d3/d3-selection-multi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d3%2Fd3-selection-multi/sbom","scorecard":{"id":315699,"data":{"date":"2025-08-11","repo":{"name":"github.com/d3/d3-selection-multi","commit":"eca50ebce40acbd75df342a00322fae89e1dd6e2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.0.1 not signed: https://api.github.com/repos/d3/d3-selection-multi/releases/5517520","Warn: release artifact v1.0.0 not signed: https://api.github.com/repos/d3/d3-selection-multi/releases/3770261","Warn: release artifact v0.4.1 not signed: https://api.github.com/repos/d3/d3-selection-multi/releases/3625668","Warn: release artifact v0.4.0 not signed: https://api.github.com/repos/d3/d3-selection-multi/releases/3546224","Warn: release artifact v0.3.0 not signed: https://api.github.com/repos/d3/d3-selection-multi/releases/3450159","Warn: release artifact v1.0.1 does not have provenance: https://api.github.com/repos/d3/d3-selection-multi/releases/5517520","Warn: release artifact v1.0.0 does not have provenance: https://api.github.com/repos/d3/d3-selection-multi/releases/3770261","Warn: release artifact v0.4.1 does not have provenance: https://api.github.com/repos/d3/d3-selection-multi/releases/3625668","Warn: release artifact v0.4.0 does not have provenance: https://api.github.com/repos/d3/d3-selection-multi/releases/3546224","Warn: release artifact v0.3.0 does not have provenance: https://api.github.com/repos/d3/d3-selection-multi/releases/3450159"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T00:08:17.332Z","repository_id":31932598,"created_at":"2025-08-18T00:08:17.332Z","updated_at":"2025-08-18T00:08:17.332Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T02:36:38.656Z","updated_at":"2026-01-14T02:36:39.345Z","avatar_url":"https://github.com/d3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# d3-selection-multi\n\nThis module adds multi-value syntax to [selections](https://github.com/d3/d3-selection) and [transitions](https://github.com/d3/d3-transition), allowing you to set multiple attributes, styles or properties simultaneously with more concise syntax. For example:\n\n```js\nd3.select(\"body\").append(\"div\")\n    .attrs({\n      title: \"A cheery, timeless greeting.\",\n      class: \"greeting\"\n    })\n    .text(\"Hello, world!\");\n```\n\nThis is equivalent to:\n\n```js\nd3.select(\"body\").append(\"div\")\n    .attr(\"title\", \"A cheery, timeless greeting.\")\n    .attr(\"class\", \"greeting\")\n    .text(\"Hello, world!\");\n```\n\nLike [*selection*.attr](https://github.com/d3/d3-selection#selection_attr), the values in the multi-value object can be functions of data:\n\n```js\nd3.select(\"body\").append(\"div\")\n    .attrs({\n      title: function(d) { return d.title; },\n      id: function(d, i) { return \"id-\" + i; },\n    });\n```\n\nAlternatively, you can pass a function which returns an object, allowing you to share some computational effort across multiple attributes, or to determine which attribute to set dynamically:\n\n```js\nd3.select(\"body\").append(\"div\")\n    .attrs(function(d, i) { return {title: d.title, id: \"id-\" + i}; });\n```\n\nThis module is not included in the [default D3 bundle](https://github.com/d3/d3) for parsimony’s sake: the single-value methods such as [*selection*.attr](https://github.com/d3/d3-selection#selection_attr) are recommended for most users, as there is little benefit to the shorter syntax provided by these convenience method.\n\n## Installing\n\nIf you use NPM, `npm install d3-selection-multi`. Otherwise, download the [latest release](https://github.com/d3/d3-selection-multi/releases/latest) or load directly from [d3js.org](https://d3js.org) as a [standalone library](https://d3js.org/d3-selection-multi.v1.min.js). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported:\n\n```html\n\u003cscript src=\"https://d3js.org/d3-color.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-dispatch.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-ease.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-interpolate.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-selection.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-timer.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-transition.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-selection-multi.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\nvar div = d3.selectAll(\"div\")\n    .attrs({title: \"Hello, world!\"})\n    .styles({\"color\": \"red\"});\n\n\u003c/script\u003e\n```\n\nOr, in combination with the [D3 default bundle](https://github.com/d3/d3):\n\n```html\n\u003cscript src=\"https://d3js.org/d3.v4.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://d3js.org/d3-selection-multi.v1.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\nvar div = d3.selectAll(\"div\")\n    .attrs({title: \"Hello, world!\"})\n    .styles({\"color\": \"red\"});\n\n\u003c/script\u003e\n```\n\n[Try d3-selection-multi in your browser.](https://tonicdev.com/npm/d3-selection-multi)\n\n## API Reference\n\n\u003ca name=\"selection_attrs\" href=\"#selection_attrs\"\u003e#\u003c/a\u003e \u003ci\u003eselection\u003c/i\u003e.\u003cb\u003eattrs\u003c/b\u003e(\u003ci\u003evalues\u003c/i\u003e)\n\nA convenience method on top of [*selection*.attr](https://github.com/d3/d3-selection#selection_attr) for setting multiple attributes. If the specified *values* is an object, the values may be specified either as strings or functions. For example:\n\n```js\nselection.attrs({foo: \"foo-value\", bar: function(d) { return d.bar; }});\n```\n\nIf a value is a constant, all elements are given the same attribute value; otherwise, if a value is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value is then used to set each element’s attribute. A null value will remove the specified attribute.\n\nIf the specified *values* is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value must be an object with string values, which are then used to set attributes on the current element. For example:\n\n```js\nselection.attrs(function(d) { return {foo: \"foo-value\", bar: d.bar}; });\n```\n\nPassing a function to *selection*.attrs is convenient for sharing some computational effort or state across multiple attributes, or for specifying dynamically which attributes to set.\n\n\u003ca name=\"selection_styles\" href=\"#selection_styles\"\u003e#\u003c/a\u003e \u003ci\u003eselection\u003c/i\u003e.\u003cb\u003estyles\u003c/b\u003e(\u003ci\u003evalues\u003c/i\u003e[, \u003ci\u003epriority\u003c/i\u003e])\n\nA convenience method on top of [*selection*.style](https://github.com/d3/d3-selection#selection_style) for setting multiple style properties. If the specified *values* is an object, the values may be specified either as strings or functions. For example:\n\n```js\nselection.styles({fill: \"red\", stroke: function(d) { return d.stroke; }});\n```\n\nIf a value is a constant, all elements are given the same style property value; otherwise, if a value is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value is then used to set each element’s style properties. A null value will remove the specified style properties.\n\nIf the specified *values* is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value must be an object with string values, which are then used to set style properties on the current element. For example:\n\n```js\nselection.styles(function(d) { return {fill: \"red\", stroke: d.stroke}; });\n```\n\nPassing a function to *selection*.styles is convenient for sharing some computational effort or state across multiple style properties, or for specifying dynamically which style properties to set.\n\n\u003ca name=\"selection_properties\" href=\"#selection_properties\"\u003e#\u003c/a\u003e \u003ci\u003eselection\u003c/i\u003e.\u003cb\u003eproperties\u003c/b\u003e(\u003ci\u003evalues\u003c/i\u003e)\n\nA convenience method on top of [*selection*.property](https://github.com/d3/d3-selection#selection_property) for setting multiple element properties. If the specified *values* is an object, the values may be specified either as strings or functions. For example:\n\n```js\nselection.properties({foo: \"foo-value\", id: function(d, i) { return \"id-\" + i; }});\n```\n\nIf a value is a constant, all elements are given the same property value; otherwise, if a value is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value is then used to set each element’s properties. A null value will remove the specified properties.\n\nIf the specified *values* is a function, the function is evaluated for each selected element, in order, being passed the current datum (*d*), the current index (*i*), and the current group (*nodes*), with *this* as the current DOM element. The function’s return value must be an object with string values, which are then used to set properties on the current element. For example:\n\n```js\nselection.properties(function(d, i) { return {foo: \"foo-value\", id: \"id-\" + i}; });\n```\n\nPassing a function to *selection*.properties is convenient for sharing some computational effort or state across multiple properties, or for specifying dynamically which properties to set.\n\n\u003ca name=\"transition_attrs\" href=\"#transition_attrs\"\u003e#\u003c/a\u003e \u003ci\u003etransition\u003c/i\u003e.\u003cb\u003eattrs\u003c/b\u003e(\u003ci\u003evalues\u003c/i\u003e)\n\nLike [*selection*.attrs](#selection_attrs), but for [*transition*.attr](https://github.com/d3/d3-transition#transition_attr).\n\n\u003ca name=\"transition_styles\" href=\"#transition_styles\"\u003e#\u003c/a\u003e \u003ci\u003etransition\u003c/i\u003e.\u003cb\u003estyles\u003c/b\u003e(\u003ci\u003evalues\u003c/i\u003e[, \u003ci\u003epriority\u003c/i\u003e])\n\nLike [*selection*.styles](#selection_styles), but for [*transition*.style](https://github.com/d3/d3-transition#transition_style).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3%2Fd3-selection-multi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd3%2Fd3-selection-multi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd3%2Fd3-selection-multi/lists"}