1.0.0 • Published 5 years ago

@advertol/control-element-classes v1.0.0

Weekly downloads
371
License
MIT
Repository
github
Last release
5 years ago

@advertol/control-element-classes

Build Status BrowserStack Status

Add HTML classes to zone DOM elements based on zone state.

Install

npm install @advertol/control-element-classes --save

Usage

import advertol from '@advertol/core';
import ElementClassesControl from '@advertol/control-element-classes';

const instance = advertol({
	// …
	control: [
		new ElementClassesControl({
			isHidden: 'is-hidden',
			isLoaded: 'is-loaded',
			isEmpty: 'is-empty'
		})
	]
});

instance.resolve();

API

elementClassesControl(classes)

classes

Type: Object

HTML classes to apply on zone DOM element based on current state.

PropertyTypeDescription
isHiddenstringHTML class when zone is hidden.
isLoadedstringHTML class when zone is loaded.
isEmptystringHTML class when zone is empty.

Browser support

Tested in IE9+ and all modern browsers, assuming Element.prototype.classList is available.

Test

For automated tests, run npm run test:automated (append :watch for watcher support).

License

MIT © Ivan Nikolić