Skip to content

Fix module compatibility, SVG className crash, deprecated API and also add TypeScript types - #387

Open
Tejakshaya wants to merge 1 commit into
mattdelacdev:masterfrom
Tejakshaya:fix/module-compat-svg-classname-types
Open

Fix module compatibility, SVG className crash, deprecated API and also add TypeScript types#387
Tejakshaya wants to merge 1 commit into
mattdelacdev:masterfrom
Tejakshaya:fix/module-compat-svg-classname-types

Conversation

@Tejakshaya

Copy link
Copy Markdown
  • fixed getComputedStyle polyfill crashing in module contexts (React, Vue, ES modules) where this is undefined
  • replaced deprecated getPropertyCSSValue() with getPropertyValue() (removed from Chrome since v41)
  • fixed show() and resetAnimation() crashing on SVG elements by replacing className manipulation with classList API
  • added TypeScript type definitions (dist/wow.d.ts) and types field in package.json

Changes:

getComputedStyle polyfill ( fixes issues #352 and #372 ) -> the polyfill set this.getPropertyValue = ... and returned this, but in strict mode / module scope, this is undefined which causes Cannot set properties of undefined (setting 'getPropertyValue'). Now creates and returns a plain object instead

Deprecated getPropertyCSSValue ( fixes #358 ) -> vendorCSS() used getPropertyCSSValue() which was removed from Chrome in v41 (2015) and was replaced with getPropertyValue() and also simplified animationName() by removing the completley unnecessary try/catch and .cssText access

SVG className (fixes #349) -> show() and resetAnimation() used element.className directly which returns an SVGAnimatedString on SVG elements and replaced with classList.add() / classList.remove() which work on both HTML and SVG elements, also supersedes #354 ( stale since 2021, only fixed resetAnimation )

TypeScript types (fixes #351) -> added dist/wow.d.ts with type definitions for the WOW class and WOWOptions interface and now supports both default and named exports

Closes #349
Closes #351
Closes #352
Closes #358
Closes #372

Prexisting issue: The 'requestAnimationFrame' in window check on line 337 crashes when window is undefined but that's in the original code and out of scope

@veraLX

veraLX commented Jun 22, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants