1. 1 : /**
  2. 2 : * @file spacer.js
  3. 3 : */
  4. 4 : import Component from '../../component.js';
  5. 5 :
  6. 6 : /**
  7. 7 : * Just an empty spacer element that can be used as an append point for plugins, etc.
  8. 8 : * Also can be used to create space between elements when necessary.
  9. 9 : *
  10. 10 : * @extends Component
  11. 11 : */
  12. 12 : class Spacer extends Component {
  13. 13 :
  14. 14 : /**
  15. 15 : * Builds the default DOM `className`.
  16. 16 : *
  17. 17 : * @return {string}
  18. 18 : * The DOM `className` for this object.
  19. 19 : */
  20. 20 : buildCSSClass() {
  21. 21 : return `vjs-spacer ${super.buildCSSClass()}`;
  22. 22 : }
  23. 23 :
  24. 24 : /**
  25. 25 : * Create the `Component`'s DOM element
  26. 26 : *
  27. 27 : * @return {Element}
  28. 28 : * The element that was created.
  29. 29 : */
  30. 30 : createEl(tag = 'div', props = {}, attributes = {}) {
  31. 31 : if (!props.className) {
  32. 32 : props.className = this.buildCSSClass();
  33. 33 : }
  34. 34 :
  35. 35 : return super.createEl(tag, props, attributes);
  36. 36 : }
  37. 37 : }
  38. 38 :
  39. 39 : Component.registerComponent('Spacer', Spacer);
  40. 40 :
  41. 41 : export default Spacer;