Skip to content

Instantly share code, notes, and snippets.

@Mirv
Mirv / cocoon.js
Last active March 5, 2019 23:16 — forked from thedanbob/cocoon.js
Cocoon rewrite in ES6 (WIP)
class Cocoon {
constructor (container, options) {
this.container = this.getNodeFromOption(container, false)
if (!this.container) {
throw new TypeError('Container must be supplied')
}
this.addFieldsLink = this.getNodeFromOption(options.addFieldsLink, container.querySelector('.add_fields'))