javascript - requestAnimationFrame polyfill: what's the element parameter for? -
i using requestanimationframe polyfill erik möller (fixes paul irish , tino zijdel) , wondering second parameter called "element" for.
here code:
(function() { var lasttime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestanimationframe; ++x) { window.requestanimationframe = window[vendors[x]+'requestanimationframe']; window.cancelanimationframe = window[vendors[x]+'cancelanimationframe'] || window[vendors[x]+'cancelrequestanimationframe']; } if (!window.requestanimationframe) window.requestanimationframe = function(callback, element) { var currtime = new date().gettime(); var timetocall = math.max(0, 16 - (currtime - lasttime)); var id = window.settimeout(function() { callback(currtime + timetocall); }, timetocall); lasttime = currtime + timetocall; return id; }; if (!window.cancelanimationframe) window.cancelanimationframe = function(id) { cleartimeout(id); }; }());
so question line:
window.requestanimationframe = function(callback, element) {
what "element" do?
thank in advance,
joan
according w3c draft, no element
parameter passed function. @ least now.
as can see, there an issue suggest addition of such parameter. issue considered not necessary first version of spec. , has been closed.
i think can ignore parameter.