Open SilentCicero opened 7 years ago
This might be related to issue #34
Perhaps this feature could take an array to explicitly enumerate options but also a function so that people can use conventions such as checking for the presence of a capital letter as is common in react land? I also think we could rework the parser so self-closing tags don't search for a closing element.
@substack re-work the parser, and make the policy strict: if /> then closed
. Dont allow <br>
only <br />
. I think this would be amazing.
You could then remove all this: 'area', 'base', 'basefont', 'bgsound', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr', '!--', // SVG TAGS 'animate', 'animateTransform', 'circle', 'cursor', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'font-face-format', 'font-face-name', 'font-face-uri', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'missing-glyph', 'mpath', 'path', 'polygon', 'polyline', 'rect', 'set', 'stop', 'tref', 'use', 'view', 'vkern'
@substack this would also speed up parsing times due to not having to test through this large string everytime.
@substack how would I go about implementing this, any directions, I could do a branch and PR?
In react a custom component can be notated like this:
<MyCustomComponent />
, in hyperx you have to notate is like this<MyCustomComponent><MyCustomComponent>
.I would like to notate optionally closable, non-html tags that could or could not be closed at the end.
So I would register with hyperx these in opts, under
optionallySelfClosing: []
. If they are closed (i.e. ending with/>
) then they are treated as closed tags. If they are not (i.e. ending in>
) then they have children and are not yet closed.Another way would be to have a
loose
setting inopts
. Where any tag, html or otherwise could be optional open or closed. However, this seems like more work to implement.