fix: jquery xhtml violations

v1.18.x
psychobunny 5 years ago
parent 25d509c42c
commit 275e837bcf

@ -500,7 +500,7 @@ app.cacheBuster = null;
titleObj.interval = setInterval(function () { titleObj.interval = setInterval(function () {
var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1]; var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1];
if (title) { if (title) {
window.document.title = $('<div/>').html(title).text(); window.document.title = $('<div></div>').html(title).text();
} }
}, 2000); }, 2000);
}); });
@ -510,7 +510,7 @@ app.cacheBuster = null;
clearInterval(titleObj.interval); clearInterval(titleObj.interval);
} }
if (titleObj.titles[0]) { if (titleObj.titles[0]) {
window.document.title = $('<div/>').html(titleObj.titles[0]).text(); window.document.title = $('<div></div>').html(titleObj.titles[0]).text();
} }
} }
}; };

@ -64,7 +64,7 @@ define('forum/chats/search', ['components'], function (components) {
'<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username; '<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
} }
var chatEl = $('<li component="chat/search/user" />') var chatEl = $('<li component="chat/search/user"></li>')
.attr('data-uid', userObj.uid) .attr('data-uid', userObj.uid)
.appendTo(chatsListEl); .appendTo(chatsListEl);

@ -148,7 +148,7 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
result.find('*').each(function () { result.find('*').each(function () {
$(this).after('<!-- ' + nested.length + ' -->'); $(this).after('<!-- ' + nested.length + ' -->');
nested.push($('<div />').append($(this))); nested.push($('<div></div>').append($(this)));
}); });
result.html(result.html().replace(regex, function (match, p1) { result.html(result.html().replace(regex, function (match, p1) {

@ -26,7 +26,7 @@ define('autocomplete', function () {
if (result && result.users) { if (result && result.users) {
var names = result.users.map(function (user) { var names = result.users.map(function (user) {
var username = $('<div/>').html(user.username).text(); var username = $('<div></div>').html(user.username).text();
return user && { return user && {
label: username, label: username,
value: username, value: username,

@ -121,7 +121,7 @@ define('chat', [
}; };
module.onRoomRename = function (data) { module.onRoomRename = function (data) {
var newTitle = $('<div/>').html(data.newName).text(); var newTitle = $('<div></div>').html(data.newName).text();
var modal = module.getModal(data.roomId); var modal = module.getModal(data.roomId);
modal.find('[component="chat/room/name"]').text(newTitle); modal.find('[component="chat/room/name"]').text(newTitle);
taskbar.update('chat', modal.attr('data-uuid'), { taskbar.update('chat', modal.attr('data-uuid'), {

@ -46,7 +46,7 @@ define('iconSelect', ['benchpress'], function (Benchpress) {
className: 'btn-primary', className: 'btn-primary',
callback: function () { callback: function () {
var iconClass = $('.bootbox .selected').attr('class'); var iconClass = $('.bootbox .selected').attr('class');
var categoryIconClass = $('<div/>').addClass(iconClass).removeClass('fa').removeClass('selected') var categoryIconClass = $('<div></div>').addClass(iconClass).removeClass('fa').removeClass('selected')
.attr('class'); .attr('class');
if (categoryIconClass) { if (categoryIconClass) {

@ -33,7 +33,7 @@ define('settings/sorted-list', ['benchpress', 'jqueryui'], function (benchpress)
var modal = bootbox.confirm(formHtml, function (save) { var modal = bootbox.confirm(formHtml, function (save) {
if (save) { if (save) {
var itemUUID = utils.generateUUID(); var itemUUID = utils.generateUUID();
var form = $('<form class="" data-sorted-list-uuid="' + itemUUID + '" data-sorted-list-object="' + key + '" />'); var form = $('<form class="" data-sorted-list-uuid="' + itemUUID + '" data-sorted-list-object="' + key + '"></form>');
form.append(modal.find('form').children()); form.append(modal.find('form').children());
$('#content').append(form.hide()); $('#content').append(form.hide());
@ -83,7 +83,7 @@ define('settings/sorted-list', ['benchpress', 'jqueryui'], function (benchpress)
var modal = bootbox.confirm(form, function (save) { var modal = bootbox.confirm(form, function (save) {
if (save) { if (save) {
var form = $('<form class="" data-sorted-list-uuid="' + itemUUID + '" data-sorted-list-object="' + key + '" />'); var form = $('<form class="" data-sorted-list-uuid="' + itemUUID + '" data-sorted-list-object="' + key + '"></form>');
form.append(modal.find('form').children()); form.append(modal.find('form').children());
$('#content').find('[data-sorted-list-uuid="' + itemUUID + '"][data-sorted-list-object="' + key + '"]').remove(); $('#content').find('[data-sorted-list-uuid="' + itemUUID + '"][data-sorted-list-object="' + key + '"]').remove();

@ -153,7 +153,7 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator
translator.translate(data.options.title, function (taskTitle) { translator.translate(data.options.title, function (taskTitle) {
var title = $('<div></div>').text(taskTitle || 'NodeBB Task').html(); var title = $('<div></div>').text(taskTitle || 'NodeBB Task').html();
var taskbarEl = $('<li />') var taskbarEl = $('<li></li>')
.addClass(data.options.className) .addClass(data.options.className)
.html('<a href="#"' + (data.options.image ? ' style="background-image: url(\'' + data.options.image + '\'); background-size: cover;"' : '') + '>' + .html('<a href="#"' + (data.options.image ? ' style="background-image: url(\'' + data.options.image + '\'); background-size: cover;"' : '') + '>' +
(data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '') + (data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '') +

@ -464,7 +464,7 @@
if (option.group) { if (option.group) {
// initialise group if necessary // initialise group if necessary
if (!groups[option.group]) { if (!groups[option.group]) {
groups[option.group] = $("<optgroup/>").attr("label", option.group); groups[option.group] = $("<optgroup></optgroup>").attr("label", option.group);
} }
elem = groups[option.group]; elem = groups[option.group];
@ -496,7 +496,7 @@
// checkboxes have to nest within a containing element, so // checkboxes have to nest within a containing element, so
// they break the rules a bit and we end up re-assigning // they break the rules a bit and we end up re-assigning
// our 'input' element to this container instead // our 'input' element to this container instead
input = $("<div/>"); input = $("<div></div>");
each(inputOptions, function(_, option) { each(inputOptions, function(_, option) {
var checkbox = $(templates.inputs[options.inputType]); var checkbox = $(templates.inputs[options.inputType]);

Loading…
Cancel
Save