Skip to content

Commit

Permalink
Automatic!
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikb committed Feb 14, 2021
1 parent 8716297 commit 4178e7a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 24 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,6 @@ several of these. The space separate flags and path. Supported flags are:
= Trigger only (no value set)
```

If you have an element you should `attach` it to that, like this:

```jsx
const element = <div></div>;
element.attach(
don('!*+ test', x => element.textContent = x)
);
```

`attach` is added to elements created by domdom (`Domode` in TSX).

#### Child path lookup

By using `child` it's possible to listen to relative paths "from parent".
Expand Down
5 changes: 0 additions & 5 deletions domdom/domdom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ export class ReactImpl implements React {

ddProps(this.data, el.mountables, el, props);

el.attach = (pathifier: DomPathifier) => {
el.mountables.push(pathifier);
pathifier.init();
};

return el;
}
}
Expand Down
7 changes: 1 addition & 6 deletions domdom/pathifier.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Pathifier } from '../data/index.ts';
import { Domode, Mountable } from 'types.ts';
import { Mountable } from 'types.ts';

export class DomPathifier extends Pathifier implements Mountable {
mountables: Mountable[] = [];
Expand All @@ -13,9 +13,4 @@ export class DomPathifier extends Pathifier implements Mountable {
this.off();
this.mountables.forEach(m => m.unmounted());
}

attach(node: Domode) {
node.mountables.push(this);
this.init();
}
}
2 changes: 0 additions & 2 deletions domdom/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export interface Domode extends HTMLElement, Mountable {
isMounted: boolean;
mountables: Mountable[];
bloodyRebuild: (namespaceURI?: string) => Domode;

attach(pathifier: Pathifier);
}

export interface Mountable {
Expand Down

0 comments on commit 4178e7a

Please sign in to comment.