svg-classlist-polyfill

WebJar for svg-classlist-polyfill

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

svg-classlist-polyfill
Последняя версия

Последняя версия

1.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

svg-classlist-polyfill
WebJar for svg-classlist-polyfill
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/naminho/svg-classlist-polyfill

Скачать svg-classlist-polyfill

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/svg-classlist-polyfill/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>svg-classlist-polyfill</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/svg-classlist-polyfill/
implementation 'org.webjars.npm:svg-classlist-polyfill:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/svg-classlist-polyfill/
implementation ("org.webjars.npm:svg-classlist-polyfill:1.0.2")
'org.webjars.npm:svg-classlist-polyfill:jar:1.0.2'
<dependency org="org.webjars.npm" name="svg-classlist-polyfill" rev="1.0.2">
  <artifact name="svg-classlist-polyfill" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='svg-classlist-polyfill', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "svg-classlist-polyfill" % "1.0.2"
[org.webjars.npm/svg-classlist-polyfill "1.0.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

SVG classList Polyfill

Polyfill for classList methods (contains, add, remove, toggle) on SVG elements which aren't supported on IE11 and other older browsers.

Installation and Usage

npm install svg-classlist-polyfill
import 'svg-classlist-polyfill'

That's it, polyfill will only be added if current environment doesn't already support the methods. Here is how regular usage afterwards might look like:

const icon = document.querySelector('svg.icon')

icon.classList.add('icon--blue')
icon.classList.toggle('icon--rotate')
icon.classList.remove('icon--blue')
icon.classList.contains('icon--blue') === false

Avoid setting the class with icon.className = 'icon icon--blue' as this isn't properly supported in IE11 and will not work together with the polyfill.

Tests

There are a few test cases available in test.js. Serve a simple website with npm test opening this in a browser will run a few test cases quickly indicating whether the polyfill is working well.

Source

Sourcecode partially taken from this Gist.

Версии библиотеки

Версия
1.0.2