devpunks / snuggsi

snuggsi ツ - Easy Custom Elements in ~1kB
https://snuggsi.com
MIT License
398 stars 17 forks source link

🎉 🎉 #100 🎉 🎉 Element.select `body ${a}` and Element.selectAll `body ${b}` String Interpolation #100

Closed snuggs closed 7 years ago

snuggs commented 7 years ago

🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 #100 W00T 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

FIxes #99

Effected Web API Interface(s)

ParentNode

snuggs commented 7 years ago

@brandondees @tmornini @RobertChristopher @dcchuck @pachonk this is a great first pass and works. However... Not very "[Tsuッ style](https://en.wikipedia.org/wiki/Tsu(kana))" (A name i'm giving the style you are asking about hence the logo)_ and can be refactored more if i know me.

A great reason to refactor more is we only have about 1 or two features more at this LOC before we break our validate-weight routine. This diff adds about 1kB (compressed) to core.

Reference Links

The following diff seems too imperative. Especially the part about checking if the fragments are an Array or not. And the Array.prototype.forEach () feels more like an Array.prototype.reduce () . Functional programming #FTW. Will try a couple patterns out... capture d ecran 2017-07-10 a 06 05 17

snuggs commented 7 years ago

MUCH Better TsuッDECLARATIVE vs Imperative is real!

And (spoiler alert) SOYLENT GREEN IS PEOPLE 👨‍👩‍👦‍👦 @tmornini

capture d ecran 2017-07-10 a 07 21 43

snuggs commented 7 years ago

Much better performance as well. Taking about `100μ (m or 0.1ms) capture d ecran 2017-07-10 a 07 35 54 capture d ecran 2017-07-10 a 07 30 55

to go through selection process.

brandondees commented 7 years ago

that wp link doesn't provide info on what the word actually means! i'm gonna leave this one open to come back to and read properly though.

snuggs commented 7 years ago

@brandondees "Glottal Stop" is the term. In Japanese without it would be a totally different word understanding. Same as in English as well. think "UH-OH" it's the hyphen. Think function (args) it's the space. The definition is literally a getting back to "nothing" before continuing otherwise will be a run-on and communication overload. The "butt(here)'n" in "button" when you say it. A (dramatic) pause between sentences to give people a chance to catch up. Kinda like how the front end is these days. @robcole may have a better Japanese lesson than that but it's as simple as "Uh-Oh" https://en.wikipedia.org/wiki/Glottal_stop

If you asked the average teenager they would say ummm.... or like... between phrases where there should be a pause. https://www.extension.harvard.edu/inside-extension/tips-public-speaking-eliminating-dreaded-um

snuggs commented 7 years ago

@tmornini capture d ecran 2017-07-10 a 23 58 12

snuggs commented 7 years ago

@brandondees @pachonk @tmornini 🏆 this turned out better than expected. Converting to Tsuツ style shrunk feature down from 1kB to 30byte addition to core (1270OCTETS ➡️ 1300OCTETS)

Total compression a 90% savings (rounding down @tmornini 😎 )

FWIW our GZIP and ZLIB formats are (just) below 1500OCTETS as well now. Transpiled snuggsi.min.js.br file is above 1500 but people who need these versions should feel the (byte) squeeze to upgrade to at least the latest version of their respective browsers anyways ;-) capture d ecran 2017-07-11 a 06 31 54

snuggs commented 7 years ago

@brandondees perfect example of "Glottal Stop" in english. Mixin is NOT the same as Mix-In.

With ES6 and with prononciation. capture d ecran 2017-07-11 a 10 44 39