<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Setting URL.search to '' results in a stringified URL ending in '?'"
href="https://bugs.webkit.org/show_bug.cgi?id=162345">162345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Setting URL.search to '' results in a stringified URL ending in '?'
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>Safari Technology Preview
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Minor
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jeffy34@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Summary:
A JavaScript developer can clear out the search portion of a URL object by using the search setter with the value ''. In Safari TP, doing so results in a URL object that includes a trailing '?' character, which does not appear to match the behavior in other browsers that support the URL object. Other browsers stringify that URL object without a trailing '?'.
Steps to Reproduce:
In any JavaScript execution context, e.g. the Safari Developer Tools' console, run the following:
var url = new URL('<a href="https://example.com/?testing">https://example.com/?testing</a>');
url.search = '';
console.log(url.toString());
Expected Results:
The expected logged value is
'<a href="https://example.com/">https://example.com/</a>'
Actual Results:
The actual logged value is
'<a href="https://example.com/">https://example.com/</a>?'
Version:
Release 13 (Safari 10.0, WebKit 11603.1.5)
Notes:
The relevant specification is at <a href="https://url.spec.whatwg.org/?a=b#concept-urlsearchparams-update">https://url.spec.whatwg.org/?a=b#concept-urlsearchparams-update</a>
All other modern browsers (Chrome, Firefox, and Edge) appear to properly stringify that example without a trailing '?'.
Configuration:
This happens all the time.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>