changeset a58e36288902 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=a58e36288902
description:
Use faster way to remove children
issue8453
review255641002
diffstat:
src/common.js | 2 +-
src/sao.js | 28 ++++++++++++++--------------
src/screen.js | 4 ++--
src/tab.js | 2 +-
src/view/form.js | 2 +-
src/wizard.js | 6 +++---
6 files changed, 22 insertions(+), 22 deletions(-)
diffs (147 lines):
diff -r 44318a47f9d9 -r a58e36288902 src/common.js
--- a/src/common.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/common.js Thu Jun 27 14:32:36 2019 +0200
@@ -2929,7 +2929,7 @@
);
dialog.body.append(jQuery('<p/>')
.text(Sao.i18n.gettext('Do you want to proceed?')));
- dialog.footer.children().remove();
+ dialog.footer.empty();
jQuery('<button/>', {
'class': 'btn btn-link',
'type': 'button'
diff -r 44318a47f9d9 -r a58e36288902 src/sao.js
--- a/src/sao.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/sao.js Thu Jun 27 14:32:36 2019 +0200
@@ -534,11 +534,11 @@
Sao.logout = function() {
var session = Sao.Session.current_session;
Sao.Tab.tabs.close(true).done(function() {
- jQuery('#user-preferences').children().remove();
- jQuery('#user-logout').children().remove();
- jQuery('#user-favorites').children().remove();
- jQuery('#global-search').children().remove();
- jQuery('#menu').children().remove();
+ jQuery('#user-preferences').empty();
+ jQuery('#user-logout').empty();
+ jQuery('#user-favorites').empty();
+ jQuery('#global-search').empty();
+ jQuery('#menu').empty();
session.do_logout().always(Sao.login);
Sao.set_title();
});
@@ -546,10 +546,10 @@
Sao.preferences = function() {
Sao.Tab.tabs.close(true).done(function() {
- jQuery('#user-preferences').children().remove();
- jQuery('#user-favorites').children().remove();
- jQuery('#user-logout').children().remove();
- jQuery('#menu').children().remove();
+ jQuery('#user-preferences').empty();
+ jQuery('#user-favorites').empty();
+ jQuery('#user-logout').empty();
+ jQuery('#menu').empty();
new Sao.Window.Preferences(function() {
Sao.get_preferences().then(function(preferences) {
Sao.menu(preferences);
@@ -625,9 +625,9 @@
};
Sao.user_menu = function(preferences) {
- jQuery('#user-preferences').children().remove();
- jQuery('#user-favorites').children().remove();
- jQuery('#user-logout').children().remove();
+ jQuery('#user-preferences').empty();
+ jQuery('#user-favorites').empty();
+ jQuery('#user-logout').empty();
jQuery('#user-preferences').append(jQuery('<a/>', {
'href': '#',
'title': preferences.status_bar,
@@ -698,9 +698,9 @@
view.table.addClass('no-responsive');
view.table.find('thead').hide();
var gs = new Sao.GlobalSearch();
- jQuery('#global-search').children().remove();
+ jQuery('#global-search').empty();
jQuery('#global-search').append(gs.el);
- jQuery('#menu').children().remove();
+ jQuery('#menu').empty();
jQuery('#menu').append(
form.screen.screen_container.content_box.detach());
var column = new FavoriteColumn(form.screen.model.fields.favorite);
diff -r 44318a47f9d9 -r a58e36288902 src/screen.js
--- a/src/screen.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/screen.js Thu Jun 27 14:32:36 2019 +0200
@@ -96,7 +96,7 @@
'aria-labelledby': 'bookmarks'
});
this.but_bookmark.click(function() {
- dropdown_bookmark.children().remove();
+ dropdown_bookmark.empty();
var bookmarks = this.bookmarks();
for (var i=0; i < bookmarks.length; i++) {
var name = bookmarks[i][1];
@@ -223,7 +223,7 @@
update: function() {
var completions = this.screen.domain_parser.completion(
this.get_text());
- this.search_list.children().remove();
+ this.search_list.empty();
completions.forEach(function(e) {
jQuery('<option/>', {
'value': e.trim()
diff -r 44318a47f9d9 -r a58e36288902 src/tab.js
--- a/src/tab.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/tab.js Thu Jun 27 14:32:36 2019 +0200
@@ -1017,7 +1017,7 @@
}
var record = this.screen.current_record;
var menu = dropdown.find('.dropdown-menu');
- menu.children().remove();
+ menu.empty();
Sao.Window.Attachment.get_attachments(record)
.then(function(attachments) {
attachments.forEach(function(value) {
diff -r 44318a47f9d9 -r a58e36288902 src/view/form.js
--- a/src/view/form.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/view/form.js Thu Jun 27 14:32:36 2019 +0200
@@ -1282,7 +1282,7 @@
var record = this.record;
if (this.datalist) {
- this.datalist.children().remove();
+ this.datalist.empty();
var set_autocompletion = function() {
var selection = [];
if (record) {
diff -r 44318a47f9d9 -r a58e36288902 src/wizard.js
--- a/src/wizard.js Tue Jun 25 22:58:05 2019 +0200
+++ b/src/wizard.js Thu Jun 27 14:32:36 2019 +0200
@@ -123,7 +123,7 @@
}.bind(this));
},
clean: function() {
- this.widget.children().remove();
+ this.widget.empty();
this.states = {};
},
response: function(state) {
@@ -193,7 +193,7 @@
},
clean: function() {
Sao.Wizard.Form._super.clean.call(this);
- this.footer.children().remove();
+ this.footer.empty();
},
_get_button: function(definition) {
var button = Sao.Wizard.Form._super._get_button.call(this,
@@ -247,7 +247,7 @@
},
clean: function() {
Sao.Wizard.Dialog._super.clean.call(this);
- this.footer.children().remove();
+ this.footer.empty();
},
_get_button: function(definition) {
var button = Sao.Wizard.Dialog._super._get_button.call(this,