From 113b4da1df7ec65a8686af4e7b91e2f8d4114e2c Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 2 Aug 2024 11:37:27 +0100 Subject: [PATCH] LibWebView: Sort vendor-prefixed properties last in the inspector Previously, the legacy `-webkit-foo` properties would all be top of the list, when they are generally not useful to inspect. Instead, put them at the bottom, so that users can still see them if they want to, but they're not in the way. --- Base/res/ladybird/inspector.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Base/res/ladybird/inspector.js b/Base/res/ladybird/inspector.js index fae5992aa83..f76e0611eea 100644 --- a/Base/res/ladybird/inspector.js +++ b/Base/res/ladybird/inspector.js @@ -204,7 +204,20 @@ inspector.createPropertyTables = (computedStyle, resolvedStyle, customProperties newTable.setAttribute("id", tableID); Object.keys(properties) - .sort() + .sort((a, b) => { + let baseResult = a.localeCompare(b); + // Manually move vendor-prefixed items after non-prefixed ones. + if (a[0] === "-") { + if (b[0] === "-") { + return baseResult; + } + return 1; + } + if (b[0] === "-") { + return -1; + } + return baseResult; + }) .forEach(name => { let row = newTable.insertRow();