@hortonstudio/main 1.1.12 → 1.1.13
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/animations/hero.js +15 -3
- package/package.json +1 -1
package/animations/hero.js
CHANGED
@@ -255,11 +255,12 @@ export async function init() {
|
|
255
255
|
if (text && classes.length > 0) {
|
256
256
|
spanMappings.set(text, classes);
|
257
257
|
}
|
258
|
-
|
259
|
-
// Replace span with its text content to flatten HTML
|
260
|
-
span.replaceWith(document.createTextNode(span.textContent));
|
261
258
|
});
|
262
259
|
|
260
|
+
// Force single text node to eliminate all text node boundaries
|
261
|
+
const originalText = element.textContent;
|
262
|
+
element.textContent = originalText;
|
263
|
+
|
263
264
|
return spanMappings;
|
264
265
|
}
|
265
266
|
|
@@ -269,9 +270,20 @@ export async function init() {
|
|
269
270
|
|
270
271
|
splitInstance.words.forEach(wordElement => {
|
271
272
|
const wordText = wordElement.textContent.trim();
|
273
|
+
|
274
|
+
// Try exact match first
|
272
275
|
if (spanMappings.has(wordText)) {
|
273
276
|
const classes = spanMappings.get(wordText);
|
274
277
|
wordElement.classList.add(...classes);
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
|
281
|
+
// Try case-insensitive and normalized match
|
282
|
+
for (const [spanText, classes] of spanMappings) {
|
283
|
+
if (wordText.toLowerCase() === spanText.toLowerCase()) {
|
284
|
+
wordElement.classList.add(...classes);
|
285
|
+
break;
|
286
|
+
}
|
275
287
|
}
|
276
288
|
});
|
277
289
|
}
|