Skip to content

Replace the deprecated isSameNode method in DOM Level 4 - #15347

Merged
Vanessa219 merged 1 commit into
siyuan-note:devfrom
TCOTC:fix/isSameNode
Jul 23, 2025
Merged

Replace the deprecated isSameNode method in DOM Level 4#15347
Vanessa219 merged 1 commit into
siyuan-note:devfrom
TCOTC:fix/isSameNode

Conversation

@TCOTC

@TCOTC TCOTC commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

Replace the deprecated isSameNode method in DOM Level 4 with the === operator

https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isSameNode

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) with element === otherElement
  • Update negated comparisons from !element.isSameNode(otherElement) to element !== 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

@Vanessa219
Vanessa219 merged commit c88f996 into siyuan-note:dev Jul 23, 2025
1 check passed
@TCOTC
TCOTC deleted the fix/isSameNode branch July 23, 2025 04:24
Vanessa219 added a commit that referenced this pull request Jul 23, 2025
@Vanessa219 Vanessa219 self-assigned this Jul 23, 2025
@Vanessa219

Copy link
Copy Markdown
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
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants