diff options
-rw-r--r-- | source/features/collapsible-content-button.tsx | 4 | ||||
-rw-r--r-- | source/features/table-input.css | 6 | ||||
-rw-r--r-- | source/features/table-input.tsx | 12 |
3 files changed, 7 insertions, 15 deletions
diff --git a/source/features/collapsible-content-button.tsx b/source/features/collapsible-content-button.tsx index dd2a8940..80730332 100644 --- a/source/features/collapsible-content-button.tsx +++ b/source/features/collapsible-content-button.tsx @@ -8,6 +8,7 @@ import {elementExists} from 'select-dom'; import features from '../feature-manager.js'; import smartBlockWrap from '../helpers/smart-block-wrap.js'; import observe from '../helpers/selector-observer.js'; +import {isHasSelectorSupported} from '../helpers/select-has.js'; function addContentToDetails({delegateTarget}: DelegateEvent<MouseEvent, HTMLButtonElement>): void { /* There's only one rich-text editor even when multiple fields are visible; the class targets it #5303 */ @@ -73,6 +74,9 @@ function init(signal: AbortSignal): void { } void features.add(import.meta.url, { + asLongAs: [ + isHasSelectorSupported, + ], include: [ pageDetect.hasRichTextEditor, ], diff --git a/source/features/table-input.css b/source/features/table-input.css index c7cbbf66..022b1599 100644 --- a/source/features/table-input.css +++ b/source/features/table-input.css @@ -30,12 +30,6 @@ } } -/** TODO: Drop JS-based version after :has() has full support */ -.rgh-table-input:hover .selected div { - border-color: #79b8ff; - background-color: var(--color-diff-blob-hunk-num-bg, #dbedff); -} - .rgh-tic:hover div, .rgh-tic:is(:nth-of-type(5n + 1)):has(~ :hover:nth-of-type(5n + 1)) div, .rgh-tic:is(:nth-of-type(5n + 1), :nth-of-type(5n + 2)):has( diff --git a/source/features/table-input.tsx b/source/features/table-input.tsx index bdc44bf0..f271201e 100644 --- a/source/features/table-input.tsx +++ b/source/features/table-input.tsx @@ -34,12 +34,6 @@ function addTable({delegateTarget: square}: DelegateEvent<MouseEvent, HTMLButton field.selectionEnd = field.value.indexOf('<td>', cursorPosition) + '<td>'.length; } -function highlightSquares({delegateTarget: hover}: DelegateEvent<MouseEvent, HTMLElement>): void { - for (const cell of hover.parentElement!.children as HTMLCollectionOf<HTMLButtonElement>) { - cell.classList.toggle('selected', cell.dataset.x! <= hover.dataset.x! && cell.dataset.y! <= hover.dataset.y!); - } -} - function add(anchor: HTMLElement): void { const wrapperClasses = [ 'details-reset', @@ -111,12 +105,12 @@ function init(signal: AbortSignal): void { '.ActionBar-item:has([data-md-button=\'ref\'])', ], add, {signal}); delegate('.rgh-tic', 'click', addTable, {signal}); - if (!isHasSelectorSupported()) { - delegate('.rgh-tic', 'mouseenter', highlightSquares, {capture: true, signal}); - } } void features.add(import.meta.url, { + asLongAs: [ + isHasSelectorSupported, + ], include: [ pageDetect.hasRichTextEditor, ], |