CreateJS was originally built to handle browser inconsistencies during the fragmented era of web development (2010-2015). Now in 2026, browsers are standardized and many legacy workarounds are no longer needed. This document outlines a comprehensive plan to modernize the CreateJS suite (EaselJS, TweenJS, SoundJS, PreloadJS) while maintaining API compatibility.
I employed AI to help review the legacy codebase to eliminate code that is now redundant. I think there are some very compelling suggestions which lead to a 20%+ reduction in code.
My Proposed Goals
- Remove ~5,000+ lines of dead/legacy code
- Reduce bundle sizes by 20%+
- Improve performance by eliminating polyfills
Proposed Browser Support
| Browser | Minimum Version |
|---|---|
| Chrome | 66+ (Apr 2018) |
| Firefox | 60+ (May 2018) |
| Safari | 13+ (Sep 2019) |
| Edge | 79+ Chromium (Jan 2020) |
Phase 1: Remove Dead Code (Critical Priority)
1.1 Flash Audio Plugin Removal (SoundJS)
Status: Flash Player was discontinued January 12, 2021
Files to Delete:
SoundJS/src/soundjs/flashaudio/
βββ FlashAudioPlugin.js (~460 lines)
βββ FlashAudioLoader.js (~200 lines)
βββ FlashAudioSoundInstance.js (~350 lines)
βββ FlashAudioPlugin.swf
SoundJS/src/swfobject.js (~500 lines)
Impact: ~1,500 lines removed
Migration Notes:
- Users relying on Flash fallback should migrate to WebAudio or HTMLAudio
- No code changes needed for users already using WebAudioPlugin
1.2 IE/ActiveX Fallbacks Removal (PreloadJS)
File: PreloadJS/src/preloadjs/net/XHRRequest.js
Remove:
// Lines ~460-480: XDomainRequest (IE8-9 cross-domain)
if (crossdomain && req.withCredentials === undefined && window.XDomainRequest) {
req = new XDomainRequest();
}
// Lines ~470-480: ActiveXObject fallback (IE6-9)
for (var i = 0, l = s.ACTIVEX_VERSIONS.length; i < l; i++) {
var axVersion = s.ACTIVEX_VERSIONS[i];
try {
req = new ActiveXObject(axVersion);
break;
} catch (e) {}
}
Also remove the ACTIVEX_VERSIONS constant:
s.ACTIVEX_VERSIONS = [
"MSXML2.XMLHttp.6.0",
"MSXML2.XMLHttp.5.0",
// ...
];
File: PreloadJS/src/preloadjs/utils/DataUtils.js
Remove:
// Lines ~67-71: ActiveXObject XML parsing fallback
try {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(text);
} catch (e) {
xml = null;
}
Impact: ~100 lines removed
1.3 BlobBuilder Fallback Removal (PreloadJS)
File: PreloadJS/src/preloadjs/net/XHRRequest.js
Remove:
// Lines ~354-363: BlobBuilder was deprecated in 2012
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
window.MozBlobBuilder || window.MSBlobBuilder;
if (e.name === 'TypeError' && window.BlobBuilder) {
var builder = new BlobBuilder();
builder.append(this._response);
this._response = builder.getBlob();
}
Replace with: Simple Blob constructor (universally supported)
this._response = new Blob([this._response]);
Impact: ~15 lines removed
1.4 Deprecated Web Audio API Methods (SoundJS)
File: SoundJS/src/soundjs/webaudio/WebAudioPlugin.js
Remove entire _compatibilitySetUp method:
// Lines ~386-400: These deprecated methods haven't been needed since 2014
s._compatibilitySetUp = function() {
s._panningModel = "equalpower";
if (s.context.createGain) { return; }
// These are all obsolete:
s.context.createGain = s.context.createGainNode;
audioNode.__proto__.start = audioNode.__proto__.noteGrainOn;
audioNode.__proto__.stop = audioNode.__proto__.noteOff;
s._panningModel = 0;
};
Impact: ~20 lines removed
1.5 Touch Event Simplification (EaselJS)
File: EaselJS/src/easeljs/ui/Touch.js
Proposed Changes:
- Remove iOS Touch Events (
touchstart,touchmove,touchend,touchcancel) - Remove MSPointerEvents (
MSPointerDown,MSPointerMove, etc.) - Simplify to Pointer Events only (
pointerdown,pointermove,pointerup,pointercancel) - Update
isSupported()to check only forwindow.PointerEvent
Impact: 315 β 232 lines (83 lines removed, 26% reduction)
Phase 2: Remove Vendor Prefixes (Medium Priority)
2.1 requestAnimationFrame Prefixes
Files:
EaselJS/src/createjs/utils/Ticker.jsTweenJS/src/createjs/utils/Ticker.js
Before:
var f = window.cancelAnimationFrame || window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame || window.oCancelAnimationFrame ||
window.msCancelAnimationFrame;
var f = window.requestAnimationFrame || window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame || window.oRequestAnimationFrame ||
window.msRequestAnimationFrame;
After:
var f = window.cancelAnimationFrame;
var f = window.requestAnimationFrame;
Note: Universally supported since 2012
2.2 AudioContext Prefix (SoundJS)
File: SoundJS/src/soundjs/webaudio/WebAudioPlugin.js
Before:
var AudioCtor = (window.AudioContext || window.webkitAudioContext);
After:
var AudioCtor = window.AudioContext;
Note: Safari dropped webkit prefix in v14.1 (April 2021)
2.3 CSS Transform Prefixes (EaselJS, PreloadJS)
File: EaselJS/src/easeljs/display/DOMElement.js
Before:
style.transformOrigin = style.WebkitTransformOrigin = style.msTransformOrigin =
style.MozTransformOrigin = style.OTransformOrigin = "0% 0%";
style.transform = style.WebkitTransform = style.OTransform =
style.msTransform = str +","+ (mtx.ty+0.5|0) +")";
style.MozTransform = str +"px,"+ (mtx.ty+0.5|0) +"px)";
After:
style.transformOrigin = "0% 0%";
style.transform = str + "," + (mtx.ty + 0.5 | 0) + ")";
Note: Unprefixed transforms supported since 2013
2.4 WebGL Context Prefix (EaselJS)
File: EaselJS/src/easeljs/display/StageGL.js
Before:
gl = canvas.getContext("webgl", options) || canvas.getContext("experimental-webgl", options);
After:
gl = canvas.getContext("webgl", options);
Optional Enhancement: Consider adding WebGL2 support:
gl = canvas.getContext("webgl2", options) || canvas.getContext("webgl", options);
Phase 3: Remove Legacy Utilities (Medium Priority)
3.1 Array.indexOf Polyfill (EaselJS)
File: EaselJS/src/createjs/utils/indexOf.js
Remove entire file and usages:
// This file can be deleted - Array.prototype.indexOf supported since IE9
createjs.indexOf = function (array, searchElement){
for (var i = 0,l=array.length; i < l; i++) {
if (searchElement === array[i]) {
return i;
}
}
return -1;
};
Replace usages with:
array.indexOf(searchElement)
3.2 Browser Detection Removal (SoundJS)
File: SoundJS/src/createjs/utils/BrowserDetect.js
Review and remove unnecessary checks:
// These are generally anti-patterns in 2026
BrowserDetect.isWindowPhone = ... // Windows Phone discontinued 2017
BrowserDetect.isBlackberry = ... // BlackBerry OS discontinued 2013
BrowserDetect.isOpera = ... // Opera uses Chromium since 2013
Replace with: Feature detection where needed
3.3 iOS Sample Rate Workaround (SoundJS)
File: SoundJS/src/soundjs/webaudio/WebAudioPlugin.js
Review if still needed:
// Lines ~360-370: iOS sample rate fix
if (/(iPhone|iPad)/i.test(navigator.userAgent)
&& context.sampleRate !== s.DEFAULT_SAMPLE_RATE) {
// workaround...
}
Status: Test on modern iOS (15+) to verify if still required. This was a bug in iOS 6-9.