diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:56:40 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:56:40 +0100 |
commit | 310fd066e91f454b990372ffa30e803cc8120975 (patch) | |
tree | d5d900deb656a5da18e0b60d00f0db73f3a2e88e /files/zh-cn/web/api/htmlhyperlinkelementutils | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.gz translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.bz2 translated-content-310fd066e91f454b990372ffa30e803cc8120975.zip |
unslug zh-cn: move
Diffstat (limited to 'files/zh-cn/web/api/htmlhyperlinkelementutils')
9 files changed, 958 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/hash/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/hash/index.html new file mode 100644 index 0000000000..5d8cc21f43 --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/hash/index.html @@ -0,0 +1,109 @@ +--- +title: HTMLHyperlinkElementUtils.hash +slug: Web/API/URLUtils/hash +tags: + - HTMLHyperlinkElementUtils.hash +translation_of: Web/API/HTMLHyperlinkElementUtils/hash +--- +<p>{{ APIRef("URLUtils") }}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.hash</code></strong> 属性返回一个包含“#”的 {{domxref("DOMString")}} , 后跟URL的片段标识符。</p> + +<p>片段没有<a href="https://wiki.developer.mozilla.org/zh-CN/docs/Glossary/percent-encoding">百分比解码</a>。如果URL没有包含片段标识符,这个属性为一个空的字符串, <code>""</code>.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.hash; +<em>object</em>.hash = <em>string</em>; +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// Let's an <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.href#youhou"> element be in the document +var anchor = document.getElementById("myAnchor"); +var result = anchor.hash; // Returns:'#youhou'</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-hash', 'HTMLHyperlinkElementUtils.hash')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("22")}}<sup>[3]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22")}}<sup>[3]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.</p> + +<p>[3] From Gecko 22 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface. Also, from Gecko 29 to Gecko 40, the returned value was incorrectly percent-decoded.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} interface it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/href/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/href/index.html new file mode 100644 index 0000000000..cff669766d --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/href/index.html @@ -0,0 +1,108 @@ +--- +title: HTMLHyperlinkElementUtils.href +slug: Web/API/URLUtils/href +tags: + - HTMLHyperlinkElementUtils.href +translation_of: Web/API/HTMLHyperlinkElementUtils/href +--- +<p>{{ApiRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.href </code></strong>属性是一个包含整个URL的 {{domxref("USVString")}}。</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.href; +<em>object<code>.href = </code></em><code><em>string</em>;</code> +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// Lets imagine an <a id="myAnchor" href="https://developer.mozilla.org/en-US/HTMLHyperlinkElementUtils/href"> element is in the document +var anchor = document.getElementById("myAnchor"); +var result = anchor.href; // Returns: 'https://developer.mozilla.org/en-US/HTMLHyperlinkElementUtils/href' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-href', 'HTMLHyperlinkElementUtils.href')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("22")}} [3]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22")}} [3]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.</p> + +<p>[3] From Gecko 22 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moved either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} mixin it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/index.html new file mode 100644 index 0000000000..e8d6c719d9 --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/index.html @@ -0,0 +1,83 @@ +--- +title: URLUtils +slug: Web/API/URLUtils +translation_of: Web/API/HTMLHyperlinkElementUtils +--- +<p>{{ApiRef("URL API")}}{{SeeCompatTable}}</p> + +<p>The <strong><code>HTMLHyperlinkElementUtils</code></strong> mixin defines utility methods and properties to work with {{domxref("HTMLAnchorElement")}} and {{domxref("HTMLAreaElement")}}. These utilities allow to deal with common features like URLs.</p> + +<p>There are no objects of this type, but several objects {{domxref("HTMLAnchorElement")}} and {{domxref("HTMLAreaElement")}} implement it.</p> + +<h2 id="属性">属性</h2> + +<div class="note"> +<p><strong>注意:</strong>This interface doesn't inherit any property.</p> +</div> + +<dl> + <dt>{{domxref("HTMLHyperlinkElementUtils.href")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the whole URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.protocol")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the protocol scheme of the URL, including the final <code>':'</code>.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.host")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the host, that is the <em>hostname</em>, and then, if the <em>port</em> of the URL is not empty (which can happen because it was not specified or because it was specified to be the default port of the URL's scheme), a <code>':'</code>, and the <em>port</em> of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.hostname")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the domain of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.port")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the port number of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.pathname")}}</dt> + <dd>This is a {{domxref("USVString")}} containing an initial <code>'/'</code> followed by the path of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.search")}}</dt> + <dd>This is a {{domxref("USVString")}} containing a <code>'?'</code> followed by the parameters of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.hash")}}</dt> + <dd>This is a {{domxref("USVString")}} containing a <code>'#'</code> followed by the fragment identifier of the URL.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.username")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the username specified before the domain name.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.password")}}</dt> + <dd>This is a {{domxref("USVString")}} containing the password specified before the domain name.</dd> + <dt>{{domxref("HTMLHyperlinkElementUtils.origin")}} {{readonlyInline}}</dt> + <dd>This returns a {{domxref("USVString")}} containing the origin of the URL (that is its scheme, its domain and its port).</dd> +</dl> + +<h2 id="方法">方法</h2> + +<div class="note"> +<p><strong>注意:</strong>This interface doesn't inherit any method.</p> +</div> + +<dl> + <dt>{{domxref("HTMLHyperlinkElementUtils.toString()")}}</dt> + <dd>This returns a {{domxref("USVString")}} containing the whole URL. It is a synonym for {{domxref("HTMLHyperlinkElementUtils.href")}}, though it can't be used to modify the value.</dd> +</dl> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">规范</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', '#htmlhyperlinkelementutils', 'HTMLHyperlinkElementUtils')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.HTMLHyperlinkElementUtils")}}</p> + +<h2 id="参见">参见</h2> + +<ul> + <li>Interfaces implementing this one: {{domxref("HTMLAnchorElement")}}, {{domxref("HTMLAreaElement")}}</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/origin/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/origin/index.html new file mode 100644 index 0000000000..d0f8d926ec --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/origin/index.html @@ -0,0 +1,116 @@ +--- +title: HTMLHyperlinkElementUtils.origin +slug: Web/API/URLUtils/origin +tags: + - HTMLHyperlinkElementUtils.origin +translation_of: Web/API/HTMLHyperlinkElementUtils/origin +--- +<p>{{APIRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.origin</code></strong> 只读属性是一个 {{domxref("USVString")}} ,其中包含代表URL的原始码的Unicode序列化,即:</p> + +<ul> + <li>for URL using the <code>http</code> or <code>https</code>, the scheme followed by <code>'://'</code>, followed by the domain, followed by <code>':'</code>, followed by the port (the default port, <code>80</code> and <code>443</code> respectively, if explicitely specified);</li> + <li>for URL using <code>file:</code> scheme, the value is browser dependant;</li> + <li>for URL using the <code>blob:</code> scheme, the origin of the URL following <code>blob:</code>. E.g <code>"blob:https://mozilla.org"</code> will have <code>"https://mozilla.org".</code></li> +</ul> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.origin; +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// On this page, returns the origin +var result = window.location.origin; // Returns:'https://developer.mozilla.org' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-origin', 'HTMLHyperlinkElementUtils.origin')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("26.0")}}<sup> [3][4]</sup></td> + <td>{{CompatNo}} [2]</td> + <td><span style="font-size: 12px; line-height: 16.3636360168457px;">{{CompatNo}}</span> [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("26.0")}}<sup> [3][4]</sup></td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.</p> + +<p>[3] From Gecko 26 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<p>[4] Before Gecko 49, results for URL using the <code>blob</code> scheme incorrectly returned <code>null</code>.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} mixin it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/password/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/password/index.html new file mode 100644 index 0000000000..99e9944875 --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/password/index.html @@ -0,0 +1,104 @@ +--- +title: HTMLHyperlinkElementUtils.password +slug: Web/API/URLUtils/password +tags: + - HTMLHyperlinkElementUtils.password +translation_of: Web/API/HTMLHyperlinkElementUtils/password +--- +<p>{{ApiRef("URL API")}}</p> + +<p>HTMLHyperlinkElementUtils<strong><code>.password</code></strong> property 属性是一个{{domxref("USVString")}} ,包含域名前面指定的密码。</p> + +<p>如果在没有首先设置<code><a href="/en-US/docs/Web/API/HTMLHyperlinkElementUtils/username">用户名</a></code>属性的情况下设置,则会静默失败。</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.password; +<em>object</em>.password = <em>string</em>; +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// Let's <a id="myAnchor" href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.username"> be in the document +var anchor = document.getElementByID("myAnchor"); +var result = anchor.password; // Returns:'flabada' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-prassword', 'HTMLHyperlinkElementUtils.password')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatGeckoDesktop("26")}} [2]</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatGeckoMobile("26")}} [2]</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] From Gecko 26 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} mixin it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/pathname/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/pathname/index.html new file mode 100644 index 0000000000..203da5393a --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/pathname/index.html @@ -0,0 +1,110 @@ +--- +title: HTMLHyperlinkElementUtils.pathname +slug: Web/API/URLUtils/pathname +tags: + - HTMLHyperlinkElementUtils.pathname +translation_of: Web/API/HTMLHyperlinkElementUtils/pathname +--- +<p>{{ApiRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.pathname</code></strong> 属性是一个 {{domxref("USVString")}} ,其中包含一个初始的'/'后跟URL的路径。</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.pathname; +<em>object</em>.pathname = <em>string</em>; +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// Let's an <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.pathname"> element be in the document +var anchor = document.getElementById("myAnchor"); +var result = anchor.pathname; // Returns:'/en-US/docs/HTMLHyperlinkElementUtils.pathname' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-pathname', 'HTMLHyperlinkElementUtils.pathname')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatGeckoDesktop("22")}} [3][4]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatGeckoMobile("22")}} [3][4]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + <td>{{CompatNo}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.</p> + +<p>[3] From Gecko 22 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<p>[4] Before Firefox 53, the <code>pathname</code> and <code>search</code> <code>HTMLHyperLinkElementUtils</code> properties returned the wrong parts of the URL. For example, for a URL of <code>http://z.com/x?a=true&b=false</code>, <code>pathname</code> would return "<code>/x?a=true&b=false"</code> and <code>search</code> would return "", rather than "<code>/x</code>" and "<code>?a=true&b=false"</code> respectively. This has now been fixed.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} mixin it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/search/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/search/index.html new file mode 100644 index 0000000000..4c9c8ae554 --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/search/index.html @@ -0,0 +1,116 @@ +--- +title: HTMLHyperlinkElementUtils.search +slug: Web/API/URLUtils/search +tags: + - HTMLHyperlinkElementUtils.search +translation_of: Web/API/HTMLHyperlinkElementUtils/search +--- +<p>{{ApiRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.search</code></strong> 属性是一个搜索字符串,也叫做查询字符串, 它是一个 {{domxref("USVString")}} ,包含 <code>'?'</code> 和随后的 URL 参数。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.search; +<em>object</em>.search = <em>string</em>; +</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">// 让一个 +// <a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.search?q=123" /> +// 元素在文档里 + +let anchor = document.getElementById("myAnchor"); +let result = anchor.search; +// 返回:'?q=123' +</pre> + +<p> </p> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-search', 'HTMLHyperlinkElementUtils.search')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>初始定义</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>基本支持</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("22")}} [3][4]</td> + <td>{{CompatVersionUnknown}} [2]</td> + <td>{{CompatVersionUnknown}} [2]</td> + <td>{{CompatVersionUnknown}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>基本支持</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22")}} [3][4]</td> + <td>{{CompatVersionUnknown}} [2]</td> + <td>{{CompatVersionUnknown}} [2]</td> + <td>{{CompatVersionUnknown}} [2]</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] 自Chrome 52起,该属性移至{{domxref('URL')}}</p> + +<p>[2] 虽然没有被分在一个独立的抽象接口,但该方法可以在实现了它的那些接口上直接使用,如果支持该接口。</p> + +<p>[3] 从Gecko 22 到 Gecko 44,该属性在 <code>URLUtils</code> mixin 上。它已经被移到 <code>HTMLHyperlinkElementUtils</code> mixin,或者直接在这个接口上。</p> + +<p>[4] 在 Firefox 53之前, <code>pathname</code> 和<code> search</code> <code>HTMLHyperLinkElementUtils</code> 属性返回的URL部分是错误的。例如,对一个值为 <code>http://z.com/x?a=true&b=false</code> 的URL,<code>pathname</code> 会返回"<code>/x?a=true&b=false"</code> <code>,search</code> 会返回 "", 而不是各自返回 "<code>/x</code>" 和"<code>?a=true&b=false"</code> 。这已经被修正了。</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>它属于{{domxref("HTMLHyperlinkElementUtils")}} mixin 。</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/tostring/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/tostring/index.html new file mode 100644 index 0000000000..172ffda98b --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/tostring/index.html @@ -0,0 +1,110 @@ +--- +title: HTMLHyperlinkElementUtils.toString() +slug: Web/API/URLUtils/toString +tags: + - HTMLHyperlinkElementUtils.toString() + - URL API +translation_of: Web/API/HTMLHyperlinkElementUtils/toString +--- +<p>{{ApiRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.toString()</code></strong> 方法返回一个包含整个URL的 {{domxref("USVString")}} 。它是{{domxref("HTMLHyperlinkElementUtils.href")}} 的一个只读版本。</p> + +<h2 id="句法">句法</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.toString();</pre> + +<h2 id="范例">范例</h2> + +<pre class="brush: js">/* +Let's imagine an +<a id="myAnchor" href="https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils/toString"> + element is in the document +*/ +var anchor = document.getElementById("myAnchor"); +var result = anchor.toString(); +// Returns: 'https://developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils/toString' +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#htmlhyperlinkelementutils', 'HTMLHyperlinkElementUtils.toString()')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(52)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("22")}} [2]</td> + <td>{{CompatNo}} [1]</td> + <td>{{CompatNo}} [1]</td> + <td>{{CompatNo}} [1]</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(52)}}</td> + <td>{{CompatChrome(52)}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22")}} [2]</td> + <td>{{CompatNo}} [1]</td> + <td>{{CompatNo}} [1]</td> + <td>{{CompatNo}} [1]</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Though not grouped in a single abstract interface, this method is directly available on the interfaces that implement it, if this interface is supported.</p> + +<p>[2] From Gecko 22 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<h2 id="也可以看看">也可以看看</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} mixin it belongs to.</li> +</ul> diff --git a/files/zh-cn/web/api/htmlhyperlinkelementutils/username/index.html b/files/zh-cn/web/api/htmlhyperlinkelementutils/username/index.html new file mode 100644 index 0000000000..2e7a101f9f --- /dev/null +++ b/files/zh-cn/web/api/htmlhyperlinkelementutils/username/index.html @@ -0,0 +1,102 @@ +--- +title: HTMLHyperlinkElementUtils.username +slug: Web/API/URLUtils/username +tags: + - HTMLHyperlinkElementUtils.username +translation_of: Web/API/HTMLHyperlinkElementUtils/username +--- +<p>{{ApiRef("URL API")}}</p> + +<p><strong><code>HTMLHyperlinkElementUtils.username</code></strong> 属性是一个 {{domxref("USVString")}}包含域名前面指定的用户名。</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>string</em> = <em>object</em>.username; +<em>object</em>.username = <em>string</em>; +</pre> + +<h2 id="Examples">Examples</h2> + +<pre class="brush: js">// Let's <a id="myAnchor" href="https://anonymous:flabada@developer.mozilla.org/en-US/docs/HTMLHyperlinkElementUtils.username"> be in the document +var anchor = document.getElementByID("myAnchor"); +var result = anchor.username; // Returns:'anonymous' +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-hyperlink-username', 'HTMLHyperlinkElementUtils.username')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{ CompatibilityTable() }}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatGeckoDesktop("26")}} [2]</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatVersionUnknown}} [1]</td> + <td>{{CompatGeckoMobile("26")}} [2]</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Starting in Chrome 52, this property was moved to {{domxref('URL')}}</p> + +<p>[2] From Gecko 26 to Gecko 44, this property was on the <code>URLUtils</code> mixin. It has been moves either on the <code>HTMLHyperlinkElementUtils</code> mixin, or directly on the interface.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>The {{domxref("HTMLHyperlinkElementUtils")}} interface it belongs to.</li> +</ul> |