Removing jQuery event properties
JavaScript performance comparison
Info
event.layerX & event.layerY will be removed from WebKit soon. Every jQuery-bound event handler now logs this warning:
event.layerXandevent.layerYare broken and deprecated in WebKit. They will be removed from the engine in the near future.
Screenshot: 
See jQuery bug #10531.
It’s possible to prevent jQuery from copying these properties over to its event objects, but what is the fastest way of doing this?
These snippets don’t do exactly the same, but they all have a similar effect: the layerX and layerY properties aren’t copied to jQuery event objects anymore.
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
var props = $.event.props;
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
join, replace, and split |
|
pending… |
Using $.map |
|
pending… |
while loop + delete |
|
pending… |
while loop + new array |
|
pending… |
for loop + delete |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Mathias Bynens and last updated
- Revision 2: published by Martin Borthiry
- Revision 3: published
- Revision 4: published
- Revision 6: published
- Revision 7: published by Timmy Willison
- Revision 8: published
- Revision 9: published
- Revision 10: published by mekwall
0 comments