dom
Browser DOM manipulation, element selection, event handling.
Load with: use dom
Quick example
use dom
result = qs("value")
prn(result)
Functions
Element selection
qs(selector)
Performs the operation. Takes selector.
qsa(selector)
Performs the operation. Takes selector.
byid(id)
Performs the operation. Takes id.
bycls(classname)
Lists items. Takes classname.
bytag(tag)
Performs the operation. Takes tag.
Element creation
elnew(tag)
Performs the operation. Takes tag.
eltxt(text)
Performs the operation. Takes text.
Element manipulation
elhtm(el, html)
Performs the operation. Takes el, html.
eltex(el, text)
Executes. Takes el, text.
elatt(el, name, value)
Performs the operation. Takes el, name, value.
elget(el, name)
Performs the operation. Takes el, name.
elrm(el, name)
Removes an item. Takes el, name.
elhas(el, classname)
Performs the operation. Takes el, classname.
eladd(el, classname)
Performs the operation. Takes el, classname.
elrmc(el, classname)
Performs the operation. Takes el, classname.
eltog(el, classname)
Performs the operation. Takes el, classname.
Styling
elsty(el, prop, value)
Performs the operation. Takes el, prop, value.
elgs(el, prop)
Performs the operation. Takes el, prop.
elshw(el)
Performs the operation. Takes el.
elhid(el)
Performs the operation. Takes el.
DOM tree manipulation
elapp(parent, child)
Performs the operation. Takes parent, child.
elpre(parent, child)
Performs the operation. Takes parent, child.
elins(new_node, reference)
Performs the operation. Takes new_node, reference.
elrmv(el)
Performs the operation. Takes el.
elrep(old_node, new_node)
Performs the operation. Takes old_node, new_node.
elclo(el, deep)
Performs the operation. Takes el, deep.
elpar(el)
Performs the operation. Takes el.
elkid(el)
Performs the operation. Takes el.
Event handling
elon(el, event_type, handler)
Performs the operation. Takes el, event_type, handler.
eloff(el, event_type, handler)
Performs the operation. Takes el, event_type, handler.
eldis(el, event_type, detail)
Returns true/false based on a condition. Takes el, event_type, detail.
Form handling
formv(form, name)
Performs the operation. Takes form, name.
forms(form, name, value)
Performs the operation. Takes form, name, value.
formd(form)
Performs the operation. Takes form.
Input handling
inget(input)
Performs the operation. Takes input.
inset(input, value)
Performs the operation. Takes input, value.
inchk(input)
Performs the operation. Takes input.
inchk(input, checked)
Performs the operation. Takes input, checked.
Navigation
navto(url)
Converts to another format. Takes url.
navrl()
Performs the operation.
navbk()
Performs the operation.
navfw()
Performs the operation.
Location/History
locu()
Performs the operation.
loch()
Checks a condition.
locs()
Performs the operation.
locp()
Performs the operation.
histp(state, title, url)
Performs the operation. Takes state, title, url.
histr(state, title, url)
Performs the operation. Takes state, title, url.
Window/Document
winw()
Performs the operation.
winh()
Performs the operation.
docx()
Performs the operation.
docy()
Performs the operation.
Cookies
cookg(name)
Performs the operation. Takes name.
cooks(name, value, options)
Performs the operation. Takes name, value, options.
cookd(name)
Performs the operation. Takes name.
cooka()
Performs the operation.
Local/Session storage
lsget(key)
Performs the operation. Takes key.
lsset(key, value)
Performs the operation. Takes key, value.
lsrm(key)
Removes an item. Takes key.
ssget(key)
Performs the operation. Takes key.
ssset(key, value)
Performs the operation. Takes key, value.
ssrm(key)
Removes an item. Takes key.
RequestAnimationFrame
raf(fn)
Performs the operation. Takes fn.
SetTimeout/SetInterval
timeo(fn, ms)
Performs the operation. Takes fn, ms.
inter(fn, ms)
Performs the operation. Takes fn, ms.
clrti(id)
Performs the operation. Takes id.
Fullscreen
reqfu(el)
Performs the operation. Takes el.
exitf()
Performs the operation.
Selection
seltx()
Performs the operation.
selse(text)
Sets a value. Takes text.
Clipboard
clipc(text)
Performs the operation. Takes text.
clipp()
Performs the operation.
Focus
elfoc(el)
Performs the operation. Takes el.
elblu(el)
Performs the operation. Takes el.
Data attributes
eldat(el, key)
Performs the operation. Takes el, key.
eldat(el)
Performs the operation. Takes el.
Dimensions
elrec(el)
Performs the operation. Takes el.
ClassList helpers
elcls(el)
Lists items. Takes el.
Animations & Transitions
elani(el, keyframes, options)
Performs the operation. Takes el, keyframes, options.
eltra(el, properties, duration_ms, easing)
Performs the operation. Takes el, properties, duration_ms, easing.
elfad(el, duration_ms)
Adds an item. Takes el, duration_ms.
elfad(el, duration_ms)
Adds an item. Takes el, duration_ms.
elsli(el, direction, duration_ms)
Performs the operation. Takes el, direction, duration_ms.
elbou(el)
Performs the operation. Takes el.
elpul(el)
Performs the operation. Takes el.
elsha(el)
Performs the operation. Takes el.
Drag & Drop
eldra(el, options)
Performs the operation. Takes el, options.
eldro(el, options)
Performs the operation. Takes el, options.
Intersection Observer
inion(callback, options)
Performs the operation. Takes callback, options.
inion(observer, el)
Performs the operation. Takes observer, el.
inion(observer, el)
Performs the operation. Takes observer, el.
inion(observer)
Performs the operation. Takes observer.
ellaz(el, src, placeholder)
Performs the operation. Takes el, src, placeholder.
Mutation Observer
mutob(callback)
Performs the operation. Takes callback.
mutob(observer, el, options)
Performs the operation. Takes observer, el, options.
mutob(observer)
Performs the operation. Takes observer.
Resize Observer
resiz(callback)
Performs the operation. Takes callback.
resiz(observer, el)
Performs the operation. Takes observer, el.
resiz(observer, el)
Performs the operation. Takes observer, el.
Media Queries
media(query)
Performs the operation. Takes query.
media(mq, change_fn)
Performs the operation. Takes mq, change_fn.
media(mq, change_fn)
Performs the operation. Takes mq, change_fn.
darkp()
Performs the operation.
reduc()
Performs the operation.
Scroll utilities
scrol(el, behavior)
Performs the operation. Takes el, behavior.
scrol(x, y, behavior)
Performs the operation. Takes x, y, behavior.
scrol(x, y)
Performs the operation. Takes x, y.
scrol(el)
Performs the operation. Takes el.
infsc(el, callback, threshold_px)
Performs the operation. Takes el, callback, threshold_px.
Touch/Gesture
elong(el, callback, duration_ms)
Performs the operation. Takes el, callback, duration_ms.
elswi(el, callback)
Performs the operation. Takes el, callback.
Element visibility
elinv(el, fully)
Performs the operation. Takes el, fully.
Sanitization
elsaf(html)
Performs the operation. Takes html.
eltex(text)
Executes. Takes text.
File handling
filed(el, callback)
Performs the operation. Takes el, callback.
filer(file, callback)
Performs the operation. Takes file, callback.
filer(file, callback)
Performs the operation. Takes file, callback.
Canvas
canva(id)
Performs the operation. Takes id.
canva(canvas)
Performs the operation. Takes canvas.
canva(canvas, draw_fn)
Performs the operation. Takes canvas, draw_fn.
WebGL
canva(canvas)
Performs the operation. Takes canvas.
Performance
perfn()
Finalises.
perfm(name)
Performs the operation. Takes name.
perfm(name, start_mark, end_mark)
Performs the operation. Takes name, start_mark, end_mark.
Network status
onlin()
Initialises.
netty()
Performs the operation.
netef()
Performs the operation.
saven()
Encodes.
Battery
batte()
Performs the operation.
onbat(callback)
Performs the operation. Takes callback.
Vibration
vibra(pattern)
Performs the operation. Takes pattern.
Notifications
notif()
Performs the operation.
notif(callback)
Performs the operation. Takes callback.
notif(title, options)
Performs the operation. Takes title, options.
Device orientation
orien(callback)
Encodes. Takes callback.
orien()
Encodes.
Screen orientation
scree()
Performs the operation.
scree(orientation)
Performs the operation. Takes orientation.
scree()
Performs the operation.
Picture in Picture
pipen(video)
Encodes. Takes video.
pipdi()
Disconnects.
Wake lock
wakel()
Performs the operation.
wakel(lock)
Performs the operation. Takes lock.
Geolocation
geolo(callback, error_fn)
Performs the operation. Takes callback, error_fn.
geolo(callback, error_fn)
Performs the operation. Takes callback, error_fn.
geolo(watch_id)
Performs the operation. Takes watch_id.
Speech
speec(text, options)
Performs the operation. Takes text, options.
speec(lang, callback)
Performs the operation. Takes lang, callback.
Accessibility
aria(el, attr, value)
Performs the operation. Takes el, attr, value.
ariar(el, role)
Performs the operation. Takes el, role.
focus(container, on_escape)
Performs the operation. Takes container, on_escape.
print()
Performs the operation.
print(el)
Performs the operation. Takes el.
Notes
- DOM manipulation for web targets - create, query, update elements.