Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rikulo/dquery
jQuery ported in Dart.
https://github.com/rikulo/dquery
dart jquery
Last synced: about 1 month ago
JSON representation
jQuery ported in Dart.
- Host: GitHub
- URL: https://github.com/rikulo/dquery
- Owner: rikulo
- License: apache-2.0
- Created: 2013-04-15T08:03:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-11-16T02:39:00.000Z (about 1 year ago)
- Last Synced: 2024-06-19T16:34:26.882Z (6 months ago)
- Topics: dart, jquery
- Language: Dart
- Homepage: https://quire.io
- Size: 279 KB
- Stars: 53
- Watchers: 13
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# DQuery
DQuery is a porting of [jQuery](http://jquery.com/) in Dart.
* [API Reference](https://pub.dev/documentation/dquery/latest/)
* [Git Repository](https://github.com/rikulo/dquery)
* [Discussion](http://stackoverflow.com/questions/tagged/rikulo)
* [Issues](https://github.com/rikulo/dquery/issues)## Install from Dart Pub Repository
Include the following in your `pubspec.yaml`:
dependencies:
dquery: anyThen run the [Pub Package Manager](http://pub.dartlang.org/doc) in Dart Editor (Tool > Pub Install). If you are using a different editor, run the command
(comes with the Dart SDK):pub install
## Usage
You can create a query object by selector. With context provided, the query will be based on different element.
// selects all elements containing 'active' in CSS class
ElementQuery $elems = $('.active');
// selects all descendant elements of div containing 'active' in CSS class
ElementQuery $elems = $('.active', div);It implements List.
$('.active')[0];
$('.active').isEmpty;
for (Element e in $('.active')) { ... }Create another query object with traversing API, including [find](https://pub.dev/documentation/dquery/latest/dquery/Query/find.html), [closest](https://pub.dev/documentation/dquery/latest/dquery/ElementQuery/closest.html), [parent](https://pub.dev/documentation/dquery/latest/dquery/ElementQuery/parent.html), [children](https://pub.dev/documentation/dquery/latest/dquery/ElementQuery/children.html).
$('.active').closest('ul');
$('#myDiv').find('a.btn');Manipulate selected elements.
$('.active').removeClass('active');
$('.fade').hide();Register event handlers on queried elements, or trigger an event by API.
$('#myBtn').on('click', (QueryEvent e) {
...
});
$('#myBtn').trigger('click', data: 'my data');There are query objects of `Document` and `Window` too.
Query $doc = $document();
Query $win = $window();Check the [API reference](https://pub.dev/documentation/dquery/latest/dquery/dquery-library.html) for more features.
## Comparison to jQuery
See [here](https://github.com/rikulo/dquery/blob/master/doc/Comparison.md).
## Notes to Contributors
### Test and Debug
You are welcome to submit [bugs and feature requests](https://github.com/rikulo/dquery/issues). Or even better if you can fix or implement them!
### Fork DQuery
If you'd like to contribute back to the core, you can [fork this repository](https://help.github.com/articles/fork-a-repo) and send us a pull request, when it is ready.
Please be aware that one of Rikulo's design goals is to keep the sphere of API as neat and consistency as possible. Strong enhancement always demands greater consensus.
If you are new to Git or GitHub, please read [this guide](https://help.github.com/) first.
## Who Uses
* [Quire](https://quire.io) - a simple, collaborative, multi-level task management tool.
* [Keikai](https://keikai.io) - a sophisticated spreadsheet for big data