aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-09-05 08:36:35 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-09-05 18:33:10 +0200
commitc9ce96ff054788f31d45d774dcfa008c0de095c5 (patch)
tree183edb1054ea723afc4d326657c871401cfac243
parentbcaf9a48bb08c3dd0e3294705c4e888f51d49d58 (diff)
downloadnextcloud-server-c9ce96ff054788f31d45d774dcfa008c0de095c5.tar.gz
nextcloud-server-c9ce96ff054788f31d45d774dcfa008c0de095c5.zip
Show avatar using "span" instead of "div"
Visually it makes no difference, but as the ".avatar" element is inside a "span" element it can not be a block element to be compliant with the HTML specification. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--apps/comments/js/commentstabview.js14
-rw-r--r--apps/comments/tests/js/commentstabviewSpec.js2
2 files changed, 8 insertions, 8 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js
index 8b20bac571b..11b33e9f0cc 100644
--- a/apps/comments/js/commentstabview.js
+++ b/apps/comments/js/commentstabview.js
@@ -198,20 +198,20 @@
displayTpl: function (item) {
return '<li>'
+ '<span class="avatar-name-wrapper">'
- + '<div class="avatar" '
+ + '<span class="avatar" '
+ ' data-username="' + escapeHTML(item.id) + '"' // for avatars
+ ' data-user="' + escapeHTML(item.id) + '"' // for contactsmenu
- + ' data-user-display-name="' + escapeHTML(item.label) + '"></div>'
+ + ' data-user-display-name="' + escapeHTML(item.label) + '"></span>'
+ ' <strong>' + escapeHTML(item.label) + '</strong>'
+ '</span></li>';
},
insertTpl: function (item) {
return ''
+ '<span class="avatar-name-wrapper">'
- + '<div class="avatar" '
+ + '<span class="avatar" '
+ ' data-username="' + escapeHTML(item.id) + '"' // for avatars
+ ' data-user="' + escapeHTML(item.id) + '"' // for contactsmenu
- + ' data-user-display-name="' + escapeHTML(item.label) + '"></div>'
+ + ' data-user-display-name="' + escapeHTML(item.label) + '"></span>'
+ ' <strong>' + escapeHTML(item.label) + '</strong>'
+ '</span>';
},
@@ -224,7 +224,7 @@
// passing the whole comments form would re-apply and request
// avatars from the server
$(je.target).find(
- 'div[data-username="' + $el.find('[data-username]').data('username') + '"]'
+ 'span[data-username="' + $el.find('[data-username]').data('username') + '"]'
).parent(),
editionMode
);
@@ -486,11 +486,11 @@
},
_composeHTMLMention: function(uid, displayName) {
- var avatar = '<div class="avatar" '
+ var avatar = '<span class="avatar" '
+ 'data-username="' + _.escape(uid) + '"'
+ ' data-user="' + _.escape(uid) + '"'
+ ' data-user-display-name="'
- + _.escape(displayName) + '"></div>';
+ + _.escape(displayName) + '"></span>';
var isCurrentUser = (uid === OC.getCurrentUser().uid);
diff --git a/apps/comments/tests/js/commentstabviewSpec.js b/apps/comments/tests/js/commentstabviewSpec.js
index c90ad04e419..bd1353cc43d 100644
--- a/apps/comments/tests/js/commentstabviewSpec.js
+++ b/apps/comments/tests/js/commentstabviewSpec.js
@@ -309,7 +309,7 @@ describe('OCA.Comments.CommentsTabView tests', function() {
expect(createStub.calledOnce).toEqual(false);
expect($newCommentForm.find('.message').html()).toContain('Mention to <span');
- expect($newCommentForm.find('.message').html()).toContain('<div class="avatar"');
+ expect($newCommentForm.find('.message').html()).toContain('<span class="avatar"');
expect($newCommentForm.find('.message').html()).toContain('<strong>User Name</strong>');
expect($newCommentForm.find('.message').text()).not.toContain('@');
// In this case the default behaviour is prevented by the