@tourepedia/dom-helpers
v0.3.2
Published
Dom helper utilities
Downloads
3
Readme
Dom helpers
Install
npm install --save @tourepedia/dom-helpers
Utilities
isDom
check if dom is available (generally used in univeral apps)
import { isDom } from "@tourepedia/dom-helpers"
function App() {
if (isDom) {
// rendering in a browser
}
}
activeElement
Return the current active element in the dom
import { activeElement } from "@tourepedia/dom-helpers"
const App () {
const currentActiveElement = activeElement()
}
contains
Checks whether or not a dom node is contains another given dom node. An usecase would be for checking a active element inside a container
import { contains } from "@tourepedia/dom-helpers"
function App() {
// after mount
if (contains(container, child)) {
// do something with it
}
}