-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathnodeName.js
More file actions
28 lines (27 loc) · 900 Bytes
/
Copy pathnodeName.js
File metadata and controls
28 lines (27 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import isTemplateWithTypeExclusively from 'ehtml/isTemplateWithTypeExclusively'
import isTemplateWithType from 'ehtml/isTemplateWithType'
import isTemplate from 'ehtml/isTemplate'
export default function (node) {
if (isTemplateWithType(node, 'e-json')) {
return 'e-json-template'
}
if (isTemplateWithTypeExclusively(node, 'e-page-with-url')) {
return 'e-page-with-url-template'
}
if (isTemplateWithTypeExclusively(node, 'e-if')) {
return 'e-if-template'
}
if (isTemplateWithTypeExclusively(node, 'e-for-each')) {
return 'e-for-each-template'
}
if (isTemplateWithTypeExclusively(node, 'e-wrapper')) {
return 'e-wrapper-template'
}
if (isTemplateWithTypeExclusively(node, 'e-ws')) {
return 'e-ws-template'
}
if (isTemplate(node) && node.hasAttribute('is')) {
return `${node.getAttribute('is')}-template`
}
return node.nodeName.toLowerCase()
}