diff options
author | thiemowmde <thiemo.kreuz@wikimedia.de> | 2023-12-04 11:40:36 +0100 |
---|---|---|
committer | Bartosz DziewoĆski <dziewonski@fastmail.fm> | 2023-12-04 20:43:01 +0000 |
commit | d5c4ff15fb5d0458ea26697ca1c726ac8178e4cc (patch) | |
tree | 5bde7ddcbb34aab64716408afc72a3338644bc3d | |
parent | a007f6e09a9ed65a77e51dfe0435f85e9841d23c (diff) | |
download | mediawikicore-d5c4ff15fb5d0458ea26697ca1c726ac8178e4cc.tar.gz mediawikicore-d5c4ff15fb5d0458ea26697ca1c726ac8178e4cc.zip |
Fix unanchored regex in jquery.highlightText.js
This was searching for a substring, which doesn't make sense in this
context.
This line of code is typically not doing anything because <style>
and <script> tags typically don't have children anyway. But this is
technically not forbidden. It's still a good idea to have this check
just to be sure.
This bug exists at least since 2010.
Change-Id: I4a18514168b9f3668487e2c95d477cad377b0be7
-rw-r--r-- | resources/src/jquery/jquery.highlightText.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/src/jquery/jquery.highlightText.js b/resources/src/jquery/jquery.highlightText.js index a89dcd58fc3f..391ffcf6c880 100644 --- a/resources/src/jquery/jquery.highlightText.js +++ b/resources/src/jquery/jquery.highlightText.js @@ -72,7 +72,7 @@ node.nodeType === Node.ELEMENT_NODE && // element with childnodes, and not a script, style or an element we created node.childNodes && - !/(script|style)/i.test( node.tagName ) && + !/^(script|style)$/i.test( node.tagName ) && !( node.tagName.toLowerCase() === 'span' && node.className.match( /\bhighlight/ ) |