-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider removing Proxy for creating functional component notation (div.. button... etc) #33
Comments
I believe these were removed in the latest verison. |
@styfle still seems to be in the latest commit:
|
Oh you're right. It seems like it could be removed if it makes it smaller. Using /cc @wavesoft |
New dot-dom, with different notation and minus the proxy method. |
Hey guys, glad to see that you are creating tiny forks that fits in the comments 😄 This example has some repeating statements, but they cannot really be minified further: R(
H('div',
H('span', 'Hello '),
H('strong', 'world '),
H('span', 'how are you '),
H('span', 'doing '),
H('strong', 'today?')
),
document.body
) However this, has more specific variable reference and it can help minifiers reduce the final size even further: const {div, span, strong} = H;
R(
div(
span('Hello '),
strong('world '),
span('how are you '),
span('doing '),
strong('today?')
)
) |
Ps. Don't forget the awesome className shorthand you can get with the proxy 😉 : R(div.primary.otherclass('hello'), document.body); |
@wavesoft okay awesome. Well, I see your point now. I think I can just do a wrapper anyway for my notation. |
well, you could also write all the 'div' strings in a constant for example. That would solve that problem. div(...) and h(DIV, ...) is a two byte difference just about (i.e the "H" and the ","). |
I understand we want components to be written like
button(
ordiv(
.. But if we are aiming for size.. just strict policy H('div',... H('button'.... would do just fine. Considering people use these things with transpires and libs like hyperx anyway, it's less of a concern to actually functionally notatebutton
ordiv
... if people want this, they can just write a small wrapper around it.. but it shouldn't be in the base engine Very few actually write by hand functional notation of the elements. This will save you a lot of bytes for doing other more important things. The className thing seems to be pretty important, so I understand the needs there.Anyway, just a thought.
The text was updated successfully, but these errors were encountered: