@atlassian/aui 9.4.1 → 9.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlassian/aui",
3
3
  "description": "Atlassian User Interface library",
4
- "version": "9.4.1",
4
+ "version": "9.4.2",
5
5
  "author": "Atlassian Pty Ltd.",
6
6
  "homepage": "https://aui.atlassian.com",
7
7
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "backbone": "1.4.0",
39
39
  "css.escape": "1.5.0",
40
40
  "fancy-file-input": "2.0.4",
41
- "jquery-ui": "1.12.1",
41
+ "jquery-ui": "1.13.0",
42
42
  "skatejs": "0.13.17",
43
43
  "skatejs-template-html": "0.0.0",
44
44
  "trim-extra-html-whitespace": "1.3.0",
@@ -1,5 +1,5 @@
1
1
  import format from './format';
2
- import globalize from './internal/globalize';
2
+ import { putOnI18nIfAbsent } from './internal/globalize';
3
3
  import keys from './internal/i18n/aui';
4
4
 
5
5
  /**
@@ -29,4 +29,8 @@ export {
29
29
  * aliases for I18n or export it from here using 'default'. Webpack transforms it then to
30
30
  * 'd.default.getText' and it won't match.
31
31
  **/
32
- globalize('I18n', I18n);
32
+ // eslint-disable-next-line guard-for-in
33
+ for (const property in I18n) {
34
+ // AUI-5431 Add to global namespace, but do not override what is set by the WRM
35
+ putOnI18nIfAbsent(property, I18n[property]);
36
+ }
@@ -1,4 +1,11 @@
1
1
  const NAMESPACE = 'AJS';
2
+ const I18N_OBJECT_NAME = 'I18n';
3
+
4
+ function initNamespace() {
5
+ if (typeof window[NAMESPACE] !== 'object') {
6
+ window[NAMESPACE] = {};
7
+ }
8
+ }
2
9
 
3
10
  /**
4
11
  * Makes given value available globally under window[name] attribute.
@@ -14,9 +21,19 @@ const NAMESPACE = 'AJS';
14
21
  * @returns exposed value
15
22
  */
16
23
  export default function globalize (name, value) {
17
- if (typeof window[NAMESPACE] !== 'object') {
18
- window[NAMESPACE] = {};
19
- }
24
+ initNamespace();
20
25
 
21
26
  return window[NAMESPACE][name] = value;
22
27
  }
28
+
29
+ export function putOnI18nIfAbsent (name, value) {
30
+ initNamespace();
31
+
32
+ if (typeof window[NAMESPACE][I18N_OBJECT_NAME] !== 'object') {
33
+ window[NAMESPACE][I18N_OBJECT_NAME] = {};
34
+ }
35
+
36
+ if (typeof window[NAMESPACE][I18N_OBJECT_NAME][name] === 'undefined') {
37
+ window[NAMESPACE][I18N_OBJECT_NAME][name] = value;
38
+ }
39
+ }
@@ -136,6 +136,9 @@ $.fn.ajaxSubmit = function(options) {
136
136
  var oldSuccess = options.success || function(){};
137
137
  callbacks.push(function(data) {
138
138
  var fn = options.replaceTarget ? 'replaceWith' : 'html';
139
+ // Validate `data` through `HTML encoding` when passed `data` is passed
140
+ // to `html()`, as suggested in https://github.com/jquery-form/form/issues/464
141
+ fn == 'html' ? data = $.parseHTML($("<div>").text(data).html()) : '';
139
142
  $(options.target)[fn](data).each(oldSuccess, arguments);
140
143
  });
141
144
  }
@@ -428,7 +431,10 @@ $.fn.ajaxSubmit = function(options) {
428
431
  return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
429
432
  };
430
433
  var parseJSON = $.parseJSON || function(s) {
431
- return window['eval']('(' + s + ')');
434
+ // Arise an error resolvable including jquery instead of
435
+ // making a new function using unsanitized inputs
436
+ window.console.error('jquery.parseJSON is undefined');
437
+ return null;
432
438
  };
433
439
 
434
440
  var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4