@dsb.dk/designsystem
Version:
Development environment for creating components to the DSB Designsystem.
21 lines (17 loc) • 492 B
JavaScript
/**
* Converts a string to boolean
* 'false' => false
* 'true' => true
*/
/**
* Returns true if passed dom element is currently in focus
*/
const hasFocus = el => el === document.activeElement;
/**
* Converts text that contains text and html tags to a document fragment
*/
const stringToDocumentFragment = text => {
var frag = document.createRange().createContextualFragment(text);
return frag;
};
export { hasFocus as h, stringToDocumentFragment as s };