@achmadk/void-elements 中文文档教程
void-elements
:memo: Object of "void elements" defined by the HTML Standard
导出由 HTML 规范定义的“空元素”节点名称的 Object
。
该列表是根据最新的 WHATWG HTML 标准以编程方式生成的。
:wrench: Usage
1. node.js
const voidElements = require('@achmadk/void-elements');
assert(!voidElements['span'], '<span> is not a void element');
assert(voidElements['img'], '<img> is a void element');
2. vite js (if have error importing void-elements
)
import { defineConfig } from 'vite'
export default defineConfig({
// rest of your vite configuration
resolve: {
alias: [
// another aliases
{
find: 'void-elements',
replacement: '@achmadk/void-elements'
}
]
}
})
License
麻省理工学院
void-elements
:memo: Object of "void elements" defined by the HTML Standard
Exports an Object
of "void element" node names as defined by the HTML spec.
The list is programatically generated from the latest WHATWG HTML Standard.
:wrench: Usage
1. node.js
const voidElements = require('@achmadk/void-elements');
assert(!voidElements['span'], '<span> is not a void element');
assert(voidElements['img'], '<img> is a void element');
2. vite js (if have error importing void-elements
)
import { defineConfig } from 'vite'
export default defineConfig({
// rest of your vite configuration
resolve: {
alias: [
// another aliases
{
find: 'void-elements',
replacement: '@achmadk/void-elements'
}
]
}
})
License
MIT