Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg-element-attributes

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-element-attributes

Map of SVG elements to allowed attributes

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
122K
decreased by-12.54%
Maintainers
1
Weekly downloads
 
Created
Source

svg-element-attributes

Build Coverage Downloads Size

Map of SVG elements to allowed attributes.

Contents

What is this?

This is a map of tag names to lists of allowed attributes. Global attributes are stored at the special tag name *. All attributes from SVG 1.1, SVG Tiny 1.2, and SVG 2 are included.

👉 Note: Includes deprecated attributes.

👉 Note: ARIA (role, aria-*), event (ev:event, on*), or xml:* and xlink:* attributes are not included.

When should I use this?

You can use this to figure out if certain attributes are allowed on certain SVG elements.

Install

This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:

npm install svg-element-attributes

In Deno with esm.sh:

import {svgElementAttributes} from 'https://esm.sh/svg-element-attributes@2'

In browsers with esm.sh:

<script type="module">
  import {svgElementAttributes} from 'https://esm.sh/svg-element-attributes@2?bundle'
</script>

Use

import {svgElementAttributes} from 'svg-element-attributes'

console.log(svgElementAttributes['*'])
console.log(svgElementAttributes.circle)

Yields:

[
  'about',
  'class',
  'content',
  'datatype',
  'id',
  'lang',
  'property',
  'rel',
  'resource',
  'rev',
  'tabindex',
  'typeof' ]
[
  'alignment-baseline',
  'baseline-shift',
  'clip',
  'clip-path',
  'clip-rule',
  // …
  'transform',
  'unicode-bidi',
  'visibility',
  'word-spacing',
  'writing-mode' ]

API

This package exports the identifier svgElementAttributes. There is no default export.

svgElementAttributes

Map of lowercase SVG elements to allowed attributes (Record<string, Array<string>>).

Types

This package is fully typed with TypeScript. It exports no additional types.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.

Security

This package is safe.

Contribute

Yes please! See How to Contribute to Open Source.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 25 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc