From fed7f9482f402ac0e58f47735dc4d7e976213f6c Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 12 Apr 2023 17:19:44 +0100 Subject: [PATCH] Drop IE11 support The following are now available in all browsers we support: * mix-blend-mode in CSS * Node#contains Change-Id: I324948f0bceac6d86999300e2b2c8756613e56d2 --- modules/dt.init.less | 42 +++++++++--------------------------------- modules/utils.js | 20 ++------------------ 2 files changed, 11 insertions(+), 51 deletions(-) diff --git a/modules/dt.init.less b/modules/dt.init.less index e1122119a..8407279f4 100644 --- a/modules/dt.init.less +++ b/modules/dt.init.less @@ -113,17 +113,11 @@ h1, h2, h3, h4, h5, h6 { position: absolute; pointer-events: none; opacity: 0; -} - -/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ -@supports ( mix-blend-mode: darken ) { - .ext-discussiontools-init-highlight { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - mix-blend-mode: darken; - // Support: Safari - // Safari doesn't blend this overlay with the text unless GPU rendering is forced. - transform: translateZ( 0 ); - } + /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ + mix-blend-mode: darken; + // Support: Safari + // Safari doesn't blend this overlay with the text unless GPU rendering is forced. + transform: translateZ( 0 ); } .ext-discussiontools-init-highlight-fadein { @@ -136,31 +130,13 @@ h1, h2, h3, h4, h5, h6 { } .ext-discussiontools-init-publishedcomment { - // Support: IE11 - // On supporting browsers, we instead use non-transparent color with mix-blend-mode. - // Identical to #ffe29e on white background. - background-color: rgba( 255, 198, 60, 0.5 ); -} - -/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ -@supports ( mix-blend-mode: darken ) { - .ext-discussiontools-init-publishedcomment { - background-color: #ffe29e; - } + background-color: #ffe29e; } .ext-discussiontools-init-targetcomment { - // Support: IE11, see above - background-color: rgba( 216, 235, 255, 0.5 ); -} - -/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ -@supports ( mix-blend-mode: darken ) { - .ext-discussiontools-init-targetcomment { - // Same color as the :target selector for references (from Cite). - // Not sure if that's a good idea, but it should be different from -publishedcomment. - background-color: #eaf3ff; - } + // Same color as the :target selector for references (from Cite). + // Not sure if that's a good idea, but it should be different from -publishedcomment. + background-color: #eaf3ff; } // Topic subscriptions (both kinds) diff --git a/modules/utils.js b/modules/utils.js index 4c3ab93dc..b9eba2ee2 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -164,22 +164,6 @@ function childIndexOf( child ) { return i; } -/** - * Check whether a Node contains (is an ancestor of) another Node (or is the same node) - * - * @param {Node} ancestor - * @param {Node} descendant - * @return {boolean} - */ -function contains( ancestor, descendant ) { - // Support: IE 11 - // Node#contains is only supported on HTMLElement nodes. Otherwise we could just use - // `ancestor.contains( descendant )`. - return ancestor === descendant || - // eslint-disable-next-line no-bitwise - ancestor.compareDocumentPosition( descendant ) & Node.DOCUMENT_POSITION_CONTAINED_BY; -} - /** * Find closest ancestor element using one of the given tag names. * @@ -327,7 +311,7 @@ function getCoveredSiblings( range ) { if ( ancestor === range.startContainer ) { start = range.startOffset; } else { - while ( !contains( siblings[ start ], range.startContainer ) ) { + while ( !siblings[ start ].contains( range.startContainer ) ) { start++; } } @@ -336,7 +320,7 @@ function getCoveredSiblings( range ) { if ( ancestor === range.endContainer ) { end = range.endOffset - 1; } else { - while ( !contains( siblings[ end ], range.endContainer ) ) { + while ( !siblings[ end ].contains( range.endContainer ) ) { end--; } }