Browse Source

Move ComponentComment to TS

ts-components
Artur Arseniev 3 years ago
parent
commit
64057db4b8
  1. 21
      src/dom_components/model/ComponentComment.js
  2. 32
      src/dom_components/model/ComponentComment.ts

21
src/dom_components/model/ComponentComment.js

@ -1,21 +0,0 @@
import ComponentTextNode from './ComponentTextNode';
export default class ComponentComment extends ComponentTextNode {
get defaults() {
return { ...super.defaults };
}
toHTML() {
return `<!--${this.get('content')}-->`;
}
}
ComponentComment.isComponent = el => {
if (el.nodeType == 8) {
return {
tagName: 'NULL',
type: 'comment',
content: el.textContent,
};
}
};

32
src/dom_components/model/ComponentComment.ts

@ -0,0 +1,32 @@
import ComponentTextNode from './ComponentTextNode';
export default class ComponentComment extends ComponentTextNode {
get defaults() {
// @ts-ignore
return { ...super.defaults };
}
toHTML() {
return `<!--${this.get('content')}-->`;
}
static isComponent(el: HTMLElement) {
if (el.nodeType == 8) {
return {
tagName: 'NULL',
type: 'comment',
content: el.textContent,
};
}
}
}
// ComponentComment.isComponent = el => {
// if (el.nodeType == 8) {
// return {
// tagName: 'NULL',
// type: 'comment',
// content: el.textContent,
// };
// }
// };
Loading…
Cancel
Save