Hacker News new | ask | show | jobs
by gildas 4808 days ago
> You'll find yourself needing a method to add or remove classes eficiently. So you'll rewrite .addClass() and .removeClass()

You don't need to rewrite it, cf. this shim [1] for example.

> Then you'll need a clean way to make Ajax and callbacks. You'll rewrite .ajax() and .when()

They are plenty of good Ajax implementations, for example this one [2]. If you need promises, there are good libraries too [3].

> Then you'll need to fade something in all browser. So you'll rewrite .animate()

Applying a fading effect on an element shouldn't be a mandatory feature. You can just use CSS3.

[1] https://developer.mozilla.org/en-US/docs/DOM/element.classLi...

[2] http://jibbering.com/2002/4/httprequest.html

[3] https://github.com/kriskowal/q

1 comments

Client: I want this element to fade out. Me: No problem but only on browsers with CSS3 support. Client: What is CSS3? Me: Let me say it differently, it wont work on some browsers. Client: Why, is it hard to do? Me: Not really, but I would need to use an open source library to do it. Client: But don't you usually tell me that that's a good thing. Me: Yes but see yesterday I someone on the Internet said it should not be a mandatory feature. Client: You are fired.
The only major issue is with using CSS3 for animations (not transitions). IE generally handles it by adopting the new style state instead of animating.

http://caniuse.com/#search=css3