Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yapplabs/ember-tether
Tether an element to another element in the DOM
https://github.com/yapplabs/ember-tether
ember ember-cli
Last synced: 5 days ago
JSON representation
Tether an element to another element in the DOM
- Host: GitHub
- URL: https://github.com/yapplabs/ember-tether
- Owner: yapplabs
- License: mit
- Created: 2015-05-15T10:19:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-12-20T16:12:50.000Z (about 1 month ago)
- Last Synced: 2025-01-22T18:01:39.285Z (12 days ago)
- Topics: ember, ember-cli
- Language: JavaScript
- Size: 1.69 MB
- Stars: 119
- Watchers: 6
- Forks: 36
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ember Tether [![Build Status](https://travis-ci.org/yapplabs/ember-tether.svg?branch=master)](https://travis-ci.org/yapplabs/ember-tether) [![Ember Observer Score](http://emberobserver.com/badges/ember-tether.svg)](http://emberobserver.com/addons/ember-tether)
This ember-cli addon provides a component that allows for 'tethering' a block to a target somewhere else on the page. The target may be an element, an element selector, or an Ember view. Importantly, the component retains typical context for Ember action handling and data binding.
## Compatibility
* Ember.js v3.28 or above
* Ember CLI v3.28 or above
* Node.js v14 or aboveFor Ember 1.13 - 2.3, use 0.4.1. For support for earlier versions of Ember, use ember-tether 0.3.1.
## Installation
## Live Demo
View a live demo here: [http://yapplabs.github.io/ember-tether/](http://yapplabs.github.io/ember-tether/)
## Installation
`ember install ember-tether`
*Note:* Ember CLI versions < 0.2.3 should use `ember install:addon` instead of `ember install`
## Example Usage
Given the following DOM:
```html
Nice person
```
and a template like this:
```hbs
A puppy
```
Then "A puppy" would be rendered alongside the `a-nice-person` div.
If the ember-tether component is destroyed, its far-off content is destroyed too.
For example, given:```hbs
{{#if this.isShowing}}
A puppy
{{/if}}
```If `this.isShowing` starts off true and becomes false, then the "A puppy" text will be removed from the page.
Similarly, if you use `` in a route's template, it will
render its content next to the target element when the route is entered
and remove it when the route is exited.## Acceptance Testing
Tether works by appending tethered elements to the `` tag. Unfortunately, this moves your content outside of the Ember application `rootElement` during acceptance testing. This breaks event dispatch and action handling, including traditional Ember test helpers like `click`.
As of version 0.4.0, we can configure a different element to be used instead of body. This can be useful for Ember tests.
```js
// config/environment.jsENV['ember-tether'] = {
bodyElementId: 'ember-testing'
};
```It is also possible to pass a `bodyElement` to a particular ember-tether component declaration.
## Contributing
See the [Contributing](CONTRIBUTING.md) guide for details.
## License
- [Ship Shape Tether](https://github.com/shipshapecode/tether), the underlying library that implement the actual tethering behavior
- [ember-wormhole](https://github.com/yapplabs/ember-wormhole), whose pattern for element content manipulation inspired the approach in ember-tether
- [Tetherball](http://en.wikipedia.org/wiki/Tetherball), for providing countless hours of entertainment over the past century