# dt-selector

> Δt selector engine - async & dynamic templating engine

Latest version **0.0.4** (published 2014-08-21) · 0 weekly downloads

## Install

```sh
npm install dt-selector
pnpm add dt-selector
yarn add dt-selector
bun add dt-selector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2014-08-21 |
| First published | 2012-06-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | dodo |
| Maintainers | dodo |
| Keywords | dt, async, dynamic, event, template, generation, stream, browser, css, selector, engine |

## Links

- npm: https://www.npmjs.com/package/dt-selector
- Repository: https://github.com/dodo/node-dt-selector
- Issues: https://github.com/dodo/node-dt-selector/issues
- npm.io page: https://npm.io/package/dt-selector

## Dependencies (1)

- [slick](https://npm.io/package/slick.md) 1.10.x

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2014-08-21
- 0.0.3 — 2013-08-05
- 0.0.2 — 2012-06-07
- 0.0.1 — 2012-06-03

## README

# [Δt Selector Engine](https://github.com/dodo/node-dt-selector/)

This is a selector engine for [Δt](http://dodo.github.com/node-dynamictemplate/).


## Installation

```bash
$ npm install dt-selector
```


## Usage

```javascript
var $ = require('dt-selector');

var example = new Template({schema:5}, function() {
    this.$html(function() {
        this.$head(function() {
            this.$title("beep");
        });
        this.$body(function() {
            this.$div({class:'a'}, "¡¡¡");
            this.$div({class:'b'}, function() {
                this.$span("tacos");
                this.$span("y");
                this.$span("burritos");
            });
            this.$div({class:'a'}, "!!!");
        });
    });
});

$(example).on('.b span', function (el) {
    el.once('end', function () {
        console.log(this.toString());
    });
});
/* → stdout:
<span>tacos</span>
<span>y</span>
<span>burritos</span>
*/
```

## api

Same like nodejs' `EventEmitter`, instead that the given event name gets processed by a [CSS selector](http://www.w3.org/TR/CSS2/selector.html) [parser](https://github.com/kamicane/slick).
Every time a new tag is created in the xml tree, the matching event will be emitted with the tag as argument.

Since [Templates](), [Builder](http://dodo.github.com/node-asyncxml/#api/builder-opts) and [Tags](http://dodo.github.com/node-asyncxml/#api/tag-name-attrs-children-opts) have all the same [event api](http://dodo.github.com/node-asyncxml/#events) for new tags, it doesn't matter if you let the selector listen on the template or on a tag.


[![Build Status](https://secure.travis-ci.org/dodo/node-dt-selector.png)](http://travis-ci.org/dodo/node-dt-selector)

---
_Source: https://npm.io/package/dt-selector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
