Skip to content

Commit a3eadf7

Browse files
committed
Apply jquery-form patch
See jquery-form/form#611
1 parent 2a7c4d2 commit a3eadf7

File tree

9 files changed

+29
-18
lines changed

9 files changed

+29
-18
lines changed

omeroweb/webadmin/templates/webadmin/email.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<script type="text/javascript" src="{% static '3rdparty/jquery.tablesorter-2.0.3/jquery.tablesorter.js' %}"></script>
4141
<script type="text/javascript" src="{% static '3rdparty/jquery.quicksearch-1.0.js' %}"></script>
42-
<script type="text/javascript" src="{% static '3rdparty/jquery.form-4.3.0.js' %}"></script>
42+
<script type="text/javascript" src="{% static '3rdparty/jquery.form-4.3.1-custom.js' %}"></script>
4343
<script type="text/javascript" src="{% static '3rdparty/jquery.chosen-1.8.7/chosen.jquery.js' %}"></script>
4444
<script type="text/javascript" src="{% static '3rdparty/jquery.selectboxes-2.2.6.js' %}"></script>
4545

omeroweb/webadmin/templates/webadmin/experimenter_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
{% block script %}
4545
{{ block.super }}
46-
<script type="text/javascript" src="{% static '3rdparty/jquery.form-4.3.0.js' %}"></script>
46+
<script type="text/javascript" src="{% static '3rdparty/jquery.form-4.3.1-custom.js' %}"></script>
4747
<script type="text/javascript" src="{% static '3rdparty/jquery.chosen-1.8.7/chosen.jquery.js' %}"></script>
4848
<script type="text/javascript" src="{% static '3rdparty/jquery.selectboxes-2.2.6.js' %}"></script>
4949
<style>

omeroweb/webadmin/templates/webadmin/myaccount.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
<script type="text/javascript" src="{% static "3rdparty/jquery.tablesorter-2.0.3/jquery.tablesorter.js" %}"></script>
4040
<script type="text/javascript" src="{% static "3rdparty/jquery.quicksearch-1.0.js" %}"></script>
41-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
41+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
4242
<script type="text/javascript" src="{% static "3rdparty/jquery.flot-0.8.3/jquery.flot.js" %}"></script>
4343
<script type="text/javascript" src="{% static "3rdparty/jquery.flot-0.8.3/jquery.flot.pie.js" %}"></script>
4444

omeroweb/webclient/templates/webclient/base/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<script src="{% static 'webclient/javascript/jquery.infieldlabel-0.1.js' %}" type="text/javascript"></script>
4343
<script type="text/javascript" src="{% static "3rdparty/jquery.quicksearch-1.0.js" %}"></script>
4444
<script type="text/javascript" src="{% static "webclient/javascript/jquery.editinplace-0.1.2.js" %}"></script>
45-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
45+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
4646
<script type="text/javascript" src="{% static "webclient/javascript/ome.tagging_form.js"|add:url_suffix %}"></script>
4747
<script type="text/javascript" src="{% static "webclient/javascript/ome.progress_overlay.js"|add:url_suffix %}"></script>
4848

omeroweb/webclient/templates/webclient/base/base_container.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<!-- The following are required by the right-hand panel, E.g. annotations/metadata_general.html -->
8787
<script type="text/javascript" src="{% static "3rdparty/jquery.quicksearch-1.0.js" %}"></script>
8888
<script type="text/javascript" src="{% static "webclient/javascript/jquery.editinplace-0.1.2.js" %}"></script>
89-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
89+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
9090
<script type="text/javascript" src="{% static "webclient/javascript/ome.tagging_form.js"|add:url_suffix %}"></script>
9191
<script type="text/javascript" src="{% static "webclient/javascript/ome.right_panel_tags_pane.js"|add:url_suffix %}"></script>
9292
<script type="text/javascript" src="{% static "webclient/javascript/ome.right_panel_fileanns_pane.js"|add:url_suffix %}"></script>

omeroweb/webclient/templates/webclient/scripts/base_custom_dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{% include "webgateway/base/includes/script_src_popup.html" %}
3838
{% include "webgateway/base/includes/jquery-ui.html" %}
3939

40-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
40+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
4141

4242
<script>
4343
$(function(){

omeroweb/webclient/templates/webclient/scripts/script_ui.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{% include "webgateway/base/includes/script_src_jquery.html" %}
9696
{% include "webgateway/base/includes/script_src_popup.html" %}
9797
{% include "webgateway/base/includes/jquery-ui.html" %}
98-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
98+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
9999
<script type="text/javascript" src="{% static "3rdparty/jquery.chosen-1.8.7/chosen.jquery.js" %}"></script>
100100
<script type="text/javascript">
101101

omeroweb/webclient/templates/webclient/scripts/upload_script.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
{% include "webgateway/base/includes/script_src_jquery.html" %}
7171
{% include "webgateway/base/includes/script_src_popup.html" %}
7272
{% include "webgateway/base/includes/jquery-ui.html" %}
73-
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.0.js" %}"></script>
73+
<script type="text/javascript" src="{% static "3rdparty/jquery.form-4.3.1-custom.js" %}"></script>
7474
<link rel="stylesheet" href="{% static "webclient/css/layout.css"|add:url_suffix %}" type="text/css" />
7575
<link rel="stylesheet" href="{% static "webclient/css/dusty.css"|add:url_suffix %}" type="text/css" media="screen"/>
7676
<script type="text/javascript">

omeroweb/webgateway/static/3rdparty/jquery.form-4.3.0.js renamed to omeroweb/webgateway/static/3rdparty/jquery.form-4.3.1-custom.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Form Plugin
3-
* version: 4.3.0
3+
* version: 4.3.1-custom
44
* Requires jQuery v1.7.2 or later
55
* Project repository: https://github.com/jquery-form/form
66
@@ -159,7 +159,7 @@
159159
method = options.method || options.type || this.attr2('method');
160160
action = options.url || this.attr2('action');
161161

162-
url = (typeof action === 'string') ? action.trim() : '';
162+
url = (typeof action === 'string') ? $.trim(action) : '';
163163
url = url || window.location.href || '';
164164
if (url) {
165165
// clean url (don't include hash vaue)
@@ -206,7 +206,7 @@
206206
var qx, a = this.formToArray(options.semantic, elements, options.filtering);
207207

208208
if (options.data) {
209-
var optionsData = typeof options.data === 'function' ? options.data(a) : options.data;
209+
var optionsData = $.isFunction(options.data) ? options.data(a) : options.data;
210210

211211
options.extraData = optionsData;
212212
qx = $.param(optionsData, traditional);
@@ -262,13 +262,17 @@
262262
var successArguments = arguments,
263263
fn = options.replaceTarget ? 'replaceWith' : 'html';
264264

265+
// Validate `data` through `HTML encoding` when passed `data` is passed
266+
// to `html()`, as suggested in https://github.com/jquery-form/form/issues/464
267+
fn == 'html' ? data = $.parseHTML($("<div>").text(data).html()) : '';
268+
265269
$(options.target)[fn](data).each(function(){
266270
oldSuccess.apply(this, successArguments);
267271
});
268272
});
269273

270274
} else if (options.success) {
271-
if (Array.isArray(options.success)) {
275+
if ($.isArray(options.success)) {
272276
$.merge(callbacks, options.success);
273277
} else {
274278
callbacks.push(options.success);
@@ -455,7 +459,11 @@
455459
// ensure that every serialized input is still enabled
456460
for (i = 0; i < elements.length; i++) {
457461
el = $(elements[i]);
458-
el.prop('disabled', false);
462+
if (hasProp) {
463+
el.prop('disabled', false);
464+
} else {
465+
el.removeAttr('disabled');
466+
}
459467
}
460468
}
461469

@@ -690,7 +698,7 @@
690698
setTimeout(checkState, 15);
691699

692700
try {
693-
form.trigger('submit');
701+
form.submit();
694702

695703
} catch (err) {
696704
// just in case form has element with name/id of 'submit'
@@ -919,8 +927,11 @@
919927
return (doc && doc.documentElement && doc.documentElement.nodeName !== 'parsererror') ? doc : null;
920928
};
921929
var parseJSON = $.parseJSON || function(s) {
922-
/* jslint evil:true */
923-
return window['eval']('(' + s + ')'); // eslint-disable-line dot-notation
930+
// Arise an error resolvable including jquery instead of
931+
// making a new function using unsanitized inputs
932+
window.console.error('jquery.parseJSON is undefined');
933+
934+
return null;
924935
};
925936

926937
var httpData = function(xhr, type, s) { // mostly lifted from jq1.4.4
@@ -981,7 +992,7 @@
981992
}
982993

983994
options = options || {};
984-
options.delegation = options.delegation && typeof $.fn.on === 'function';
995+
options.delegation = options.delegation && $.isFunction($.fn.on);
985996

986997
// in jQuery 1.3+ we can fix mistakes with the ready state
987998
if (!options.delegation && this.length === 0) {
@@ -1119,7 +1130,7 @@
11191130
return a;
11201131
}
11211132

1122-
if (typeof filtering === 'function') {
1133+
if ($.isFunction(filtering)) {
11231134
els = $.map(els, filtering);
11241135
}
11251136

0 commit comments

Comments
 (0)