dquery 1.0.0+1

  • Readme
  • Changelog
  • Installing
  • 56

DQuery #

DQuery is a porting of jQuery in Dart.

Install from Dart Pub Repository #

Include the following in your pubspec.yaml:

  dquery: any

Then run the Pub Package Manager 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

for (Element e in $('.active')) { ... }

Create another query object with traversing API, including find, closest, parent, children.


Manipulate selected elements.


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 for more features.

Comparison to jQuery #

See here.

Notes to Contributors #

Test and Debug #

You are welcome to submit bugs and feature requests. 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 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 first.

Who Uses #

  • Quire - a simple, collaborative, multi-level task management tool.
  • Keikai - a sophisticated spreadsheet for big data



  • Fixed type errors for Dart 2


  • Dart 2 required


  • Fixed QueryEvent missing overrides


  • QueryEvent.shiftKey introduced.


  • Deprecate QueryEvent.type since Dart 1.16 doesn't support MouseEvent.which, and it is not non-standard.
  • Deprecate keyLocation. Use location instead.


  • Remove QueryEvent's isDefaultPrevented and isPropagationStopped. Please use defaultPrevented and propagationStopped instead.


  • Remove QueryEvent's which and clipboardData to be compatible with Dart 1.16


  • Close #11: QueryEvent implements Event

Fixed client error when access pageX (Firefox) #


  • Refector: DQuery doesn't depend on Event.target/type for basic event handling


  • Focus/blur event bubbling ready.
  • Fix mouseenter/mouseleave delegate event.
  • Fix delegate target not found error.
  • Removed deprecated event API.
  • Fine tune QueryEvent constructor.


  • #6: DocumentQuery supported cookie API.
  • #2: QueryEvent supported keystroke API.


  • Fix event memory issue.


  • Query was added for query any object including shadow roots.
  • DocumentQuery and WindowQuery were removed, and replaced with DQuery.
  • DQueryEvent was renamed to QueryEvent.
  • Data.space() became a getter: Date.space


  • Fix event name space.
  • Fix data remove.
  • Fine tune JavaScript compatibility.


  • Add getter/setter of offset, getter of offsetLeft, offsetTop
  • Add getter of offsetParent
  • Add getter/setter of html, text
  • Add .clone()
  • Add .append(), .prepend(), .after(), .before()
  • Add .appendTo(), .prependTo()
  • Minor bug fixes


  • Add $(html) support.
  • Add getter, setter of scrollLeft, scrollTop
  • Add .css()
  • Add getter of width, height

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dquery: ^1.0.0+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dquery/dquery.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 20, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/dquery_api.dart. (-25 points)

Analysis of lib/src/dquery_api.dart reported 67 hints, including:

line 8 col 1: Prefer using /// for doc comments.

line 16 col 3: Prefer using /// for doc comments.

line 21 col 3: Prefer using /// for doc comments.

line 33 col 3: Prefer using /// for doc comments.

line 43 col 3: Prefer using /// for doc comments.

Fix lib/src/dquery_impl.dart. (-25 points)

Analysis of lib/src/dquery_impl.dart reported 58 hints, including:

line 39 col 7: Unnecessary new keyword.

line 44 col 34: Unnecessary new keyword.

line 48 col 38: Unnecessary new keyword.

line 64 col 7: DO use curly braces for all flow control structures.

line 84 col 46: Use isNotEmpty for Iterables and Maps.

Fix lib/src/event.dart. (-25 points)

Analysis of lib/src/event.dart reported 78 hints, including:

line 16 col 50: Use isNotEmpty for Iterables and Maps.

line 20 col 7: DO use curly braces for all flow control structures.

line 37 col 11: Use contains instead of indexOf

line 46 col 9: DO use curly braces for all flow control structures.

line 57 col 33: Unnecessary new keyword.

Fix additional 8 files with analysis or formatting issues. (-39.74 points)

Additional issues in the following files:

  • lib/dquery.dart (19 hints)
  • lib/src/manipulation.dart (17 hints)
  • lib/src/offset.dart (14 hints)
  • lib/src/data.dart (11 hints)
  • lib/src/cookie.dart (9 hints)
  • lib/src/css.dart (7 hints)
  • lib/src/traversing.dart (3 hints)
  • lib/src/util/util.dart (2 hints)

Maintenance issues and suggestions

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: intl.

Package is getting outdated. (-42.47 points)

The package was last published 74 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dquery.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Documentation URL is insecure. (-5 points)

Update the documentation field and use a secure (https) URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
intl any 0.16.1
Transitive dependencies
path 1.6.4