This is an automated email from the ASF dual-hosted git repository.

zhangyu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b5f05a2531 AMBARI-26561: add support for $.browser (#4091)
b5f05a2531 is described below

commit b5f05a253106d69c64e7710c9aa53aad03306ea7
Author: Prabhjyot Singh <[email protected]>
AuthorDate: Wed Dec 10 21:06:44 2025 -0500

    AMBARI-26561: add support for $.browser (#4091)
    
    * AMBARI-26561: add support for $.browser
    
    * AMBARI-26561: add unit test
---
 ambari-web/brunch-config.js                        |  3 +-
 ambari-web/test/views/wizard/step5_view_test.js    |  7 +++
 .../vendor/scripts/jquery-migrate-deprecated.js    | 56 ++++++++++++++++++++++
 3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/ambari-web/brunch-config.js b/ambari-web/brunch-config.js
index 1f9ff8bd61..e95f4a25ed 100644
--- a/ambari-web/brunch-config.js
+++ b/ambari-web/brunch-config.js
@@ -49,6 +49,7 @@ module.exports.config = {
           'vendor/scripts/console-helper.js',
           'vendor/scripts/jquery-3.7.1.js',
           'vendor/scripts/jquery-migrate.js',
+          'vendor/scripts/jquery-migrate-deprecated.js',
           'vendor/scripts/handlebars-1.0.0.beta.6.js',
           'vendor/scripts/ember-latest.js',
           'vendor/scripts/ember-data-latest.js',
@@ -141,4 +142,4 @@ module.exports.config = {
   },
 
   sourceMaps: false
-};
\ No newline at end of file
+};
diff --git a/ambari-web/test/views/wizard/step5_view_test.js 
b/ambari-web/test/views/wizard/step5_view_test.js
index 2d5a54c9d9..19ab5b19ed 100644
--- a/ambari-web/test/views/wizard/step5_view_test.js
+++ b/ambari-web/test/views/wizard/step5_view_test.js
@@ -207,6 +207,13 @@ describe('App.SelectHostView', function() {
 
   });
 
+  describe('should have jquery browser plugin', function() {
+    it('should test for both chrome and webkit', function() {
+      expect($.browser.chrome).to.be.true;
+      expect($.browser.webkit).to.be.true;
+    })
+  })
+
 });
 
 describe('App.InputHostView', function() {
diff --git a/ambari-web/vendor/scripts/jquery-migrate-deprecated.js 
b/ambari-web/vendor/scripts/jquery-migrate-deprecated.js
new file mode 100644
index 0000000000..dc8dbf3848
--- /dev/null
+++ b/ambari-web/vendor/scripts/jquery-migrate-deprecated.js
@@ -0,0 +1,56 @@
+(function (factory) {
+  "use strict";
+
+  if (typeof define === "function" && define.amd) {
+
+    // AMD. Register as an anonymous module.
+    define(["jquery"], function (jQuery) {
+      return factory(jQuery, window);
+    });
+  } else if (typeof module === "object" && module.exports) {
+
+    // Node/CommonJS
+    // eslint-disable-next-line no-undef
+    module.exports = factory(require("jquery"), window);
+  } else {
+
+    // Browser globals
+    factory(jQuery, window);
+  }
+})(function (jQuery, window) {
+  "use strict";
+  jQuery.uaMatch = function (ua) {
+    ua = ua.toLowerCase();
+
+    var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
+        /(webkit)[ \/]([\w.]+)/.exec(ua) ||
+        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
+        /(msie) ([\w.]+)/.exec(ua) ||
+        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? 
rv:([\w.]+)|)/.exec(ua)
+        ||
+        [];
+
+    return {
+      browser: match[1] || "",
+      version: match[2] || "0"
+    };
+  };
+
+  var matched = jQuery.uaMatch(navigator.userAgent);
+  var browser = {};
+
+  if (matched.browser) {
+    browser[matched.browser] = true;
+    browser.version = matched.version;
+  }
+
+// Chrome is Webkit, but Webkit is also Safari.
+  if (browser.chrome) {
+    browser.webkit = true;
+  } else if (browser.webkit) {
+    browser.safari = true;
+  }
+
+  jQuery.browser = browser;
+  return jQuery;
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to