Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
637a9ecd
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
637a9ecd
编写于
4月 11, 2020
作者:
R
Ryan Dahl
提交者:
GitHub
4月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dedup URLSearchParams, URL, Location, DOMStringList (#4719)
上级
da28fc1e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
10 addition
and
86 deletion
+10
-86
cli/js/globals.ts
cli/js/globals.ts
+2
-2
cli/js/web/body.ts
cli/js/web/body.ts
+1
-1
cli/js/web/dom_types.d.ts
cli/js/web/dom_types.d.ts
+0
-68
cli/js/web/dom_util.ts
cli/js/web/dom_util.ts
+2
-4
cli/js/web/fetch.ts
cli/js/web/fetch.ts
+0
-2
cli/js/web/location.ts
cli/js/web/location.ts
+0
-2
cli/js/web/url.ts
cli/js/web/url.ts
+2
-3
cli/js/web/url_search_params.ts
cli/js/web/url_search_params.ts
+3
-4
未找到文件。
cli/js/globals.ts
浏览文件 @
637a9ecd
...
...
@@ -213,8 +213,8 @@ export const windowOrWorkerGlobalScopeProperties = {
DOMException
:
nonEnumerable
(
domException
.
DOMExceptionImpl
),
Event
:
nonEnumerable
(
event
.
EventImpl
),
EventTarget
:
nonEnumerable
(
eventTarget
.
EventTargetImpl
),
URL
:
nonEnumerable
(
url
.
URL
),
URLSearchParams
:
nonEnumerable
(
urlSearchParams
.
URLSearchParams
),
URL
:
nonEnumerable
(
url
.
URL
Impl
),
URLSearchParams
:
nonEnumerable
(
urlSearchParams
.
URLSearchParams
Impl
),
Headers
:
nonEnumerable
(
headers
.
Headers
),
FormData
:
nonEnumerable
(
formData
.
FormData
),
TextEncoder
:
nonEnumerable
(
textEncoding
.
TextEncoder
),
...
...
cli/js/web/body.ts
浏览文件 @
637a9ecd
...
...
@@ -23,7 +23,7 @@ export type BodySource =
|
Blob
|
BufferSource
|
domTypes
.
FormData
|
domTypes
.
URLSearchParams
|
URLSearchParams
|
domTypes
.
ReadableStream
|
string
;
...
...
cli/js/web/dom_types.d.ts
浏览文件 @
637a9ecd
...
...
@@ -47,29 +47,6 @@ export interface ProgressEventInit extends EventInit {
total
?:
number
;
}
export
class
URLSearchParams
{
constructor
(
init
?:
string
[][]
|
Record
<
string
,
string
>
|
string
|
URLSearchParams
);
append
(
name
:
string
,
value
:
string
):
void
;
delete
(
name
:
string
):
void
;
get
(
name
:
string
):
string
|
null
;
getAll
(
name
:
string
):
string
[];
has
(
name
:
string
):
boolean
;
set
(
name
:
string
,
value
:
string
):
void
;
sort
():
void
;
toString
():
string
;
forEach
(
callbackfn
:
(
value
:
string
,
key
:
string
,
parent
:
this
)
=>
void
,
thisArg
?:
any
):
void
;
[
Symbol
.
iterator
]():
IterableIterator
<
[
string
,
string
]
>
;
entries
():
IterableIterator
<
[
string
,
string
]
>
;
keys
():
IterableIterator
<
string
>
;
values
():
IterableIterator
<
string
>
;
static
toString
():
string
;
}
export
interface
UIEventInit
extends
EventInit
{
detail
?:
number
;
// adjust Window -> Node
...
...
@@ -654,48 +631,3 @@ export interface ResponseConstructor {
error
():
Response
;
redirect
(
url
:
string
,
status
?:
number
):
Response
;
}
export
class
DOMStringList
{
readonly
length
:
number
;
contains
(
string
:
string
):
boolean
;
item
(
index
:
number
):
string
|
null
;
[
index
:
number
]:
string
;
[
Symbol
.
iterator
]():
IterableIterator
<
string
>
;
}
export
class
Location
{
readonly
ancestorOrigins
:
DOMStringList
;
hash
:
string
;
host
:
string
;
hostname
:
string
;
href
:
string
;
toString
():
string
;
readonly
origin
:
string
;
pathname
:
string
;
port
:
string
;
protocol
:
string
;
search
:
string
;
assign
(
url
:
string
):
void
;
reload
():
void
;
replace
(
url
:
string
):
void
;
}
export
class
URL
{
constructor
(
url
:
string
,
base
?:
string
|
URL
);
hash
:
string
;
host
:
string
;
hostname
:
string
;
href
:
string
;
toString
():
string
;
readonly
origin
:
string
;
password
:
string
;
pathname
:
string
;
port
:
string
;
protocol
:
string
;
search
:
string
;
readonly
searchParams
:
URLSearchParams
;
username
:
string
;
toJSON
():
string
;
static
createObjectURL
(
object
:
any
):
string
;
static
revokeObjectURL
(
url
:
string
):
void
;
}
cli/js/web/dom_util.ts
浏览文件 @
637a9ecd
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import
*
as
domTypes
from
"
./dom_types.d.ts
"
;
export
function
getDOMStringList
(
arr
:
string
[]):
domTypes
.
DOMStringList
{
export
function
getDOMStringList
(
arr
:
string
[]):
DOMStringList
{
Object
.
defineProperties
(
arr
,
{
contains
:
{
value
(
searchElement
:
string
):
boolean
{
...
...
@@ -16,5 +14,5 @@ export function getDOMStringList(arr: string[]): domTypes.DOMStringList {
},
},
});
return
arr
as
string
[]
&
domTypes
.
DOMStringList
;
return
arr
as
string
[]
&
DOMStringList
;
}
cli/js/web/fetch.ts
浏览文件 @
637a9ecd
...
...
@@ -10,8 +10,6 @@ import { read } from "../ops/io.ts";
import
{
close
}
from
"
../ops/resources.ts
"
;
import
{
Buffer
}
from
"
../buffer.ts
"
;
import
{
FormData
}
from
"
./form_data.ts
"
;
import
{
URL
}
from
"
./url.ts
"
;
import
{
URLSearchParams
}
from
"
./url_search_params.ts
"
;
import
{
fetch
as
opFetch
,
FetchResponse
}
from
"
../ops/fetch.ts
"
;
import
{
DomFileImpl
}
from
"
./dom_file.ts
"
;
...
...
cli/js/web/location.ts
浏览文件 @
637a9ecd
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import
{
URL
}
from
"
./url.ts
"
;
import
{
notImplemented
}
from
"
../util.ts
"
;
import
{
DOMStringList
,
Location
}
from
"
./dom_types.d.ts
"
;
import
{
getDOMStringList
}
from
"
./dom_util.ts
"
;
export
class
LocationImpl
implements
Location
{
...
...
cli/js/web/url.ts
浏览文件 @
637a9ecd
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import
{
customInspect
}
from
"
./console.ts
"
;
import
*
as
domTypes
from
"
./dom_types.d.ts
"
;
import
{
urls
,
URLSearchParams
}
from
"
./url_search_params.ts
"
;
import
{
urls
}
from
"
./url_search_params.ts
"
;
import
{
getRandomValues
}
from
"
../ops/get_random_values.ts
"
;
interface
URLParts
{
...
...
@@ -139,7 +138,7 @@ function resolvePathFromBase(path: string, basePath: string): string {
/** @internal */
export
const
parts
=
new
WeakMap
<
URL
,
URLParts
>
();
export
class
URL
implements
domTypes
.
URL
{
export
class
URL
Impl
implements
URL
{
#
searchParams
!
:
URLSearchParams
;
[
customInspect
]():
string
{
...
...
cli/js/web/url_search_params.ts
浏览文件 @
637a9ecd
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import
*
as
domTypes
from
"
./dom_types.d.ts
"
;
import
{
URL
,
parts
}
from
"
./url.ts
"
;
import
{
parts
}
from
"
./url.ts
"
;
import
{
isIterable
,
requiredArguments
}
from
"
./util.ts
"
;
/** @internal */
...
...
@@ -45,7 +44,7 @@ function handleArrayInitialization(
}
}
export
class
URLSearchParams
implements
domTypes
.
URLSearchParams
{
export
class
URLSearchParams
Impl
implements
URLSearchParams
{
#
params
:
Array
<
[
string
,
string
]
>
=
[];
constructor
(
init
:
string
|
string
[][]
|
Record
<
string
,
string
>
=
""
)
{
...
...
@@ -63,7 +62,7 @@ export class URLSearchParams implements domTypes.URLSearchParams {
return
;
}
if
(
init
instanceof
URLSearchParams
)
{
if
(
init
instanceof
URLSearchParams
Impl
)
{
this
.
#
params
=
[...
init
.
#
params
];
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录