Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated methods #314

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NameNotFinal
Copy link
Contributor

@NameNotFinal NameNotFinal commented Mar 10, 2022

Once again while working on another feature I noticed some deprecated functions in use, and while they probably all work just fine, I thought it might be a good idea to replace them before they become completely obsolete.

This PR addresses these deprecations:

  • execCommand
    • In XM.Util.setClipboard
    • In processFormattingTag (FormattingExtender.ts)
  • substr
  • initEvent

Other stuff:

  • Update browserslist database

It also contains a little adjustment to add a notice when you press "Copy ID" on comments/forum posts.

Note: I haven't been able to find a good replacement for execCommand("insertText") as used here https://github.com/bitWolfy/re621/blob/eddef40ac5e607481d6e1e588cf3dcf610fd1a54/src/js/modules/general/FormattingExtender.ts#L188-L192

I'll undraft this once I manage to implement that, or decide to leave it

Comment on lines 50 to 54
public static triggerVueEvent(element: JQuery<HTMLElement>, name: string, label?: string): void {
const e = document.createEvent('HTMLEvents');
e.initEvent(name, true, true);
const e = new Event(name, { "bubbles": true, "cancelable": true });
if (label) element.data(label, "true");
element[0].dispatchEvent(e);
}
Copy link
Contributor Author

@NameNotFinal NameNotFinal Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to verify that this works cause I wasn't able to find any good way of testing this, however it doesn't seem to break anything (and this way of handling events works in reloadButtonToolbar)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant