Skip to content

Commit

Permalink
recover jquery removed api via compatibility script asset
Browse files Browse the repository at this point in the history
  • Loading branch information
mpreyskurantov committed Oct 23, 2024
1 parent 46ab911 commit bffb540
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions e2e/testcafe-devextreme/tests/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<link rel="dx-theme" data-theme="fluent.saas.dark" href="../../../packages/devextreme/artifacts/css/dx.fluent.saas.dark.css" data-active="false">

<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/jquery.min.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/jquery.compatibility.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx-quill.min.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx.all.js"></script>
<script type="text/javascript" src="https://unpkg.com/devextreme-aspnet-data@2.8.2/js/dx.aspnet.data.js"></script>
Expand Down
69 changes: 69 additions & 0 deletions packages/devextreme/jquery.compatibility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*!
* jQuery JavaScript Library v3.7.1
* https://jquery.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-08-28T13:37Z
*/

/*
* https://blog.jquery.com/2024/02/06/jquery-4-0-0-beta/
* Deprecated APIs removed
*/
( function( jQuery ) {

"use strict";

var isFunction = function isFunction( obj ) {
return typeof obj === "function" && typeof obj.nodeType !== "number" &&
typeof obj.item !== "function";
};
var isWindow = function isWindow( obj ) {
return obj != null && obj === obj.window;
};

function toType(obj) {
if ( obj == null ) {
return obj + "";
}
}

function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
}

var rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g;
function fcamelCase( _all, letter ) {
return letter.toUpperCase();
}
function camelCase( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}

var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;

jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;
jQuery.now = Date.now;

jQuery.isNumeric = function( obj ) {
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
!isNaN( obj - parseFloat( obj ) );
};
jQuery.trim = function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "$1" );
};

} )(window.jQuery);
1 change: 1 addition & 0 deletions packages/devextreme/testing/runner/Views/Main/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>

<script src="@Url.Content("~/packages/devextreme/artifacts/js/jquery.js")"></script>
<script src="@Url.Content("~/packages/devextreme/jquery.compatibility.js")"></script>
<script src="@Url.Content("~/packages/devextreme/artifacts/js/knockout-latest.js")"></script>

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
</style>

<script src="@Url.Content("~/packages/devextreme/artifacts/js/jquery.js")"></script>
<script src="@Url.Content("~/packages/devextreme/jquery.compatibility.js")"></script>

<script>
$(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
</script>

<script src="@Url.ContentWithCacheBuster("~/packages/devextreme/node_modules/jquery/dist/jquery.js")"></script>
<script src="@Url.Content("~/packages/devextreme/jquery.compatibility.js")"></script>

<script src="@Url.ContentWithCacheBuster("~/packages/devextreme/node_modules/sinon/pkg/sinon.js")"></script>

Expand Down

0 comments on commit bffb540

Please sign in to comment.