Skip to content

Drop unneeded polyfill & Firefox prefix. #11

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

Merged
merged 1 commit into from
Feb 3, 2016
Merged

Conversation

mgol
Copy link
Collaborator

@mgol mgol commented Feb 2, 2014

  1. Firefox prefix hasn't been needed since v23 (we're on 26 now, in 2 days on 27; the last ESR is 24, ESR 17 is no longer supported)

  2. The polyfill for rAF wasn't used at all in the plugin and was contributing significantly to the file size. Similarly, cancelAnimationFrame was feature-detected but then not needed at all. I removed the polyfill & other unneeded parts, shaving off 158 bytes of 428 gzipped.

@gnarf
Copy link
Owner

gnarf commented Feb 3, 2014

I spent a bit of time thinking about wether or not to polyfill, eventually deciding I should, because people including a raf plugin would expect the polyfill.

I suppose I could be convinced otherwise?

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2014

IMO these are two completely separate things, making effects in jQuery depend on rAF and actually polyfilling it (and then not using the polyfilled version)... I didn't expect to find a polyfill here. But I might not be a typical user of the plugin. :)

I'd go for a note in README about this not being a rAF polyfill and maybe redirecting to the one by popularized by Paul Irish.

If you decide to keep the polyfill, I can refactor this patch - with only one vendor prefix left the previous iterating over array is not needed.

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2014

BTW, your README doesn't say anything about polyfilling rAF, only about making jQuery use it.

@gnarf
Copy link
Owner

gnarf commented Jan 8, 2016

If you wanted to update this without the polyfill (even safer now) I'd land it

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016

Rebased. I removed the webkit prefix now, too, though. If you look at http://caniuse.com/#feat=requestanimationframe you'll see the webkit prefix is only needed in old Chrome (irrelevant), Safari 6 & iOS 6.1. Those are old browsers, too, and they're rAF implementation has some bugs so it's even better to skip those implementations. That's also why jQuery 3.0.0 will use rAF only if available unprefixed (albeit with further fixes, i.e. using the Page Visibility API to restore paused animations when switching tabs).

You could also add a warning to README that this plugin should not be used with jQuery >= 3 as they use rAF by default and maybe you could even skip the whole logic and print a warning when such a jQuery is loaded?

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016

BTW, I can't get it to build... It uses the ancient Grunt 3, maybe it doesn't work in newer Node+npm setups?

/node_modules/.bin/grunt 
Loading "test.js" tasks and helpers...ERROR
>> Error: No such module: evals

Running "lint:files" (lint) task
Lint free.

Running "qunit:files" (qunit) task
Testing jquery.requestAnimationFrame.html
[HANGS HERE]

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016

I skipped the qunit task and it built. I've tested it manually later in Chrome.

@gnarf
Copy link
Owner

gnarf commented Feb 3, 2016

Think you might be able to update the ancientness and add some notes to the
readme about which versions this is good for?
On Feb 3, 2016 06:24, "Michał Gołębiowski" notifications@github.com wrote:

I skipped the qunit task and it built. I've tested it manually later in
Chrome.


Reply to this email directly or view it on GitHub
#11 (comment)
.

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016 via email

@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016

In the meantime this should be good to land, though, if it looks good to
you.

On Wed, Feb 3, 2016 at 5:18 PM, Michał Gołębiowski m.goleb@gmail.com
wrote:

I can't promise I'll have time for that within the next few days but I can
try to find some. :)

Michał Gołębiowski

gnarf added a commit that referenced this pull request Feb 3, 2016
Drop unneeded polyfill & Firefox prefix.
@gnarf gnarf merged commit 0a4bb2c into gnarf:master Feb 3, 2016
@mgol mgol deleted the cleanup+fx branch February 3, 2016 16:29
@mgol
Copy link
Collaborator Author

mgol commented Feb 3, 2016

...and of course I forgot to remove the comment about the polyfill that's no longer there. :)

@gnarf
Copy link
Owner

gnarf commented Feb 3, 2016

gave you push so feel free to fix on master ;)

On Wed, Feb 3, 2016 at 11:30 AM, Michał Gołębiowski <
notifications@github.com> wrote:

...and of course I forgot to remove the comment about the polyfill that's
no longer there. :)


Reply to this email directly or view it on GitHub
#11 (comment)
.

@mgol
Copy link
Collaborator Author

mgol commented Mar 16, 2016

I submitted a PR with the refactoring & lib updates (including an update to Grunt 0.4.5), PTAL: #16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants