changeset 602c0d35425b in sao:6.0
details: https://hg.tryton.org/sao?cmd=changeset&node=602c0d35425b
description:
Remove type attribute on invisible URL widget
The widget may be filled with invalid content when it is invisible.
issue10473
review336611003
(grafted from 0690b9561ef9180e15faf238408b2453f7713d62)
diffstat:
src/view/form.js | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diffs (43 lines):
diff -r 0d48de07eef4 -r 602c0d35425b src/view/form.js
--- a/src/view/form.js Fri Jul 09 21:56:36 2021 +0200
+++ b/src/view/form.js Wed Jul 21 23:59:00 2021 +0200
@@ -4242,10 +4242,11 @@
Sao.View.Form.URL = Sao.class_(Sao.View.Form.Char, {
class_: 'form-url',
+ _type: 'url',
init: function(view, attributes) {
Sao.View.Form.URL._super.init.call(this, view, attributes);
- this.input.attr('type', 'url');
- this.button = jQuery('<a/>', {
+ this.input.attr('type', this._type);
+ this.button = this.labelled = jQuery('<a/>', {
'class': 'btn btn-default',
'target': '_blank',
'rel': 'noreferrer noopener',
@@ -4295,15 +4296,20 @@
this.button.removeClass('btn-link');
this.button.addClass('btn-default');
}
- }
+ },
+ set_invisible: function(invisible) {
+ Sao.View.Form.URL._super.set_invisible.call(this, invisible);
+ if (invisible) {
+ this.input.attr('type', '');
+ } else {
+ this.input.attr('type', this._type);
+ }
+ },
});
Sao.View.Form.Email = Sao.class_(Sao.View.Form.URL, {
class_: 'form-email',
- init: function(view, attributes) {
- Sao.View.Form.Email._super.init.call(this, view, attributes);
- this.input.attr('type', 'email');
- },
+ _type: 'email',
set_url: function(value) {
Sao.View.Form.Email._super.set_url.call(this, 'mailto:' + value);
}