Use Unicode version of hostnames in element picker

Related feedback:
https://www.reddit.com/r/uBlockOrigin/comments/15vfkm6/
This commit is contained in:
Raymond Hill 2023-08-20 11:27:19 -04:00
parent ed6c0d2f50
commit 55d068aca3
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -26,6 +26,7 @@
import './codemirror/ubo-static-filtering.js';
import { hostnameFromURI } from './uri-utils.js';
import punycode from '../lib/punycode.js';
import * as sfp from './static-filtering-parser.js';
/******************************************************************************/
@ -147,7 +148,10 @@ const renderRange = function(id, value, invert = false) {
const userFilterFromCandidate = function(filter) {
if ( filter === '' || filter === '!' ) { return; }
const hn = hostnameFromURI(docURL.href);
let hn = hostnameFromURI(docURL.href);
if ( hn.startsWith('xn--') ) {
hn = punycode.toUnicode(hn);
}
// Cosmetic filter?
if ( reCosmeticAnchor.test(filter) ) {