Repository navigation
Evergreen: the modernization release (ES2022, native fetch, Vitest, Yarn 4)
Drops the dead IE6/IE7 code paths, modernizes prototype method syntax to
ES6 shorthand, ships a native fetch() fallback for Backbone.ajax,
and moves the project off npm onto Yarn 4.
Added
Backbone.ajaxfalls back to nativefetch()whenBackbone.$
is absent. Previously the library was unusable without jQuery (or a
hand-rolledBackbone.ajaxoverride). The fallback maps the subset
of jQuery options thatBackbone.syncemits —type,url,data,
contentType,dataType,headers,beforeSend,success,
error— ontofetch()+AbortController, and returns a thenable
carrying.abort()so thevar xhr = model.fetch(); xhr.abort();
consumer pattern keeps working. The jQuery path is preserved verbatim
wheneverBackbone.$is present.
Removed (breaking for IE6/IE7)
- The hidden iframe trick that simulated
hashchangefor IE7, plus
the four call sites inHistorythat special-casedthis.iframe. - The
setIntervalpolling fallback for browsers without
onhashchange, and the orphanHistory#intervalknob that only
existed to feed it. - The
attachEvent/detachEventshims around
addEventListener/removeEventListener. - The
document.documentMode > 7gate that guarded against IE7's
brokenonhashchange. - Zepto and Ender from the browser-global
$resolution chain in the
UMD factory; only jQuery (or$) remains. - The IE6 hash/search and Firefox
location.hash-decoding workaround
comments.History#getHashalso loses its unusedwindowargument. - The
attachEvent/detachEventESLint globals.
Changed
- Every prototype method literal on
Model,Collection,View,
Router, andHistorynow uses ES6 method shorthand:
methodName(args) { ... }instead of
methodName: function(args) { ... }. Pure syntactic, no behavior
change. The function-style constructor wrappers
(var Model = Backbone.Model = function(...) {...}) are preserved
on purpose: converting them toclasswould break the documented
Backbone.Model.apply(this, arguments)pattern in user-provided
constructor:overrides (exercised by test jashkenas#2612), sincesuper()
must come first in a derived class constructor. Backbone.VERSION, the source header, andpackage.jsonare all
aligned at1.7.0.
Tooling
- Package manager: npm → Yarn 4.14, pinned via Corepack and the
packageManagerfield.node-moduleslinker for full compatibility
with Karma/Rollup/Docco; no Zero-Install (cache stays out of git).
package-lock.jsonis replaced byyarn.lock. - CI Node 14 → 20, required by Yarn 4 (≥ 18.12).
npm cibecomes
yarn install --immutable. dependenciesMeta.puppeteer.builtis set explicitly so Yarn 4's
default postinstall block doesn't strand the Chromium download that
karma.conf.jsdepends on.