6 releases
0.0.1-alpha.5 | Dec 15, 2020 |
---|---|
0.0.1-alpha.4 | Dec 11, 2020 |
0.0.1-alpha.3 | Dec 10, 2020 |
0.0.1-alpha.1 | Dec 9, 2020 |
#559 in WebAssembly
26 downloads per month
43KB
738 lines
jQuery-like API for web-sys
jQuery is dead and everyone agrees that you should use a modern approach like React instead (or, in the Rust/WASM world, Yew).
web-sys-query
allows you to port simple jQuery applications to
Rust/WASM with a familiar API instead of the rather complex
web-sys DOM API.
TODO
- Documentation and examples
- Unit tests
- AJAX
- ...
Feature flags
serde-serialize
: useserde_derive
to enableSerialize
andDeserialize
support on types such asFormData
(disabled by default).
API
Attributes
jQuery: Attributes | Document |
Element + Collection |
---|---|---|
.addClass() | add_class | |
.attr() | attr, set_attr | |
.hasClass() | has_class | |
.html() | html, set_html | |
.prop() | ||
.removeAttr() | remove_attr | |
.removeClass() | remove_class | |
.removeProp() | ||
.toggleClass() | toggle_class | |
.val() | val, set_val, *_i32, *_f64 |
Events
jQuery: Attributes | Document |
Element + Collection |
---|---|---|
.blur() | blur, set_blur | |
.change() | change, set_change | |
.click() | click, set_click | |
.contextmenu() | context_menu, set_context_menu | |
.dblclick() | dbl_click, set_dbl_click | |
.focus() | focus, set_focus | |
.focusin() | ||
.focusout() | ||
.hover() | ||
.keydown() | key_down, set_key_down | |
.keypress() | key_press, set_key_press | |
.keyup() | key_up, set_key_up | |
.load() | ||
.mousedown() | mouse_down, set_mouse_down | |
.mouseenter() | mouse_enter, set_mouse_enter | |
.mouseleave() | mouse_leave, set_mouse_leave | |
.mousemove() | mouse_move, set_mouse_move | |
.mouseout() | mouse_out, set_mouse_out | |
.mouseover() | mouse_over, set_mouse_over | |
.mouseup() | mouse_up, set_mouse_up | |
.off() | set_off | |
.on() | on, set_on | |
.one() | ||
.ready() | ||
.resize() | resize, set_resize | |
.scroll() | scroll, set_scroll | |
.select() | select, set_select | |
.submit() | submit, set_submit | |
.trigger() | ||
.triggerHandler() | ||
Manipulation
jQuery: Traversing | Document |
Element + Collection |
---|---|---|
.after() | ||
.append() | ||
.appendTo() | ||
.before() | ||
.clone() | ||
.css() | ||
.detach() | ||
.empty() | ||
.height() | ||
.innerHeight() | ||
.innerWidth() | ||
.insertAfter() | ||
.insertBefore() | ||
$.cssNumber | ||
$.htmlPrefilter() | ||
.offset() | ||
.outerHeight() | ||
.outerWidth() | ||
.position() | ||
.prepend() | ||
.prependTo() | ||
.remove() | ||
.replaceAll() | ||
.replaceWith() | ||
.scrollLeft() | ||
.scrollTop() | ||
.text() | text, set_text | |
.unwrap() | ||
.width() | ||
.wrap() | ||
.wrapAll() | ||
.wrapInner() |
Traversing
jQuery: Traversing | Document |
Element + Collection |
---|---|---|
.add() | ||
.addBack() | ||
.children() | children | children |
.closest() | closest | |
.contents() | ||
.each() | ||
.end() | ||
.eq() | ||
.even() | ||
.filter() | filter | |
.find() | find | find |
.first() | first | |
.has() | has | |
.is() | is | |
.last() | last | |
.map() | ||
.next() | next | |
.nextAll() | ||
.nextUntil() | ||
.not() | not | |
.odd() | ||
.offsetParent() | ||
.parent() | parent | |
.parents() | ||
.parentsUntil() | ||
.prev() | prev | |
.prevAll() | ||
.prevUntil() | ||
.siblings() | ||
.slice() |
Helper Functions
jQuery: Traversing | Document |
Element + Collection |
---|---|---|
jQuery.param() | ||
.serialize() | ||
.serializeArray() | serialize_array, FormData |
Copyright and license
Licensed under an OpenBSD-ISC-style license, see LICENSE for details.
Dependencies
~7–10MB
~185K SLoC