Skip to content

Commit

Permalink
refactor: See if first letter check is necessary for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Jun 25, 2024
1 parent 17fee02 commit 798052a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/diff/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ let eventClock = 0;
*/
export function setProperty(dom, name, value, oldValue, namespace) {
let useCapture, prefix;
if (name[0] == 'a' || name[0] == 'p') {
let idx = name.indexOf(':');
if (idx > -1) {
// Only slices here, should be faster than array allocation
prefix = name.slice(0, idx);
name = name.slice(idx + 1);
}
let idx = name.indexOf(':');
if (idx > -1) {
// Only slices here, should be faster than array allocation
prefix = name.slice(0, idx);
name = name.slice(idx + 1);
}

o: if (name === 'style') {
Expand Down

0 comments on commit 798052a

Please sign in to comment.