w3co / jcf

Advanced form elements customization using CSS/JS
MIT License
202 stars 55 forks source link

Thought about libraries other than jquery? #17

Open ghost opened 8 years ago

ghost commented 8 years ago

I'm not putting this here in a finger pointing way and I have no intention about debating wether jquery is either way too big or too slow or whatever, but would you guys be interested in supporting other libraries in the future?

I was thinking about hammer.js for example. or you could compile parts of jquery to the mere minimum you ever use to trimm it down a little? angular maybe? You name it...

Anyways, this stuff is awesome none the less. Worked out like a charm for my last project.

Cheers

inferpse commented 8 years ago

Hey, @Puddingboy !

jQuery was mainly used in current version because JCF heavily relies on DOM and Events manipulations, and of course it helps to support old IE browsers. Now these browsers are dead, so jQuery code could be replaced with much more transparent and shorter one.

There'll definitely be a pure JavaScript implementation without any external dependencies. This way it could be used with any library/framework without any problems.

ghost commented 8 years ago

Any chance a vanilla js version of jcf may pop up in the near future?

inferpse commented 8 years ago

Actually there was a vanilla js version of JCF few years ago, but it had its own "jQuery implementation". That implementation was not as good as jQuery and increased amount of js file size. Looks like now we can drop support for IE6-8, so this implementation could be much smaller and performant.

Not sure about nearest future but I think vanilla js version might be released later this year. Let's keep this issue open until it will be released :)

ghost commented 8 years ago

Any serious issues you are already thinking of in terms of dropping jquery?

inferpse commented 8 years ago

We use only several methods from jQuery and if we don't need to support attachEvent and other stuff we could replace jQuery dependency to the own small core with DOM helper methods. But when jQuery will be available it still could use jQuery, but not sure that this is really needed in case we'll have our own core.

ghost commented 8 years ago

I have a suggestion to push hidden elements further out of the screens view. 4k screens are becoming more common and even if they are invisible I kind of just think it's "right" to push it further away. Maybe assuming 6k would be even better.

I have no science or proof to hold my claim of it being better. I just feel this way, so you can take it with a grain of salt. I play around in dev mode of chrome a lot and when I see this supposedly hidden element on the side it just feels a bit off.

It's a bit comparable with having having a small peel of popcorn behind your teeth and no fiddling can reach it. You know it's there and you can't do anything about it. Or that itch on your back that is just far enough to put your arms in an uncomfortable position... Something along those lines... I suppose it's actually a pretty nasty feeling

inferpse commented 8 years ago

@Puddingboy I'm not sure I understand you...

Real form fields are hidden with -9999px offset. Can you please provide a screenshot with the issue?

ghost commented 8 years ago

My bad for the late response, I had caused that issue myself as I was fiddling around with stuff. It had nothing to do with your code.

I am still giddy waiting for a vannilla js version

patrickcate commented 8 years ago

I'd love to see a pure JS version as well.

inferpse commented 8 years ago

@Puddingboy @patrickcate I'm just curious, what about browser support? Desired IE version?

patrickcate commented 8 years ago

IE 10 support would be nice, but I'd settle for IE 11.

ghost commented 8 years ago

I kinda wanna vote for IE9+ and want to drop everything before that. That way you can still make use of classList and addEventlistener. I was actually rather disappointed to see that IE8 still holds some marketshare. This way we can make use of:

<!--[if lt IE 9]>
Burn in hell you filthy IE8 peasants!!!
<![endif]-->

I would suggest feature detection as some mobile devices can be quirky. That way we can make use of polyfills where needed.

You would be suprised how often ie9 still pops up in b2b situations. Better to have something that at least works and displays properly. Special features such as css transitions don't need fallback.