Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
6401e7fb
U
ueditor
项目概览
qq_14980201
/
ueditor
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
ueditor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6401e7fb
编写于
4月 09, 2013
作者:
C
campaign
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
by zhanyi
上级
2a38391d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
4 deletion
+19
-4
_src/core/node.js
_src/core/node.js
+13
-3
_test/core/node.js
_test/core/node.js
+6
-1
未找到文件。
_src/core/node.js
浏览文件 @
6401e7fb
...
@@ -190,12 +190,22 @@
...
@@ -190,12 +190,22 @@
return
tmpRoot
.
toHtml
();
return
tmpRoot
.
toHtml
();
}
}
},
},
innerText
:
function
()
{
innerText
:
function
(
textStr
)
{
if
(
this
.
type
!=
'
element
'
||
dtd
.
$empty
[
this
.
tagName
])
{
if
(
this
.
type
!=
'
element
'
||
dtd
.
$empty
[
this
.
tagName
])
{
return
this
;
return
this
;
}
}
var
html
=
this
.
toHtml
();
if
(
textStr
)
{
return
html
.
replace
(
/<
[^
>
]
+>/g
,
''
);
if
(
this
.
children
){
for
(
var
i
=
0
,
ci
;
ci
=
this
.
children
[
i
++
];)
{
ci
.
parentNode
=
null
;
}
}
this
.
children
=
[];
this
.
appendChild
(
uNode
.
createText
(
textStr
));
return
this
;
}
else
{
return
this
.
toHtml
().
replace
(
/<
[^
>
]
+>/g
,
''
);
}
},
},
getData
:
function
()
{
getData
:
function
()
{
if
(
this
.
type
==
'
element
'
)
if
(
this
.
type
==
'
element
'
)
...
...
_test/core/node.js
浏览文件 @
6401e7fb
...
@@ -25,7 +25,7 @@ test( 'getNodesByTagName', function() {
...
@@ -25,7 +25,7 @@ test( 'getNodesByTagName', function() {
var
node
=
uNode
.
createElement
(
'
<div id="aa"><div id="bb"><div id="cc"></div> </div>sdfadf</div>
'
);
var
node
=
uNode
.
createElement
(
'
<div id="aa"><div id="bb"><div id="cc"></div> </div>sdfadf</div>
'
);
var
nodelist
=
node
.
getNodesByTagName
(
'
div
'
);
var
nodelist
=
node
.
getNodesByTagName
(
'
div
'
);
equals
(
nodelist
.
length
,
2
,
'
div节点列表长度
'
);
equals
(
nodelist
.
length
,
2
,
'
div节点列表长度
'
);
equals
(
node
.
innerHTML
().
replace
(
/
[
]
+>/g
,
'
>
'
),
'
<div id="bb"><div id="cc"></div>
</div>sdfadf
'
,
'
innerHTML内容
'
);
equals
(
node
.
innerHTML
().
replace
(
/
[
]
+>/g
,
'
>
'
),
'
<div id="bb"><div id="cc"></div></div>sdfadf
'
,
'
innerHTML内容
'
);
});
});
test
(
'
innerHTML
'
,
function
()
{
test
(
'
innerHTML
'
,
function
()
{
...
@@ -38,6 +38,9 @@ test( 'innerHTML', function() {
...
@@ -38,6 +38,9 @@ test( 'innerHTML', function() {
ci
.
tagName
=
'
p
'
;
ci
.
tagName
=
'
p
'
;
}
}
equals
(
node
.
innerHTML
(),
'
<p><p><p></p></p></p>
'
,
'
innerHTML内容
'
);
equals
(
node
.
innerHTML
(),
'
<p><p><p></p></p></p>
'
,
'
innerHTML内容
'
);
node
=
uNode
.
createElement
(
'
<div></div>
'
);
node
.
innerHTML
(
'
asdf
'
);
equals
(
node
.
innerHTML
(),
'
asdf
'
,
'
innerHTML内容
'
);
});
});
test
(
'
innerText
'
,
function
()
{
test
(
'
innerText
'
,
function
()
{
...
@@ -51,6 +54,8 @@ test( 'innerText', function() {
...
@@ -51,6 +54,8 @@ test( 'innerText', function() {
var
node
=
uNode
.
createElement
(
'
<div id="aa">sdfadf</div>
'
);
var
node
=
uNode
.
createElement
(
'
<div id="aa">sdfadf</div>
'
);
node
.
innerHTML
(
'
<p>dfsdfsdf<b>eee</b>sdf</p>
'
);
node
.
innerHTML
(
'
<p>dfsdfsdf<b>eee</b>sdf</p>
'
);
equals
(
node
.
innerText
(),
'
dfsdfsdfeeesdf
'
,
'
获取标签中纯文本
'
);
equals
(
node
.
innerText
(),
'
dfsdfsdfeeesdf
'
,
'
获取标签中纯文本
'
);
node
.
innerText
(
'
sdf
'
);
equals
(
node
.
innerHTML
(),
'
sdf
'
,
'
设置文本节点
'
);
});
});
test
(
'
getData
'
,
function
()
{
test
(
'
getData
'
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录