motion-dom 13.3.0 → 13.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/animation/generators/keyframes.mjs +1 -1
- package/dist/es/animation/generators/keyframes.mjs.map +1 -1
- package/dist/es/effects/svg/index.mjs +5 -3
- package/dist/es/effects/svg/index.mjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/motion-dom.dev.js +5 -4
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "e
|
|
|
14
14
|
*/
|
|
15
15
|
const easingFunctions = isEasingArray(ease)
|
|
16
16
|
? ease.map(easingDefinitionToFunction)
|
|
17
|
-
: easingDefinitionToFunction(ease);
|
|
17
|
+
: easingDefinitionToFunction(ease) || easeInOut;
|
|
18
18
|
/**
|
|
19
19
|
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
|
|
20
20
|
* to reduce GC during animation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyframes.mjs","sources":["../../../../src/animation/generators/keyframes.ts"],"sourcesContent":["import {\n clamp,\n easeInOut,\n easingDefinitionToFunction,\n EasingFunction,\n isEasingArray,\n MotionGlobalConfig,\n} from \"motion-utils\"\nimport { interpolate } from \"../../utils/interpolate\"\nimport { mix } from \"../../utils/mix\"\nimport { defaultOffset } from \"../keyframes/offsets/default\"\nimport { convertOffsetToTimes } from \"../keyframes/offsets/time\"\nimport {\n AnimationState,\n AnyResolvedKeyframe,\n KeyframeGenerator,\n ValueAnimationOptions,\n} from \"../types\"\n\nexport function defaultEasing(\n values: any[],\n easing?: EasingFunction\n): EasingFunction[] {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1)\n}\n\nexport function keyframes<T extends AnyResolvedKeyframe>({\n duration = 300,\n keyframes: keyframeValues,\n times,\n ease = \"easeInOut\",\n}: ValueAnimationOptions<T>): KeyframeGenerator<T> {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease)\n\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state: AnimationState<T> = {\n done: false,\n value: keyframeValues[0],\n }\n\n /**\n * Fast setup path for two keyframes one easing.\n */\n if (\n keyframeValues.length === 2 &&\n !Array.isArray(easingFunctions) &&\n (!times ||\n times.length !== 2 ||\n (times[0] === 0 && times[1] === 1))\n ) {\n const [origin, target] = keyframeValues\n const mixer =\n origin === target\n ? undefined\n : (MotionGlobalConfig.mix || mix)(origin, target)\n\n return {\n calculatedDuration: duration,\n next: (t: number) => {\n state.value = mixer\n ? mixer(\n easingFunctions(\n duration > 0 ? clamp(0, 1, t / duration) : 1\n )\n )\n : target\n state.done = t >= duration\n return state\n },\n }\n }\n\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length\n ? times\n : defaultOffset(keyframeValues),\n duration\n )\n\n const mapTimeToKeyframe = interpolate<T>(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions)\n ? easingFunctions\n : defaultEasing(keyframeValues, easingFunctions),\n })\n\n return {\n calculatedDuration: duration,\n next: (t: number) => {\n state.value = mapTimeToKeyframe(t)\n state.done = t >= duration\n return state\n },\n }\n}\n"],"names":[],"mappings":";;;;;;AAmBM,SAAU,aAAa,CACzB,MAAa,EACb,MAAuB,EAAA;IAEvB,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7E;SAEgB,SAAS,CAAgC,EACrD,QAAQ,GAAG,GAAG,EACd,SAAS,EAAE,cAAc,EACzB,KAAK,EACL,IAAI,GAAG,WAAW,GACK,EAAA;AACvB;;;AAGG;AACH,IAAA,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI;AACtC,UAAE,IAAI,CAAC,GAAG,CAAC,0BAA0B;AACrC,UAAE,0BAA0B,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"keyframes.mjs","sources":["../../../../src/animation/generators/keyframes.ts"],"sourcesContent":["import {\n clamp,\n easeInOut,\n easingDefinitionToFunction,\n EasingFunction,\n isEasingArray,\n MotionGlobalConfig,\n} from \"motion-utils\"\nimport { interpolate } from \"../../utils/interpolate\"\nimport { mix } from \"../../utils/mix\"\nimport { defaultOffset } from \"../keyframes/offsets/default\"\nimport { convertOffsetToTimes } from \"../keyframes/offsets/time\"\nimport {\n AnimationState,\n AnyResolvedKeyframe,\n KeyframeGenerator,\n ValueAnimationOptions,\n} from \"../types\"\n\nexport function defaultEasing(\n values: any[],\n easing?: EasingFunction\n): EasingFunction[] {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1)\n}\n\nexport function keyframes<T extends AnyResolvedKeyframe>({\n duration = 300,\n keyframes: keyframeValues,\n times,\n ease = \"easeInOut\",\n}: ValueAnimationOptions<T>): KeyframeGenerator<T> {\n /**\n * Easing functions can be externally defined as strings. Here we convert them\n * into actual functions.\n */\n const easingFunctions = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease) || easeInOut\n\n /**\n * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n * to reduce GC during animation.\n */\n const state: AnimationState<T> = {\n done: false,\n value: keyframeValues[0],\n }\n\n /**\n * Fast setup path for two keyframes one easing.\n */\n if (\n keyframeValues.length === 2 &&\n !Array.isArray(easingFunctions) &&\n (!times ||\n times.length !== 2 ||\n (times[0] === 0 && times[1] === 1))\n ) {\n const [origin, target] = keyframeValues\n const mixer =\n origin === target\n ? undefined\n : (MotionGlobalConfig.mix || mix)(origin, target)\n\n return {\n calculatedDuration: duration,\n next: (t: number) => {\n state.value = mixer\n ? mixer(\n easingFunctions(\n duration > 0 ? clamp(0, 1, t / duration) : 1\n )\n )\n : target\n state.done = t >= duration\n return state\n },\n }\n }\n\n /**\n * Create a times array based on the provided 0-1 offsets\n */\n const absoluteTimes = convertOffsetToTimes(\n // Only use the provided offsets if they're the correct length\n // TODO Maybe we should warn here if there's a length mismatch\n times && times.length === keyframeValues.length\n ? times\n : defaultOffset(keyframeValues),\n duration\n )\n\n const mapTimeToKeyframe = interpolate<T>(absoluteTimes, keyframeValues, {\n ease: Array.isArray(easingFunctions)\n ? easingFunctions\n : defaultEasing(keyframeValues, easingFunctions),\n })\n\n return {\n calculatedDuration: duration,\n next: (t: number) => {\n state.value = mapTimeToKeyframe(t)\n state.done = t >= duration\n return state\n },\n }\n}\n"],"names":[],"mappings":";;;;;;AAmBM,SAAU,aAAa,CACzB,MAAa,EACb,MAAuB,EAAA;IAEvB,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7E;SAEgB,SAAS,CAAgC,EACrD,QAAQ,GAAG,GAAG,EACd,SAAS,EAAE,cAAc,EACzB,KAAK,EACL,IAAI,GAAG,WAAW,GACK,EAAA;AACvB;;;AAGG;AACH,IAAA,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI;AACtC,UAAE,IAAI,CAAC,GAAG,CAAC,0BAA0B;AACrC,UAAE,0BAA0B,CAAC,IAAI,CAAC,IAAI,SAAS;AAEnD;;;AAGG;AACH,IAAA,MAAM,KAAK,GAAsB;AAC7B,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;KAC3B;AAED;;AAEG;AACH,IAAA,IACI,cAAc,CAAC,MAAM,KAAK,CAAC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AAS,KAAI;AAChB,YAAA,KAAK,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC;AAClC,YAAA,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,QAAQ;AAC1B,YAAA,OAAO,KAAK;QAChB,CAAC;KACJ;AACL;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isCSSVar } from '../../render/dom/is-css-var.mjs';
|
|
1
2
|
import { camelToDash } from '../../render/dom/utils/camel-to-dash.mjs';
|
|
2
3
|
import { cssStyleProperties } from '../../render/svg/utils/build-attrs.mjs';
|
|
3
4
|
import { transformProps } from '../../render/utils/keys-transform.mjs';
|
|
@@ -38,13 +39,14 @@ const addSVGValue = (element, state, key, value) => {
|
|
|
38
39
|
else if (key.startsWith("attr")) {
|
|
39
40
|
return addAttrValue(element, state, key, value, convertAttrKey(key));
|
|
40
41
|
}
|
|
41
|
-
const handler = key in element.style ? addStyleValue : addAttrValue;
|
|
42
|
+
const handler = isCSSVar(key) || key in element.style ? addStyleValue : addAttrValue;
|
|
42
43
|
return handler(element, state, key, value);
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* Reads the current value of `key` from an SVG element as the origin of
|
|
46
47
|
* an animation, as the SVG VisualElement does: transforms start from
|
|
47
|
-
* their defaults, the few CSS-only properties come from
|
|
48
|
+
* their defaults, CSS variables and the few CSS-only properties come from
|
|
49
|
+
* computed style
|
|
48
50
|
* and everything else is read from the attribute, dash-cased
|
|
49
51
|
* (`strokeWidth` -> `stroke-width`) or, failing that, as written
|
|
50
52
|
* (`baseFrequency`).
|
|
@@ -53,7 +55,7 @@ const readSVGValue = (element, key) => {
|
|
|
53
55
|
if (transformProps.has(key)) {
|
|
54
56
|
return numberValueTypes[key]?.default || 0;
|
|
55
57
|
}
|
|
56
|
-
if (cssStyleProperties.includes(key)) {
|
|
58
|
+
if (isCSSVar(key) || cssStyleProperties.includes(key)) {
|
|
57
59
|
return readStyleValue(element, key);
|
|
58
60
|
}
|
|
59
61
|
key = convertAttrKey(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/effects/svg/index.ts"],"sourcesContent":["import { frame } from \"../../frameloop\"\nimport { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\nimport { cssStyleProperties } from \"../../render/svg/utils/build-attrs\"\nimport { transformProps } from \"../../render/utils/keys-transform\"\nimport { isSVGElement } from \"../../utils/is-svg-element\"\nimport { MotionValue } from \"../../value\"\nimport { numberValueTypes } from \"../../value/types/maps/number\"\nimport { addAttrValue } from \"../attr\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { addStyleValue, readStyleValue } from \"../style\"\nimport { createSelectorEffect } from \"../utils/create-dom-effect\"\nimport { createEffect } from \"../utils/create-effect\"\n\nfunction addSVGPathValue(\n element: SVGElement,\n state: MotionValueState,\n key: string,\n value: MotionValue\n) {\n frame.render(() => element.setAttribute(\"pathLength\", \"1\"))\n\n if (key === \"pathOffset\") {\n return state.set(key, value, () => {\n // Use unitless value to avoid Safari zoom bug\n const offset = value.get()\n element.setAttribute(\"stroke-dashoffset\", `${-offset}`)\n })\n } else {\n if (!state.get(\"stroke-dasharray\")) {\n state.set(\"stroke-dasharray\", new MotionValue(\"1 1\"), () => {\n const pathLength = state.get(\"pathLength\")?.get() ?? 1\n const pathSpacing = state.get(\"pathSpacing\")?.get()\n\n // Use unitless values to avoid Safari zoom bug\n element.setAttribute(\n \"stroke-dasharray\",\n `${pathLength} ${pathSpacing ?? 1 - Number(pathLength)}`\n )\n })\n }\n\n return state.set(key, value, undefined, state.get(\"stroke-dasharray\"))\n }\n}\n\nexport const addSVGValue = (\n element: SVGElement,\n state: MotionValueState,\n key: string,\n value: MotionValue\n) => {\n if (key.startsWith(\"path\")) {\n return addSVGPathValue(element, state, key, value)\n } else if (key.startsWith(\"attr\")) {\n return addAttrValue(element, state, key, value, convertAttrKey(key))\n }\n\n const handler
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/effects/svg/index.ts"],"sourcesContent":["import { frame } from \"../../frameloop\"\nimport { isCSSVar } from \"../../render/dom/is-css-var\"\nimport { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\nimport { cssStyleProperties } from \"../../render/svg/utils/build-attrs\"\nimport { transformProps } from \"../../render/utils/keys-transform\"\nimport { isSVGElement } from \"../../utils/is-svg-element\"\nimport { MotionValue } from \"../../value\"\nimport { numberValueTypes } from \"../../value/types/maps/number\"\nimport { addAttrValue } from \"../attr\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { addStyleValue, readStyleValue } from \"../style\"\nimport { createSelectorEffect } from \"../utils/create-dom-effect\"\nimport { createEffect } from \"../utils/create-effect\"\n\nfunction addSVGPathValue(\n element: SVGElement,\n state: MotionValueState,\n key: string,\n value: MotionValue\n) {\n frame.render(() => element.setAttribute(\"pathLength\", \"1\"))\n\n if (key === \"pathOffset\") {\n return state.set(key, value, () => {\n // Use unitless value to avoid Safari zoom bug\n const offset = value.get()\n element.setAttribute(\"stroke-dashoffset\", `${-offset}`)\n })\n } else {\n if (!state.get(\"stroke-dasharray\")) {\n state.set(\"stroke-dasharray\", new MotionValue(\"1 1\"), () => {\n const pathLength = state.get(\"pathLength\")?.get() ?? 1\n const pathSpacing = state.get(\"pathSpacing\")?.get()\n\n // Use unitless values to avoid Safari zoom bug\n element.setAttribute(\n \"stroke-dasharray\",\n `${pathLength} ${pathSpacing ?? 1 - Number(pathLength)}`\n )\n })\n }\n\n return state.set(key, value, undefined, state.get(\"stroke-dasharray\"))\n }\n}\n\nexport const addSVGValue = (\n element: SVGElement,\n state: MotionValueState,\n key: string,\n value: MotionValue\n) => {\n if (key.startsWith(\"path\")) {\n return addSVGPathValue(element, state, key, value)\n } else if (key.startsWith(\"attr\")) {\n return addAttrValue(element, state, key, value, convertAttrKey(key))\n }\n\n const handler =\n isCSSVar(key) || key in element.style ? addStyleValue : addAttrValue\n return handler(element, state, key, value)\n}\n\n/**\n * Reads the current value of `key` from an SVG element as the origin of\n * an animation, as the SVG VisualElement does: transforms start from\n * their defaults, CSS variables and the few CSS-only properties come from\n * computed style\n * and everything else is read from the attribute, dash-cased\n * (`strokeWidth` -> `stroke-width`) or, failing that, as written\n * (`baseFrequency`).\n */\nexport const readSVGValue = (element: SVGElement, key: string) => {\n if (transformProps.has(key)) {\n return numberValueTypes[key]?.default || 0\n }\n\n if (isCSSVar(key) || cssStyleProperties.includes(key)) {\n return readStyleValue(element, key)\n }\n\n key = convertAttrKey(key)\n\n return (\n element.getAttribute(camelToDash(key)) ??\n element.getAttribute(key) ??\n undefined\n )\n}\n\n/**\n * The per-element effect `animate()` binds through, so SVG values share\n * state with a direct `svgEffect()` call.\n */\nexport const svgSubjectEffect = /*@__PURE__*/ createEffect(addSVGValue, {\n test: isSVGElement,\n read: readSVGValue,\n})\n\nexport const svgEffect = /*@__PURE__*/ createSelectorEffect(svgSubjectEffect)\n\nfunction convertAttrKey(key: string) {\n return key.replace(/^attr([A-Z])/, (_, firstChar) =>\n firstChar.toLowerCase()\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAcA,SAAS,eAAe,CACpB,OAAmB,EACnB,KAAuB,EACvB,GAAW,EACX,KAAkB,EAAA;AAElB,IAAA,KAAK,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AAE3D,IAAA,IAAI,GAAG,KAAK,YAAY,EAAE;QACtB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,MAAK;;AAE9B,YAAA,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE;YAC1B,OAAO,CAAC,YAAY,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAA,CAAE,CAAC;AAC3D,QAAA,CAAC,CAAC;IACN;SAAO;QACH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE;AAChC,YAAA,KAAK,CAAC,GAAG,CAAC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AAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,gBAAgB,CAAC,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC;IAC9C;AAEA,IAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AACnD,QAAA,OAAO,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC;IACvC;AAEA,IAAA,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC;IAEzB,QACI,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AACtC,QAAA,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzB,QAAA,SAAS;AAEjB;AAEA;;;AAGG;MACU,gBAAgB,iBAAiB,YAAY,CAAC,WAAW,EAAE;AACpE,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,IAAI,EAAE,YAAY;AACrB,CAAA;AAEM,MAAM,SAAS,iBAAiB,oBAAoB,CAAC,gBAAgB;AAE5E,SAAS,cAAc,CAAC,GAAW,EAAA;AAC/B,IAAA,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,SAAS,KAC5C,SAAS,CAAC,WAAW,EAAE,CAC1B;AACL;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3404,7 +3404,8 @@ declare const addSVGValue: (element: SVGElement, state: MotionValueState, key: s
|
|
|
3404
3404
|
/**
|
|
3405
3405
|
* Reads the current value of `key` from an SVG element as the origin of
|
|
3406
3406
|
* an animation, as the SVG VisualElement does: transforms start from
|
|
3407
|
-
* their defaults, the few CSS-only properties come from
|
|
3407
|
+
* their defaults, CSS variables and the few CSS-only properties come from
|
|
3408
|
+
* computed style
|
|
3408
3409
|
* and everything else is read from the attribute, dash-cased
|
|
3409
3410
|
* (`strokeWidth` -> `stroke-width`) or, failing that, as written
|
|
3410
3411
|
* (`baseFrequency`).
|
package/dist/motion-dom.dev.js
CHANGED
|
@@ -1346,7 +1346,7 @@
|
|
|
1346
1346
|
*/
|
|
1347
1347
|
const easingFunctions = motionUtils.isEasingArray(ease)
|
|
1348
1348
|
? ease.map(motionUtils.easingDefinitionToFunction)
|
|
1349
|
-
: motionUtils.easingDefinitionToFunction(ease);
|
|
1349
|
+
: motionUtils.easingDefinitionToFunction(ease) || motionUtils.easeInOut;
|
|
1350
1350
|
/**
|
|
1351
1351
|
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
|
|
1352
1352
|
* to reduce GC during animation.
|
|
@@ -5309,13 +5309,14 @@
|
|
|
5309
5309
|
else if (key.startsWith("attr")) {
|
|
5310
5310
|
return addAttrValue(element, state, key, value, convertAttrKey(key));
|
|
5311
5311
|
}
|
|
5312
|
-
const handler = key in element.style ? addStyleValue : addAttrValue;
|
|
5312
|
+
const handler = isCSSVar(key) || key in element.style ? addStyleValue : addAttrValue;
|
|
5313
5313
|
return handler(element, state, key, value);
|
|
5314
5314
|
};
|
|
5315
5315
|
/**
|
|
5316
5316
|
* Reads the current value of `key` from an SVG element as the origin of
|
|
5317
5317
|
* an animation, as the SVG VisualElement does: transforms start from
|
|
5318
|
-
* their defaults, the few CSS-only properties come from
|
|
5318
|
+
* their defaults, CSS variables and the few CSS-only properties come from
|
|
5319
|
+
* computed style
|
|
5319
5320
|
* and everything else is read from the attribute, dash-cased
|
|
5320
5321
|
* (`strokeWidth` -> `stroke-width`) or, failing that, as written
|
|
5321
5322
|
* (`baseFrequency`).
|
|
@@ -5324,7 +5325,7 @@
|
|
|
5324
5325
|
if (transformProps.has(key)) {
|
|
5325
5326
|
return numberValueTypes[key]?.default || 0;
|
|
5326
5327
|
}
|
|
5327
|
-
if (cssStyleProperties.includes(key)) {
|
|
5328
|
+
if (isCSSVar(key) || cssStyleProperties.includes(key)) {
|
|
5328
5329
|
return readStyleValue(element, key);
|
|
5329
5330
|
}
|
|
5330
5331
|
key = convertAttrKey(key);
|