stopPropagation.js 767 B

12345678910111213141516171819202122232425262728
  1. /* eslint-disable
  2. max-len,
  3. */
  4. // TODO: This file was created by bulk-decaffeinate.
  5. // Fix any style issues and re-enable lint.
  6. /*
  7. * decaffeinate suggestions:
  8. * DS102: Remove unnecessary code created because of implicit returns
  9. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  10. */
  11. import App from '../base'
  12. App.directive('stopPropagation', function () {
  13. return {
  14. restrict: 'A',
  15. link(scope, element, attrs) {
  16. return element.bind(attrs.stopPropagation, e => e.stopPropagation())
  17. },
  18. }
  19. })
  20. export default App.directive('preventDefault', function () {
  21. return {
  22. restrict: 'A',
  23. link(scope, element, attrs) {
  24. return element.bind(attrs.preventDefault, e => e.preventDefault())
  25. },
  26. }
  27. })