Skip to content

Instantly share code, notes, and snippets.

@leastbad
Created April 15, 2021 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leastbad/3fe3b467da0667569a490b445a30a31d to your computer and use it in GitHub Desktop.
Save leastbad/3fe3b467da0667569a490b445a30a31d to your computer and use it in GitHub Desktop.
CableReady custom operations
import CableReady from 'cable_ready'
import { dispatch } from 'cable_ready/javascript/utils'
CableReady.DOMOperations.removeSubelement = operation => {
const { element, subElement } = operation
dispatch(element, 'cable-ready:before-remove-subelement', operation)
element.contentDocument.querySelector(subElement).remove()
dispatch(element, 'cable-ready:after-remove-subelement', operation)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment