Skip to content

Commit

Permalink
wip: remove jquery
Browse files Browse the repository at this point in the history
removed jquery from component: ConfirmDocumentUnload
fix: anchor scroll cannot accept string
  • Loading branch information
YUCLing committed Nov 14, 2024
1 parent f91ca0e commit 40acd7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export default class ConfirmDocumentUnload extends Component {
super.oncreate(vnode);

this.boundHandler = this.handler.bind(this);
$(window).on('beforeunload', this.boundHandler);
window.addEventListener('beforeunload', this.boundHandler);
}

onremove(vnode) {
super.onremove(vnode);

$(window).off('beforeunload', this.boundHandler);
window.removeEventListener('beforeunload', this.boundHandler);
}

view(vnode) {
Expand Down
2 changes: 2 additions & 0 deletions framework/core/js/src/common/utils/anchorScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @param {() => void} callback The callback to run that will change page content.
*/
export default function anchorScroll(element, callback) {
if (typeof element === 'string') element = document.querySelector(element);
if (!element) return;
const relativeScroll = element.getBoundingClientRect().top;

callback();
Expand Down

0 comments on commit 40acd7b

Please sign in to comment.