Stop dispatching a "localized" event from the webL10n library, since it's unused and may clash with the default viewer

Currently this leads to confusing behaviour with `eventBusDispatchToDOM = true` set, since then there's *two* different "localized" events being fired.
This commit is contained in:
Jonas Jenwald 2019-09-13 12:33:37 +02:00
parent 12ff252751
commit 6d1595b669

View File

@ -26,6 +26,9 @@
- Removes consoleWarn and consoleLog and use console.log/warn directly.
- Removes window._ assignment.
- Remove compatibility code for OldIE.
- Replaces `String.prototype.substr()` with `String.prototype.substring()`.
- Removes `fireL10nReadyEvent` since the "localized" event it dispatches
is unused and may clash with an identically named event in the viewer.
*/
/*jshint browser: true, devel: true, es5: true, globalstrict: true */
@ -93,13 +96,6 @@ document.webL10n = (function(window, document, undefined) {
return { id: l10nId, args: args };
}
function fireL10nReadyEvent(lang) {
var evtObject = document.createEvent('Event');
evtObject.initEvent('localized', true, false);
evtObject.language = lang;
document.dispatchEvent(evtObject);
}
function xhrLoadText(url, onSuccess, onFailure) {
onSuccess = onSuccess || function _onSuccess(data) {};
onFailure = onFailure || function _onFailure() {};
@ -326,7 +322,6 @@ document.webL10n = (function(window, document, undefined) {
console.log('no resource to load, early way out');
}
// early way out
fireL10nReadyEvent(lang);
gReadyState = 'complete';
return;
}
@ -338,7 +333,6 @@ document.webL10n = (function(window, document, undefined) {
gResourceCount++;
if (gResourceCount >= langCount) {
callback();
fireL10nReadyEvent(lang);
gReadyState = 'complete';
}
};