dojo/date/locale outside of the browser
2011-06-30 20:48:26 GMT
i've been looking into the possibility of getting dojo/date/locale
working outside of the browser. unfortunately, it's dependency chain is
tied to dojo/_base/window which references `window` directly when
defining dojo.doc. the chain to dojo/_base/window is like this:
dojo/date/locale -> dojo/cldr/supplemental -> dojo/i18n ->
dojo/_base/xhr -> dojo/dom-form -> dojo/dom -> dojo/_base/window
i've come up with 2 possible solutions to avoid this direct reference to
window
option 1
=====
guard the reference to window with has("host_browser") and update
dojo/_base/window to have a dependency on has and change the declaration
of dojo.doc to be
dojo.doc = has("host-browser") && window["document"] || null;
option 2
=====
break the chain of dependencies leading to the window reference by
preventing dojo/i18n from pulling in dojo/_base/xhr when not in the
browser. afaik, dojo/i18n only pulls in dojo/_base/xhr to support
legacy i18n packages in the browser, maybe we could change that
dependency to be "dojo/has!host-browser?./_base/xhr" or some other has
test if there's a more appropriate one?
i also explored the possibility of ways to break dojo/_base/xhr ->
dojo/dom-form or breaking dojo/dom-form -> dojo/dom but those look like
dead ends.
(Continue reading)
RSS Feed