Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6285cc0dc923129575db36ce490f7b87295da6c1
https://github.com/WebKit/WebKit/commit/6285cc0dc923129575db36ce490f7b87295da6c1
Author: Anuj Panta <[email protected]>
Date: 2026-02-02 (Mon, 02 Feb 2026)
Changed paths:
M Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
Log Message:
-----------
Web Inspector: uniqueOrderedStyles could be optimized
https://bugs.webkit.org/show_bug.cgi?id=306761
rdar://problem/169436468
Reviewed by BJ Burg and Devin Rousso.
The uniqueOrderedStyles method was using nested loops to filter duplicate CSS
rules,
which resulted in O(n²) complexity. This caused noticeable lag when inspecting
elements
with many matching rules - pretty common on modern sites using frameworks like
Tailwind
or Bootstrap.
The fix uses a Set with rule ID keys for O(1) duplicate detection instead of
searching
through the array each time. Since rules are equal when their IDs match
(styleSheetId
and ordinal), we can use "${styleSheetId}:${ordinal}" as a unique key. Rules
without
IDs (user-agent styles, which are rare) fall back to the original comparison.
* Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:
(WI.DOMNodeStyles.uniqueOrderedStyles):
Canonical link: https://commits.webkit.org/306687@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications