Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95051600
addClass.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Dec 12, 11:36
Size
520 B
Mime Type
text/x-java
Expires
Sat, Dec 14, 11:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22916142
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
addClass.js
View Options
import hasClass from './hasClass';
/**
* Adds a CSS class to a given element.
*
* @param element the element
* @param className the CSS class name
*/
export default function addClass(element, className) {
if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
}
Event Timeline
Log In to Comment