dquery 1.0.0+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 72

DQuery

DQuery is a porting of jQuery in Dart.

Install from Dart Pub Repository

Include the following in your pubspec.yaml:

dependencies:
  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<Element>.

$('.active')[0];
$('.active').isEmpty;
for (Element e in $('.active')) { ... }

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

$('.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 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

CHANGES

1.0.1

  • Fixed type errors for Dart 2

1.0.0

  • Dart 2 required

0.8.6

  • Fixed QueryEvent missing overrides

0.8.5

  • QueryEvent.shiftKey introduced.

0.8.4

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

0.8.3

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

0.8.2

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

0.8.1

  • Close #11: QueryEvent implements Event

Fixed client error when access pageX (Firefox)

**0.8.0

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

0.7.1

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

0.7.0

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

0.6.1

  • Fix event memory issue.

0.6.0

  • 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

0.5.4

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

0.5.2

  • 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

0.5.1

  • 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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
1.0.0+1 Aug 17, 2018 Go to the documentation of dquery 1.0.0+1 Download dquery 1.0.0+1 archive
1.0.0 Aug 9, 2018 Go to the documentation of dquery 1.0.0 Download dquery 1.0.0 archive
0.8.6 Sep 25, 2017 Go to the documentation of dquery 0.8.6 Download dquery 0.8.6 archive
0.8.5+3 Mar 18, 2017 Go to the documentation of dquery 0.8.5+3 Download dquery 0.8.5+3 archive
0.8.5+2 Mar 16, 2017 Go to the documentation of dquery 0.8.5+2 Download dquery 0.8.5+2 archive
0.8.5+1 Mar 16, 2017 Go to the documentation of dquery 0.8.5+1 Download dquery 0.8.5+1 archive
0.8.5 Jul 13, 2016 Go to the documentation of dquery 0.8.5 Download dquery 0.8.5 archive
0.8.4+1 Apr 28, 2016 Go to the documentation of dquery 0.8.4+1 Download dquery 0.8.4+1 archive
0.8.4 Apr 28, 2016 Go to the documentation of dquery 0.8.4 Download dquery 0.8.4 archive
0.8.3+1 Apr 27, 2016 Go to the documentation of dquery 0.8.3+1 Download dquery 0.8.3+1 archive

All 40 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: web

Primary library: package:dquery/dquery.dart with components: html.

Health suggestions

Format lib/dquery.dart.

Run dartfmt to format lib/dquery.dart.

Format lib/src/cookie.dart.

Run dartfmt to format lib/src/cookie.dart.

Format lib/src/css.dart.

Run dartfmt to format lib/src/css.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/data.dart (Run dartfmt to format lib/src/data.dart.)
  • lib/src/dquery_api.dart (Run dartfmt to format lib/src/dquery_api.dart.)
  • lib/src/dquery_impl.dart (Run dartfmt to format lib/src/dquery_impl.dart.)
  • lib/src/event.dart (Run dartfmt to format lib/src/event.dart.)
  • lib/src/manipulation.dart (Run dartfmt to format lib/src/manipulation.dart.)
  • lib/src/offset.dart (Run dartfmt to format lib/src/offset.dart.)
  • lib/src/traversing.dart (Run dartfmt to format lib/src/traversing.dart.)
  • lib/src/util/util.dart (Run dartfmt to format lib/src/util/util.dart.)

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.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dquery.dart.

Dependencies

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