perf(core): use startsWith instead of indexOf (#989)

This commit is contained in:
Andrew Talbot
2020-04-20 15:44:20 -04:00
committed by GitHub
parent 9e26be2c26
commit 054ccecd58
4 changed files with 4 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ export function patchAttr(
value: any,
isSVG: boolean
) {
if (isSVG && key.indexOf('xlink:') === 0) {
if (isSVG && key.startsWith('xlink:')) {
if (value == null) {
el.removeAttributeNS(xlinkNS, key.slice(6, key.length))
} else {

View File

@@ -30,7 +30,7 @@ export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
default:
if (isOn(key)) {
// ignore v-model listeners
if (key.indexOf('onUpdate:') < 0) {
if (!key.startsWith('onUpdate:')) {
patchEvent(el, key, prevValue, nextValue, parentComponent)
}
} else if (