Replace the deprecated isSameNode method in DOM Level 4 - #15347
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes the codebase by replacing the deprecated isSameNode() method with the === strict equality operator for DOM node comparisons. The isSameNode() method was deprecated in DOM Level 4 and the === operator provides the same functionality for node identity checks.
- Replace all instances of
element.isSameNode(otherElement)withelement === otherElement - Update negated comparisons from
!element.isSameNode(otherElement)toelement !== otherElement - Add parentheses around complex expressions for clarity and precedence
Reviewed Changes
Copilot reviewed 51 out of 51 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/util/pathName.ts | Replace isSameNode with === in path selection logic |
| app/src/search/util.ts | Replace isSameNode with !== in search element traversal |
| app/src/protyle/wysiwyg/transaction.ts | Replace multiple isSameNode calls with ===/!== in transaction operations |
| app/src/protyle/wysiwyg/remove.ts | Replace isSameNode with === in block removal logic |
| app/src/protyle/wysiwyg/list.ts | Replace isSameNode with === in list item comparison |
| app/src/protyle/wysiwyg/keydown.ts | Replace multiple isSameNode calls with ===/!== in keyboard event handling |
| app/src/protyle/wysiwyg/index.ts | Replace numerous isSameNode calls with ===/!== in WYSIWYG editor operations |
| app/src/protyle/wysiwyg/enter.ts | Replace isSameNode with === in enter key handling |
| app/src/protyle/util/table.ts | Replace multiple isSameNode calls with === in table operations |
| app/src/protyle/util/selection.ts | Replace isSameNode calls with === in selection utilities |
| app/src/protyle/util/onGet.ts | Replace isSameNode calls with ===/!== in content loading |
| app/src/protyle/util/insertHTML.ts | Replace isSameNode with === in HTML insertion logic |
| app/src/protyle/util/hasClosest.ts | Replace isSameNode with === in embed block detection |
| app/src/protyle/util/editorCommonEvent.ts | Replace multiple isSameNode calls with ===/!== in drag operations |
| app/src/protyle/ui/initUI.ts | Replace isSameNode calls with ===/!== in UI initialization |
| app/src/protyle/toolbar/index.ts | Replace multiple isSameNode calls with === in toolbar operations |
| app/src/protyle/render/av/view.ts | Replace isSameNode calls with ===/!== in attribute view drag operations |
| app/src/protyle/render/av/render.ts | Replace isSameNode calls with === in attribute view rendering |
| app/src/protyle/render/av/openMenuPanel.ts | Replace isSameNode calls with ===/!== in menu panel operations |
| app/src/protyle/render/av/gallery/render.ts | Replace isSameNode calls with === in gallery rendering |
| app/src/protyle/render/av/col.ts | Replace isSameNode with !== in column operations |
| app/src/protyle/render/av/cell.ts | Replace isSameNode calls with ===/!== in cell operations |
| app/src/protyle/render/av/blockAttr.ts | Replace isSameNode calls with ===/!== in block attribute handling |
| app/src/protyle/render/av/action.ts | Replace isSameNode calls with === in action handling |
| app/src/protyle/hint/extend.ts | Replace isSameNode with === in hint operations |
| app/src/protyle/gutter/index.ts | Replace isSameNode calls with ===/!== in gutter operations |
| app/src/protyle/breadcrumb/action.ts | Replace isSameNode calls with ===/!== in breadcrumb actions |
| app/src/mobile/settings/account.ts | Replace isSameNode with !== in mobile account settings |
| app/src/mobile/settings/about.ts | Replace isSameNode with !== in mobile about settings |
| app/src/mobile/menu/search.ts | Replace isSameNode with !== in mobile search |
| app/src/menus/protyle.ts | Replace isSameNode with !== in table menu operations |
| app/src/menus/navigation.ts | Replace isSameNode calls with === in navigation menus |
| app/src/menus/commonMenuItem.ts | Replace isSameNode with !== in common menu items |
| app/src/menus/Menu.ts | Replace isSameNode with !== in menu item operations |
| app/src/layout/util.ts | Replace isSameNode calls with === in layout utilities |
| app/src/layout/dock/index.ts | Replace multiple isSameNode calls with === in dock operations |
| app/src/layout/dock/Outline.ts | Replace isSameNode calls with === in outline operations |
| app/src/layout/dock/Backlink.ts | Replace isSameNode calls with === in backlink operations |
| app/src/layout/Wnd.ts | Replace isSameNode calls with ===/!== in window operations |
| app/src/layout/Tab.ts | Replace isSameNode with !== in tab operations |
| app/src/history/keydown.ts | Replace isSameNode with === in history navigation |
| app/src/dialog/message.ts | Replace isSameNode with === in message dialogs |
| app/src/dialog/confirmDialog.ts | Replace isSameNode with !== in confirm dialogs |
| app/src/config/util/snippets.ts | Replace isSameNode with !== in snippet configuration |
| app/src/config/keymap.ts | Replace isSameNode with !== in keymap configuration |
| app/src/card/viewCards.ts | Replace isSameNode with !== in card viewing |
| app/src/card/makeCard.ts | Replace isSameNode with !== in card creation |
| app/src/boot/globalEvent/mousemove.ts | Replace isSameNode calls with === in mouse event handling |
| app/src/boot/globalEvent/keydown.ts | Replace isSameNode with !== in keyboard event handling |
| app/src/block/popover.ts | Replace isSameNode calls with === in popover operations |
| app/src/ai/actions.ts | Replace isSameNode with !== in AI action handling |
Member
|
3.3.0 |
boyiwan
pushed a commit
to boyiwan/siyuan
that referenced
this pull request
Jul 30, 2025
boyiwan
pushed a commit
to boyiwan/siyuan
that referenced
this pull request
Jul 30, 2025
boyiwan
pushed a commit
to boyiwan/siyuan
that referenced
this pull request
Jul 31, 2025
boyiwan
pushed a commit
to boyiwan/siyuan
that referenced
this pull request
Jul 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the deprecated
isSameNodemethod in DOM Level 4 with the===operatorhttps://developer.mozilla.org/zh-CN/docs/Web/API/Node/isSameNode