jQuery-like API for web-sys

docs.rs Build Status License

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

API

Attributes

| jQuery: Attributes | Document | Element + Collection | | -------------------- | --------------- | ------------------------------ | | .addClass() | | addclass | | .attr() | | attr, setattr | | .hasClass() | | hasclass | | .html() | | html, sethtml | | .prop() | | | | .removeAttr() | | removeattr | | .removeClass() | | removeclass | | .removeProp() | | | | .toggleClass() | | toggleclass | | .val() | | val, setval, *i32, *f64 |

Manipulation

| jQuery: Traversing | Document | Element + Collection | | -------------------- | --------------- | ------------------------------ | | .after() | | | | .append() | | | | .appendTo() | | | | .before() | | | | .clone() | | | | .css() | | | | .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() | | | | ~.andSelf()~ | - | - | | .children() | children | children | | .closest() | | | | .contents() | | | | .each() | | | | .end() | | | | .eq() | | | | .even() | | | | .filter() | | | | .find() | find | find | | .first() | | first | | .has() | | | | .is() | | | | .last() | | last | | .map() | | | | .next() | | next | | .nextAll() | | | | .nextUntil() | | | | .not() | | | | .odd() | | | | .offsetParent() | | | | .parent() | | parent | | .parents() | | | | .parentsUntil() | | | | .prev() | | prev | | .prevAll() | | | | .prevUntil() | | | | .siblings() | | | | .slice() | | |

Copyright and license

Licensed under an OpenBSD-ISC-style license, see LICENSE for details.