Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MengZian
Bright-browser
提交
d02a32a9
B
Bright-browser
项目概览
MengZian
/
Bright-browser
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Bright-browser
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d02a32a9
编写于
6月 08, 2023
作者:
MengZian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20230608
上级
83a9e094
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
1068 addition
and
481 deletion
+1068
-481
Bright.js
Bright.js
+953
-259
DOMOperation.js
DOMOperation.js
+115
-222
未找到文件。
Bright.js
浏览文件 @
d02a32a9
此差异已折叠。
点击以展开。
DOMOperation.js
浏览文件 @
d02a32a9
/*!
DOMOperation.js
date 168
5085340815 [Fri May 26 2023 15:15:40
GMT+0800 (China Standard Time)]
date 168
6210071353 [Thu Jun 08 2023 15:41:11
GMT+0800 (China Standard Time)]
(c) 2023 Bright_Leader
Licensed under the Apache-2.0.
dependenc(y/ies):
- Bright.js date >= 168
5064723739
- Bright.js date >= 168
6188991871
*/
(
function
exportFunction
(
globalObject
,
factory
){
"
use strict
"
;
/*
...
...
@@ -404,30 +404,6 @@ const isDocument=function(value){
);
};
(
function
(){
/* module: checking some common node types */
objectToExport
.
isText
=
function
(){
const
bText
=
bwindow
.
Text
;
/* http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1312295772 */
return
function
(
value
){
let
key
,
key0
;
return
(
value
instanceof
bText
&&
(
key
=
nodeType_key
)
in
value
&&
value
[
key
]
===
TEXT_NODE_nodeType
&&
(
key
=
nodeName_key
)
in
value
&&
value
[
key
]
===
"
#text
"
&&
(
key
=
nodeValue_key
)
in
value
&&
(
key0
=
"
data
"
)
in
value
&&
value
[
key
]
===
value
[
key0
]
);
};
}();
return
;
})();
const
attributes_key
=
"
attributes
"
;
const
isElement
=
function
(
value
){
...
...
@@ -444,14 +420,84 @@ const isElement=function(value){
);
};
const
length_key
=
"
length
"
;
const
bdocument
=
bwindow
.
document
;
const
createTextNode
=
function
(){
/* module: text node creation and manipulation */
const
bDocument_createTextNode
=
bDocument_prototype
.
createTextNode
;
const
bText
=
bwindow
.
Text
;
/* http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1312295772 */
const
bTextIsFunction
=
isFunction
(
bText
);
/* false on Internet Explorer 9-11 */
const
isTextNode
=
function
(
value
){
let
key
,
key0
;
return
(
value
instanceof
bText
&&
isArrayLike
(
value
)
&&
(
key
=
nodeType_key
)
in
value
&&
value
[
key
]
===
TEXT_NODE_nodeType
&&
(
key
=
nodeName_key
)
in
value
&&
value
[
key
]
===
"
#text
"
&&
(
key
=
nodeValue_key
)
in
value
&&
(
key0
=
"
data
"
)
in
value
&&
value
[
key
]
===
value
[
key0
]
);
};
function
isNotATextNodeError
(
value
){
return
(
"
\
x22
"
+
value
+
"
\
x22 (type:
\
x20
"
+
(
value
!==
null
?
typeof
value
:
value
)
+
"
) is not a text node ( http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-1312295772 )!
"
);
}
const
bText_prototype
=
bText
[
prototype_key
];
const
bText_splitText
=
bText_prototype
.
splitText
;
const
splitTextNode
=
function
(
textNode
,
offset
){
if
(
isPrimitive
(
textNode
))
throw
valueIsPrimitiveError
(
textNode
);
if
(
!
isTextNode
(
textNode
))
throw
isNotATextNodeError
(
textNode
);
return
Function_call
[
call_key
](
bText_splitText
,
textNode
,
offset
);
};
objectToExport
.
smartSplitTextNode
=
function
(){
const
roundInteger
=
returnOrThrowFunction
(
BrightObject
.
roundInteger
);
return
function
(
textNode
,
offset
){
if
(
isPrimitive
(
textNode
))
throw
valueIsPrimitiveError
(
textNode
);
return
splitTextNode
(
textNode
,
roundInteger
(
0
,
textNode
[
length_key
]
-
1
,
offset
)
);
};
}();
objectToExport
.
isTextNode
=
isTextNode
;
objectToExport
.
isNotATextNodeError
=
isNotATextNodeError
;
objectToExport
.
splitTextNode
=
splitTextNode
;
return
function
(
contents
){
return
bTextIsFunction
?
new
bText
(
contents
):
Function_call
[
call_key
](
bDocument_createTextNode
,
bdocument
,
contents
);
};
}();
const
arrayLikeFindIndex
=
returnOrThrowFunction
(
BrightObject
.
arrayLikeFindIndex
),
arrayLikeFilter
=
returnOrThrowFunction
(
BrightObject
.
arrayLikeFilter
);
const
bElement_getAttribute
=
bElement_prototype
.
getAttribute
,
bDocument_getElementsByTagName
=
bDocument_prototype
.
getElementsByTagName
,
bDocument_createTextNode
=
bDocument_prototype
.
createTextNode
;
const
bdocument
=
bwindow
.
document
;
bDocument_getElementsByTagName
=
bDocument_prototype
.
getElementsByTagName
;
(
function
(){
/* module: some static functions for elements search and creation */
...
...
@@ -527,15 +573,13 @@ objectToExport.getElementsByName=function(nameName,customDocument){
return
getElementsByTagName
;
}();
objectToExport
.
createTextNode
=
function
(
contents
){
return
Function_call
[
call_key
](
bDocument_createTextNode
,
bdocument
,
contents
);
};
objectToExport
.
createDocumentFragment
=
function
(){
const
bDocument_createDocumentFragment
=
bDocument_prototype
.
createDocumentFragment
,
bDocumentFragment
=
bwindow
.
DocumentFragment
;
/* http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-B63ED1A3 */
const
bDocumentFragmentIsFunction
=
isFunction
(
bDocumentFragment
);
objectToExport
.
isDocumentFragment
=
function
(
value
){
let
key
;
return
(
...
...
@@ -549,10 +593,8 @@ objectToExport.isDocumentFragment=function(value){
);
};
return
isFunction
(
bDocumentFragment
)?
function
(){
return
new
bDocumentFragment
();
}:
function
(){
/* This function is for Internet Explorer 9-11. */
return
Function_call
[
call_key
](
bDocument_createDocumentFragment
,
bdocument
);
return
function
(){
return
bDocumentFragmentIsFunction
?
new
bDocumentFragment
():
Function_call
[
call_key
](
bDocument_createDocumentFragment
,
bdocument
);
};
}();
...
...
@@ -569,8 +611,6 @@ function isNotAnElementError(value){
);
}
const
length_key
=
"
length
"
;
const
staticMethodFunction0
=
function
(
actionFunction
){
returnOrThrowFunction
(
actionFunction
);
...
...
@@ -733,15 +773,23 @@ function constructorRequireNewError(value){
};
}();
const
InnerConstructor_prototype
=
assignMultipleProperties
(
InnerConstructor
[
prototype_key
],
const
InnerConstructor_prototype
=
InnerConstructor
[
prototype_key
];
tryES5DefineProperty
(
InnerConstructor_prototype
,
length_key
,
0
,
True
,
False
,
False
);
assignMultipleProperties
(
InnerConstructor_prototype
,
[
length_key
,
reference_key
,
isArrayLike_key
],
[
0
,
null
,
False
],
...
...
@@ -980,9 +1028,7 @@ const safeModifyNodeText=(function selfFn(target,text){
Function_call
[
call_key
](
bNode_appendChild
,
target
,
Function_call
[
call_key
](
bDocument_createTextNode
,
bdocument
,
createTextNode
(
isFunction
(
text
)?
text
(
target
,
target_nodeType
):
text
)
);
...
...
@@ -1646,152 +1692,7 @@ hence this must be checked before other operations.
return
;
})();
function
throwUnsupportedFeature
(){
throw
"
This feature is unsupported!
"
;
}
(
function
(){
/* module: native ECMAScript array methods implementation */
objectToExport
.
arrayMethodsImplementation
=
function
(){
const
arrayMethodsImplementation_errorMessage0
=
function
(
value
){
return
(
"
Can not implement methods to
\
x22
"
+
Function_call
[
call_key
](
Object_toString
,
value
)
+
"
\
x22!
"
);
};
const
arrayMethodsImplementation
=
function
(){
function
getArrayMethodNames
(){
return
[
"
toString
"
,
/* These two methods are not generic in ECMAScript 3. */
"
toLocaleString
"
,
"
concat
"
,
/* ECMAScript 3 */
"
join
"
,
"
pop
"
,
"
push
"
,
"
reverse
"
,
"
shift
"
,
"
slice
"
,
"
sort
"
,
"
splice
"
,
"
unshift
"
,
"
indexOf
"
,
/* ECMAScript 5 */
"
lastIndexOf
"
,
"
every
"
,
"
some
"
,
"
forEach
"
,
"
map
"
,
"
filter
"
,
"
reduce
"
,
"
reduceRight
"
,
"
copyWithin
"
,
/* ECMAScript 6 */
"
entries
"
,
"
fill
"
,
"
find
"
,
"
findIndex
"
,
"
keys
"
,
"
values
"
,
"
includes
"
/* ECMAScript 7 */
];
/*
- ECMA-262, 7th edition, June 2016
http://262.ecma-international.org/7.0/index.html
http://www.ecma-international.org/wp-content/uploads/ECMA-262_7th_edition_june_2016.pdf
*/
}
function
getSymbolKeys
(){
return
[
"
iterator
"
,
"
unscopables
"
];
}
function
isSymbol
(
value
){
return
typeof
value
===
"
symbol
"
;
}
const
nativeSymbol
=
bwindow
.
Symbol
;
const
nativeSymbolIsFunction
=
isFunction
(
nativeSymbol
);
return
function
(
target
,
writable
,
enumerable
,
configurable
){
if
(
isPrimitive
(
target
))
throw
valueIsPrimitiveError
(
target
);
if
(
target
===
Array_prototype
||
target
===
Array_constructor
)
throw
arrayMethodsImplementation_errorMessage0
(
target
);
let
i_var
,
tempArray
,
len
,
j0
,
j1
,
j2
,
j3
;
for
(
i_var
=
0
,
len
=
(
tempArray
=
getArrayMethodNames
())[
length_key
];
i_var
<
len
;
i_var
+=
1
)
tryES5DefineProperty
(
target
,
j0
=
tempArray
[
i_var
],
isFunction
(
j1
=
Array_prototype
[
j0
])?
j1
:
throwUnsupportedFeature
,
writable
,
enumerable
,
configurable
);
for
(
i_var
=
0
,
len
=
(
tempArray
=
getSymbolKeys
())[
length_key
];
i_var
<
len
;
i_var
+=
1
){
j0
=
tempArray
[
i_var
];
j2
=
(
nativeSymbolIsFunction
&&
isSymbol
(
j1
=
nativeSymbol
[
j0
])
&&
j1
in
Array_prototype
);
tryES5DefineProperty
(
target
,
"
Symbol.
"
+
j0
,
j2
?(
j3
=
Array_prototype
[
j1
]):
throwUnsupportedFeature
,
writable
,
enumerable
,
configurable
);
j2
&&
tryES5DefineProperty
(
target
,
j1
,
j3
,
writable
,
enumerable
,
configurable
);
}
(
i_var
=
length_key
)
in
target
||
tryES5DefineProperty
(
target
,
i_var
,
0
,
writable
,
enumerable
,
configurable
);
i_var
=
tempArray
=
len
=
j0
=
j1
=
j2
=
j3
=
null
;
return
target
;
};
}();
arrayMethodsImplementation
(
InnerConstructor_prototype
,
True
,
False
,
True
);
return
arrayMethodsImplementation
;
}();
(
function
(){
defineDontEnumProperty
(
InnerConstructor_prototype
,
...
...
@@ -1804,16 +1705,29 @@ defineDontEnumProperty(
return
;
})();
function
throwUnsupportedFeature
(){
throw
"
This feature is unsupported!
"
;
}
(
function
(){
let
tempFunction
;
try
{
throwUnsupportedFeature
();
}
catch
(
err
){
throwUnsupportedFeature
.
message
=
err
;
}
let
tempKey
;
(
isFunction
(
tempFunction
=
BrightObject
.
exportInstanceMethods
)
&&
tempFunction
(
InnerConstructor_prototype
,
True
,
False
,
True
)
defineDontEnumProperty
(
InnerConstructor_prototype
,
tempKey
=
"
unsupportedFeature
"
,
throwUnsupportedFeature
);
tempFunction
=
null
;
objectToExport
[
tempKey
]
=
throwUnsupportedFeature
;
tempKey
=
null
;
return
;
})();
...
...
@@ -1898,6 +1812,7 @@ tempResult=null;
objectToExport
.
isDocument
=
isDocument
;
objectToExport
.
isElement
=
isElement
;
objectToExport
.
createTextNode
=
createTextNode
;
objectToExport
.
isNode
=
isNode
;
objectToExport
.
isNotAnElementError
=
isNotAnElementError
;
...
...
@@ -1905,28 +1820,7 @@ objectToExport.isNotANodeError=isNotANodeError;
objectToExport
.
DOMOperation
=
InnerConstructor
;
(
function
(){
try
{
throwUnsupportedFeature
();
}
catch
(
err
){
throwUnsupportedFeature
.
message
=
err
;
}
let
tempKey
;
defineDontEnumProperty
(
InnerConstructor_prototype
,
tempKey
=
"
unsupportedFeature
"
,
throwUnsupportedFeature
);
objectToExport
[
tempKey
]
=
throwUnsupportedFeature
;
tempKey
=
null
;
return
;
})();
objectToExport
.
assignMultipleProperties
=
assignMultipleProperties
;
(
function
(){
...
...
@@ -1940,13 +1834,12 @@ function sharedKeys(){
function
sharedValues
(){
return
[
"
Bright_Leader
"
,
168
5085340815
168
6210071353
];
}
assignMultipleProperties
(
objectToExport
,
sharedKeys
(),
sharedValues
(),
True
,
False
,
True
);
assignMultipleProperties
(
InnerConstructor_prototype
,
sharedKeys
(),
sharedValues
(),
True
,
False
,
True
);
objectToExport
.
assignMultipleProperties
=
assignMultipleProperties
;
return
;
})();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录