Merge pull request #11142 from Snuffleupagus/webL10n-rm-fireL10nReadyEvent

Stop dispatching a "localized" event from the webL10n library, since it's unused and may clash with the default viewer
This commit is contained in:
Tim van der Meij 2019-09-13 23:13:03 +02:00 committed by GitHub
commit b86bdefcd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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';
}
};