aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-01-11 16:31:31 -0500
committerjeresig <jeresig@gmail.com>2010-01-11 16:31:31 -0500
commit23d600c66d8e1f7298dcb46eedba862279cd251d (patch)
treebcb2ef8516d0712e08776f29bd4d77b576dda3f5
parent3e9ef6f5c08e63a90ef2dfd3bdc833994e7a0ac8 (diff)
downloadjquery-23d600c66d8e1f7298dcb46eedba862279cd251d.tar.gz
jquery-23d600c66d8e1f7298dcb46eedba862279cd251d.zip
Make sure that wrapInner works on elements that have no contents. Fixes #3552.
-rw-r--r--src/manipulation.js9
-rw-r--r--test/unit/manipulation.js7
2 files changed, 14 insertions, 2 deletions
diff --git a/src/manipulation.js b/src/manipulation.js
index 3db2c3552..742ec2543 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -77,7 +77,14 @@ jQuery.fn.extend({
wrapInner: function( html ) {
return this.each(function() {
- jQuery( this ).contents().wrapAll( html );
+ var self = jQuery( this ), contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
});
},
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 3eef1221c..a0239a405 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -145,7 +145,7 @@ test("wrapAll(String|Element)", function() {
// })
var testWrapInner = function(val) {
- expect(6);
+ expect(8);
var num = jQuery("#first").children().length;
var result = jQuery('#first').wrapInner('<div class="red"><div id="tmp"></div></div>');
equals( jQuery("#first").children().length, 1, "Only one child" );
@@ -158,6 +158,11 @@ var testWrapInner = function(val) {
equals( jQuery("#first").children().length, 1, "Only one child" );
ok( jQuery("#first").children().is("#empty"), "Verify Right Element" );
equals( jQuery("#first").children().children().length, num, "Verify Elements Intact" );
+
+ var div = jQuery("<div/>");
+ div.wrapInner("<span></span>");
+ equals(div.children().length, 1, "The contents were wrapped.");
+ equals(div.children()[0].nodeName.toLowerCase(), "span", "A span was inserted.");
}
test("wrapInner(String|Element)", function() {
on> Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/federation/l10n/zh_CN.json
blob: 919c572ba34aac4098731adab82fbf0c0495aec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ "translations": {
    "Added to the list of trusted servers" : "添加到可信任服务器列表中",
    "Server is already in the list of trusted servers." : "服务器在线,并已成功添加至信任服务器列表。",
    "No server to federate with found" : "没有找到联盟服务器",
    "Could not add server" : "无法添加服务器",
    "Trusted servers" : "可信任服务器",
    "Federation allows you to connect with other trusted servers to exchange the user directory. For example this will be used to auto-complete external users for federated sharing." : "联盟允许您与其他受信任的服务器连接并交换用户目录。 例如,这将用于自动完成外部用户组成共享联盟。",
    "Add server automatically once a federated share was created successfully" : "一旦联合共享创建成功自动添加服务器",
    "+ Add trusted server" : "+ 添加可信任服务器",
    "Trusted server" : "可信任服务器",
    "Add" : "添加",
    "Federation" : "联合"
},"pluralForm" :"nplurals=1; plural=0;"
}