Skip to content

Commit

Permalink
mark domain_to_ascii and domain_to_unicode as deprecated (whatwg/url#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
micolous committed Nov 29, 2023
1 parent 4fbc5a6 commit d56ee65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions url/src/quirks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ pub fn internal_components(url: &Url) -> InternalComponents {
}
}

/// https://url.spec.whatwg.org/#dom-url-domaintoascii
/// Converts a domain name to its ASCII (punycode) form.
///
/// This feature was never implemented by browsers, and
/// [has been removed from the URL spec][0].
///
/// [0]: https://github.com/whatwg/url/issues/63
#[deprecated]
pub fn domain_to_ascii(domain: &str) -> String {
match Host::parse(domain) {
Ok(Host::Domain(domain)) => domain,
Expand All @@ -66,9 +72,15 @@ pub fn domain_to_ascii(domain: &str) -> String {
}

#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
/// <https://url.spec.whatwg.org/#dom-url-domaintounicode>
#[deprecated]
/// Converts a domain name to its Unicode form.
///
/// This feature was never implemented by browsers, and
/// [has been removed from the URL spec][0].
///
/// This feature is not available on `wasm32-unknown-unknown` targets.
///
/// [0]: https://github.com/whatwg/url/issues/63
pub fn domain_to_unicode(domain: &str) -> String {
match Host::parse(domain) {
Ok(Host::Domain(ref domain)) => {
Expand Down
1 change: 1 addition & 0 deletions url/tests/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ fn test_set_href() {
}

#[test]
#[allow(deprecated)]
fn test_domain_encoding_quirks() {
use url::quirks::domain_to_ascii;
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
Expand Down

0 comments on commit d56ee65

Please sign in to comment.