Skip to content

Commit

Permalink
fix: replace IE10 incompatible functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuwoo.choi committed Jul 23, 2018
1 parent 7f06134 commit 09bc696
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/js/editor.js
Expand Up @@ -508,10 +508,10 @@ class ToastUIEditor {
height(height) {
if (util.isExisty(height)) {
if (height === 'auto') {
this.options.el.classList.add('auto-height');
$(this.options.el).addClass('auto-height');
this.minHeight(this.minHeight());
} else {
this.options.el.classList.remove('auto-height');
$(this.options.el).removeClass('auto-height');
this.minHeight(height);
}
if (util.isNumber(height)) {
Expand Down
6 changes: 3 additions & 3 deletions src/js/ui/codeBlockLanguagesCombo.js
Expand Up @@ -49,7 +49,7 @@ class CodeBlockLanguagesCombo {
*/
_showPopupCodeBlockLanguages() {
const clientRect = this._inputLanguage.getBoundingClientRect();
this._wrapper.classList.toggle('active', true);
$(this._wrapper).toggleClass('active', true);
this.active = true;

this._popupCodeBlockLanguages = this._eventManager.emitReduce('openPopupCodeBlockLanguages', {
Expand All @@ -69,15 +69,15 @@ class CodeBlockLanguagesCombo {

_toggleFocus() {
const inputLanguage = this._inputLanguage;
if (this._wrapper.classList.contains('active')) {
if ($(this._wrapper).hasClass('active')) {
inputLanguage.blur();
} else {
inputLanguage.focus();
}
}

_onFocusOut() {
this._wrapper.classList.toggle('active', false);
$(this._wrapper).toggleClass('active', false);
this._inputLanguage.value = this._prevStoredLanguage;
this._hidePopupCodeBlockLanguages();
}
Expand Down
9 changes: 5 additions & 4 deletions src/js/ui/popupAddLink.js
Expand Up @@ -2,6 +2,7 @@
* @fileoverview Implements PopupAddLink
* @author NHN Ent. FE Development Lab <dl_javascript@nhnent.com>
*/
import $ from 'jquery';
import util from 'tui-code-snippet';

import LayerPopup from './layerpopup';
Expand Down Expand Up @@ -129,12 +130,12 @@ class PopupAddLink extends LayerPopup {
this._clearValidationStyle();

if (linkText.length < 1) {
this._inputText.classList.add('wrong');
$(this._inputText).addClass('wrong');

return;
}
if (url.length < 1) {
this._inputURL.classList.add('wrong');
$(this._inputURL).addClass('wrong');

return;
}
Expand All @@ -157,8 +158,8 @@ class PopupAddLink extends LayerPopup {
}

_clearValidationStyle() {
this._inputURL.classList.remove('wrong');
this._inputText.classList.remove('wrong');
$(this._inputURL).removeClass('wrong');
$(this._inputText).removeClass('wrong');
}

_resetInputs() {
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/popupCodeBlockEditor.js
Expand Up @@ -139,7 +139,7 @@ class PopupCodeBlockEditor extends LayerPopup {

_createCodeBlockEditor() {
const codeMirrorWrapper = document.createElement('div');
codeMirrorWrapper.classList.add(`${CLASS_PREFIX}editor-wrapper`);
codeMirrorWrapper.className = `${CLASS_PREFIX}editor-wrapper`;

this._codeBlockEditor = new CodeBlockEditor(codeMirrorWrapper, this.eventManager);

Expand Down
10 changes: 5 additions & 5 deletions src/js/ui/scrollSyncSplit.js
Expand Up @@ -121,7 +121,7 @@ class ScrollSyncSplit {
$(contentElement).off(EVENT_REQUIRE_SCROLL_INTO_VIEW);
this._contentWrapper.removeChild(contentElement);
}
element.classList.add(CLASS_CONTENT[side]);
$(element).addClass(CLASS_CONTENT[side]);
this._contentWrapper.appendChild(element);
$(element).on(EVENT_REQUIRE_SCROLL_INTO_VIEW, ev => this._requireScrollIntoView(ev));
$(element).on(EVENT_REQUIRE_SCROLL_SYNC, () => this.sync());
Expand Down Expand Up @@ -160,7 +160,7 @@ class ScrollSyncSplit {
* @memberof ScrollSyncSplit
*/
toggleScrollSync() {
this._el.classList.toggle(CLASS_SCROLL_SYNC);
$(this._el).toggleClass(CLASS_SCROLL_SYNC);
}

setSplitView(activate) {
Expand All @@ -172,7 +172,7 @@ class ScrollSyncSplit {
* @memberof ScrollSyncSplit
*/
toggleSplitView() {
this._el.classList.toggle(CLASS_SINGLE_CONTENT);
$(this._el).toggleClass(CLASS_SINGLE_CONTENT);
}

/**
Expand All @@ -181,7 +181,7 @@ class ScrollSyncSplit {
* @memberof ScrollSyncSplit
*/
isScrollSynced() {
return this._el.classList.contains(CLASS_SCROLL_SYNC);
return $(this._el).hasClass(CLASS_SCROLL_SYNC);
}

/**
Expand All @@ -190,7 +190,7 @@ class ScrollSyncSplit {
* @memberof ScrollSyncSplit
*/
isSplitView() {
return !this._el.classList.contains(CLASS_SINGLE_CONTENT);
return !$(this._el).hasClass(CLASS_SINGLE_CONTENT);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/unit/codeMirrorExt.spec.js
Expand Up @@ -123,7 +123,7 @@ describe('CodeMirrorExt', () => {
const wrapper = codeMirrorExt.getWrapperElement();

expect(wrapper).toEqual(jasmine.any(HTMLElement));
expect(wrapper.classList.contains('CodeMirror'));
expect($(wrapper.classList).hasClass('CodeMirror'));
});

describe('get, set scrollTop', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ui/popupAddLink.spec.js
Expand Up @@ -131,7 +131,7 @@ describe('PopupAddLink', () => {
$(okButton).trigger('click');

expect(handler).not.toHaveBeenCalled();
expect(urlInput.classList.contains('wrong')).toBe(true);
expect($(urlInput).hasClass('wrong')).toBe(true);
});

it('should not emit AddLink and style input if url not filled', () => {
Expand All @@ -141,7 +141,7 @@ describe('PopupAddLink', () => {
$(okButton).trigger('click');

expect(handler).not.toHaveBeenCalled();
expect(linkTextInput.classList.contains('wrong')).toBe(true);
expect($(linkTextInput).hasClass('wrong')).toBe(true);
});
});

Expand Down

0 comments on commit 09bc696

Please sign in to comment.