Skip to content

Commit 23e15fd

Browse files
author
djmaze
committed
Use own createElement() instead of doc.createElement
1 parent 7eaaa0a commit 23e15fd

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

dev/App/Abstract.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import ko from 'ko';
22

33
import {
44
doc,
5+
createElement,
56
elementById,
67
Settings
78
} from 'Common/Globals';
@@ -39,7 +40,7 @@ export class AbstractApp {
3940
open(link, '_self');
4041
focus();
4142
} else {
42-
const oLink = doc.createElement('a');
43+
const oLink = createElement('a');
4344
oLink.href = link;
4445
doc.body.appendChild(oLink).click();
4546
oLink.remove();

dev/Common/Translator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ko from 'ko';
22
import { Notification, UploadErrorCode } from 'Common/Enums';
33
import { langLink } from 'Common/Links';
4-
import { doc } from 'Common/Globals';
4+
import { doc, createElement } from 'Common/Globals';
55

66
let I18N_DATA = window.rainloopI18N || {};
77

@@ -122,7 +122,7 @@ export function getUploadErrorDescByCode(code) {
122122
*/
123123
export function reload(admin, language) {
124124
return new Promise((resolve, reject) => {
125-
const script = doc.createElement('script');
125+
const script = createElement('script');
126126
script.onload = () => {
127127
// reload the data
128128
if (window.rainloopI18N) {

dev/Common/Utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SaveSettingsStep } from 'Common/Enums';
2-
import { doc, elementById } from 'Common/Globals';
2+
import { doc, createElement, elementById } from 'Common/Globals';
33

44
export const
55
isArray = Array.isArray,
@@ -119,7 +119,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
119119
.then(data => {
120120
if (data && isArray(data) && 2 === data.length) {
121121
if (themeLink && !themeStyle) {
122-
themeStyle = doc.createElement('style');
122+
themeStyle = createElement('style');
123123
themeStyle.id = 'app-theme-style';
124124
themeLink.after(themeStyle);
125125
themeLink.remove();

dev/Common/UtilsUser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ComposeType, FolderType } from 'Common/EnumsUser';
22
import { EmailModel } from 'Model/Email';
33
import { encodeHtml } from 'Common/Html';
44
import { isArray } from 'Common/Utils';
5-
import { doc } from 'Common/Globals';
5+
import { createElement } from 'Common/Globals';
66

77
/**
88
* @param {(string|number)} value
@@ -79,7 +79,7 @@ export function htmlToPlain(html) {
7979
};
8080

8181
const
82-
tpl = doc.createElement('template'),
82+
tpl = createElement('template'),
8383
convertPre = (...args) =>
8484
args && 1 < args.length
8585
? args[1]

dev/Stores/User/Message.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ko from 'ko';
22

33
import { Scope, Notification } from 'Common/Enums';
44
import { MessageSetAction } from 'Common/EnumsUser';
5-
import { doc, elementById } from 'Common/Globals';
5+
import { doc, createElement, elementById } from 'Common/Globals';
66
import { isNonEmptyArray, pInt, pString, addObservablesTo, addSubscribablesTo } from 'Common/Utils';
77
import { plainToHtml } from 'Common/UtilsUser';
88

@@ -504,7 +504,7 @@ export const MessageUserStore = new class {
504504
/-----BEGIN PGP SIGNED MESSAGE-----/.test(plain) && /-----BEGIN PGP SIGNATURE-----/.test(plain);
505505
}
506506

507-
const pre = doc.createElement('pre');
507+
const pre = createElement('pre');
508508
if (pgpSigned && message.isPgpSigned()) {
509509
pre.className = 'b-plain-openpgp signed';
510510
pre.textContent = plain;

dev/Stores/User/Pgp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ko from 'ko';
22

33
import { i18n } from 'Common/Translator';
44
import { isArray, isNonEmptyArray, pString } from 'Common/Utils';
5-
import { doc } from 'Common/Globals';
5+
import { createElement } from 'Common/Globals';
66

77
import { AccountUserStore } from 'Stores/User/Account';
88

@@ -361,7 +361,7 @@ export const PgpUserStore = new class {
361361
verControl.addEventHandler('click', domControlSignedClickHelper(this, dom, domText));
362362
}
363363

364-
dom.before(verControl, doc.createElement('div'));
364+
dom.before(verControl, createElement('div'));
365365
}
366366
}
367367
}

0 commit comments

Comments
 (0)