This commit is contained in:
Raymond Hill 2017-12-31 21:13:06 -05:00
parent d8d1fa5221
commit ce696e5fbe
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 8 additions and 7 deletions

View File

@ -113,11 +113,14 @@
return matches[1].trim() + ':style(' + matches[2].trim() + ')'; return matches[1].trim() + ':style(' + matches[2].trim() + ')';
}; };
var toASCIIHostname = function(hostname) { var toASCIIHostnames = function(hostnames) {
if ( hostname.charCodeAt(0) === 0x7E /* '~' */ ) { var i = hostnames.length;
return '~' + punycode.toASCII(hostname.slice(1)); while ( i-- ) {
var hostname = hostnames[i];
hostnames[i] = hostname.charCodeAt(0) === 0x7E /* '~' */ ?
'~' + punycode.toASCII(hostname.slice(1)) :
punycode.toASCII(hostname);
} }
return punycode.toASCII(hostname);
}; };
var compileProceduralSelector = (function() { var compileProceduralSelector = (function() {
@ -631,9 +634,7 @@
var prefix = raw.slice(0, lpos); var prefix = raw.slice(0, lpos);
parsed.hostnames = prefix.split(reHostnameSeparator); parsed.hostnames = prefix.split(reHostnameSeparator);
if ( reHasUnicode.test(prefix) ) { if ( reHasUnicode.test(prefix) ) {
for ( var hostname of parsed.hostnames ) { toASCIIHostnames(parsed.hostnames);
parsed.hostnames = toASCIIHostname(hostname);
}
} }
} }