Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit bda673f

Browse files
committed
perf(jqLite): don't use String#split in on() unless we need it
1 parent b678f31 commit bda673f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/jqLite.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,8 @@ forEach({
734734
if (!events) jqLiteExpandoStore(element, 'events', events = {});
735735
if (!handle) jqLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events));
736736

737-
var types = type.split(' ');
737+
// http://jsperf.com/string-indexof-vs-split
738+
var types = type.indexOf(' ') ? type.split(' ') : [type];
738739
var i = types.length;
739740

740741
while (i--) {

0 commit comments

Comments
 (0)