提交 c69c483d 编写于 作者: Z zengyawen

update docs

Signed-off-by: Nzengyawen <zengyawen1@huawei.com>
上级 0d62740a
...@@ -47,11 +47,11 @@ constructor是URI的构造函数。 ...@@ -47,11 +47,11 @@ constructor是URI的构造函数。
**示例:** **示例:**
```js ```js
let mm = 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; let mm = 'https://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); // Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment'; new uri.URI(mm); // Output 'https://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
``` ```
```js ```js
new uri.URI('http://username:password@host:8080'); // Output 'http://username:password@host:8080'; new uri.URI('https://username:password@host:8080'); // Output 'https://username:password@host:8080';
``` ```
...@@ -72,7 +72,7 @@ toString(): string ...@@ -72,7 +72,7 @@ toString(): string
**示例:** **示例:**
```js ```js
const result = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const result = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
result.toString() result.toString()
``` ```
...@@ -104,8 +104,8 @@ equals(other: URI): boolean ...@@ -104,8 +104,8 @@ equals(other: URI): boolean
**示例:** **示例:**
```js ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equals(uriInstance1); uriInstance.equals(uriInstance1);
``` ```
### equalsTo<sup>9+</sup> ### equalsTo<sup>9+</sup>
...@@ -131,8 +131,8 @@ equalsTo(other: URI): boolean ...@@ -131,8 +131,8 @@ equalsTo(other: URI): boolean
**示例:** **示例:**
```js ```js
const uriInstance = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment'); const uriInstance1 = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment');
uriInstance.equalsTo(uriInstance1); uriInstance.equalsTo(uriInstance1);
``` ```
...@@ -153,7 +153,7 @@ checkIsAbsolute(): boolean ...@@ -153,7 +153,7 @@ checkIsAbsolute(): boolean
**示例:** **示例:**
```js ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080?query=pppppp'); const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080?query=pppppp');
uriInstance.checkIsAbsolute(); uriInstance.checkIsAbsolute();
``` ```
...@@ -175,7 +175,7 @@ normalize(): URI ...@@ -175,7 +175,7 @@ normalize(): URI
**示例:** **示例:**
```js ```js
const uriInstance = new uri.URI('http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp'); const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
let uriInstance1 = uriInstance.normalize(); let uriInstance1 = uriInstance.normalize();
uriInstance1.path; uriInstance1.path;
``` ```
...@@ -809,13 +809,13 @@ URL的构造函数。 ...@@ -809,13 +809,13 @@ URL的构造函数。
**示例:** **示例:**
```js ```js
let mm = 'http://username:password@host:8080'; let mm = 'https://username:password@host:8080';
let a = new Url.URL("/", mm); // Output 'http://username:password@host:8080/'; let a = new Url.URL("/", mm); // Output 'https://username:password@host:8080/';
let b = new Url.URL(mm); // Output 'http://username:password@host:8080/'; let b = new Url.URL(mm); // Output 'https://username:password@host:8080/';
new Url.URL('path/path1', b); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('path/path1', b); // Output 'https://username:password@host:8080/path/path1';
let c = new Url.URL('/path/path1', b); // Output 'http://username:password@host:8080/path/path1'; let c = new Url.URL('/path/path1', b); // Output 'https://username:password@host:8080/path/path1';
new Url.URL('/path/path1', c); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', c); // Output 'https://username:password@host:8080/path/path1';
new Url.URL('/path/path1', a); // Output 'http://username:password@host:8080/path/path1'; new Url.URL('/path/path1', a); // Output 'https://username:password@host:8080/path/path1';
new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1 new Url.URL('/path/path1', "https://www.exampleUrl/fr-FR/toto"); // Output https://www.exampleUrl/path/path1
new Url.URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL new Url.URL('/path/path1', ''); // Raises a TypeError exception as '' is not a valid URL
new Url.URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL new Url.URL('/path/path1'); // Raises a TypeError exception as '/path/path1' is not a valid URL
...@@ -841,8 +841,8 @@ URL静态成员函数。 ...@@ -841,8 +841,8 @@ URL静态成员函数。
**示例:** **示例:**
```js ```js
let mm = 'http://username:password@host:8080'; let mm = 'https://username:password@host:8080';
Url.URL.parseURL(mm); // Output 'http://username:password@host:8080/'; Url.URL.parseURL(mm); // Output 'https://username:password@host:8080/';
``` ```
### tostring ### tostring
...@@ -862,7 +862,7 @@ toString(): string ...@@ -862,7 +862,7 @@ toString(): string
**示例:** **示例:**
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString(); url.toString();
``` ```
...@@ -883,7 +883,7 @@ toJSON(): string ...@@ -883,7 +883,7 @@ toJSON(): string
**示例:** **示例:**
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON(); url.toJSON();
``` ```
<!--no_check--> <!--no_check-->
\ No newline at end of file
...@@ -144,11 +144,11 @@ endElement(): void ...@@ -144,11 +144,11 @@ endElement(): void
let arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
let bufView = new DataView(arrayBuffer); let bufView = new DataView(arrayBuffer);
let thatSer = new xml.XmlSerializer(bufView); let thatSer = new xml.XmlSerializer(bufView);
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "https://www.w3.org/TR/html4/");
thatSer.startElement("table"); thatSer.startElement("table");
thatSer.setAttributes("importance", "high"); thatSer.setAttributes("importance", "high");
thatSer.setText("Happy"); thatSer.setText("Happy");
thatSer.endElement(); // => <h:table importance="high" xmlns:h="http://www.w3.org/TR/html4/">Happy</h:table> thatSer.endElement(); // => <h:table importance="high" xmlns:h="https://www.w3.org/TR/html4/">Happy</h:table>
``` ```
...@@ -173,9 +173,9 @@ setNamespace(prefix: string, namespace: string): void ...@@ -173,9 +173,9 @@ setNamespace(prefix: string, namespace: string): void
let arrayBuffer = new ArrayBuffer(1024); let arrayBuffer = new ArrayBuffer(1024);
let thatSer = new xml.XmlSerializer(arrayBuffer); let thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setDeclaration(); thatSer.setDeclaration();
thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.setNamespace("h", "https://www.w3.org/TR/html4/");
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.endElement();// = >'<?xml version="1.0" encoding="utf-8"?>\r\n<h:note xmlns:h="http://www.w3.org/TR/html4/"/>'; thatSer.endElement();// = >'<?xml version="1.0" encoding="utf-8"?>\r\n<h:note xmlns:h="https://www.w3.org/TR/html4/"/>';
``` ```
### setComment ### setComment
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册