Skip to content

Commit

Permalink
Faster if a little more verbose case insensitive 'on' match (#275)
Browse files Browse the repository at this point in the history
Order of magnitude+ faster than regexp, see:
https://jsfiddle.net/c2h5oh/rr9b6Leb/1/
  • Loading branch information
c2h5oh authored and developit committed Aug 18, 2016
1 parent a495b9d commit f7956ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function setAccessor(node, name, value, old, isSvg) {
else if (name==='dangerouslySetInnerHTML') {
if (value) node.innerHTML = value.__html;
}
else if (name.match(/^on/i)) {
else if ((name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
let l = node._listeners || (node._listeners = {});
name = toLowerCase(name.substring(2));
if (value) {
Expand Down

0 comments on commit f7956ff

Please sign in to comment.