mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-19 03:35:26 +00:00
larry babby and threejs for glsl
This commit is contained in:
121
webGl/my-threejs-test/node_modules/htmlnano/lib/modules/removeEmptyAttributes.mjs
generated
vendored
Normal file
121
webGl/my-threejs-test/node_modules/htmlnano/lib/modules/removeEmptyAttributes.mjs
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import { isEventHandler } from '../helpers.mjs';
|
||||
|
||||
const safeToRemoveAttrs = {
|
||||
id: null,
|
||||
class: null,
|
||||
style: null,
|
||||
title: null,
|
||||
lang: null,
|
||||
dir: null,
|
||||
abbr: ['th'],
|
||||
accept: ['input'],
|
||||
'accept-charset': ['form'],
|
||||
charset: ['meta', 'script'],
|
||||
action: ['form'],
|
||||
cols: ['textarea'],
|
||||
colspan: ['td', 'th'],
|
||||
coords: ['area'],
|
||||
dirname: ['input', 'textarea'],
|
||||
dropzone: null,
|
||||
headers: ['td', 'th'],
|
||||
form: [
|
||||
'button',
|
||||
'fieldset',
|
||||
'input',
|
||||
'keygen',
|
||||
'object',
|
||||
'output',
|
||||
'select',
|
||||
'textarea'
|
||||
],
|
||||
formaction: ['button', 'input'],
|
||||
height: ['canvas', 'embed', 'iframe', 'img', 'input', 'object', 'video'],
|
||||
high: 'meter',
|
||||
href: 'link',
|
||||
list: 'input',
|
||||
low: 'meter',
|
||||
manifest: 'html',
|
||||
max: ['meter', 'progress'],
|
||||
maxLength: ['input', 'textarea'],
|
||||
menu: 'button',
|
||||
min: 'meter',
|
||||
minLength: ['input', 'textarea'],
|
||||
name: [
|
||||
'button',
|
||||
'fieldset',
|
||||
'input',
|
||||
'keygen',
|
||||
'output',
|
||||
'select',
|
||||
'textarea',
|
||||
'form',
|
||||
'map',
|
||||
'meta',
|
||||
'param',
|
||||
'slot'
|
||||
],
|
||||
pattern: ['input'],
|
||||
ping: ['a', 'area'],
|
||||
placeholder: ['input', 'textarea'],
|
||||
poster: ['video'],
|
||||
rel: ['a', 'area', 'link'],
|
||||
rows: 'textarea',
|
||||
rowspan: ['td', 'th'],
|
||||
size: ['input', 'select'],
|
||||
span: ['col', 'colgroup'],
|
||||
src: [
|
||||
'audio',
|
||||
'embed',
|
||||
'iframe',
|
||||
'img',
|
||||
'input',
|
||||
'script',
|
||||
'source',
|
||||
'track',
|
||||
'video'
|
||||
],
|
||||
start: 'ol',
|
||||
tabindex: null,
|
||||
type: [
|
||||
'a',
|
||||
'link',
|
||||
'button',
|
||||
'embed',
|
||||
'object',
|
||||
'script',
|
||||
'source',
|
||||
'style',
|
||||
'input',
|
||||
'menu',
|
||||
'menuitem',
|
||||
'ol'
|
||||
],
|
||||
value: ['button', 'input', 'li'],
|
||||
width: ['canvas', 'embed', 'iframe', 'img', 'input', 'object', 'video']
|
||||
};
|
||||
|
||||
export function onAttrs() {
|
||||
return (attrs, node) => {
|
||||
const newAttrs = { ...attrs };
|
||||
Object.entries(attrs).forEach(([attrName, attrValue]) => {
|
||||
if (
|
||||
isEventHandler(attrName)
|
||||
|| (
|
||||
Object.hasOwnProperty.call(safeToRemoveAttrs, attrName)
|
||||
&& (
|
||||
safeToRemoveAttrs[attrName] === null
|
||||
|| safeToRemoveAttrs[attrName].includes(node.tag)
|
||||
)
|
||||
)
|
||||
) {
|
||||
if (typeof attrValue === 'string') {
|
||||
if (attrValue === '' || attrValue.trim() === '') {
|
||||
delete newAttrs[attrName];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return newAttrs;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user