Skip to content
This repository has been archived by the owner. It is now read-only.
Carry over attrs and classes from one element to another.
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

carry

Carry attrs, classes from one element to another.

Installation

Install with component(1):

$ component install yields/carry

Example

function Widget(el){
  this.el = carry(el, tpl.cloneNode());
}

new Widget;
new Widget(el);

API

carry(a, b)

if a is null a clone of b will be returned. otherwise b's attrs and classes are merged with a, returning a.

.attrs(a, b)

Carry over attributes from b to a.

.classes(a, b)

Carry over classes from b to a.

License

MIT

You can’t perform that action at this time.