mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
WebUI: Fix jQuery DOM manipulation issues
The commit includes the following jQuery patches: - Manipulation: Make jQuery.htmlPrefilter an identity function (https://github.com/jquery/jquery/pull/4642) - Manipulation: Skip the select wrapper for <option> outside of IE 9 (https://github.com/jquery/jquery/pull/4647) In addition there is included a script that helps to patch and build the new version of jQuery: $ install/ui/util/make-jquery.js 3.4.1 Ticket: https://pagure.io/freeipa/issue/8507 Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
b47ddb0186
commit
29b41aef0a
3
install/ui/src/libs/jquery.js
vendored
3
install/ui/src/libs/jquery.js
vendored
File diff suppressed because one or more lines are too long
43
install/ui/util/jquery-patches/3.4.1/gh-4642.patch
Normal file
43
install/ui/util/jquery-patches/3.4.1/gh-4642.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 1d61fd9407e6fbe82fe55cb0b938307aa0791f77 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
|
||||
<m.goleb@gmail.com>
|
||||
Date: Mon, 16 Mar 2020 21:49:29 +0100
|
||||
Subject: [PATCH] Manipulation: Make jQuery.htmlPrefilter an identity function
|
||||
|
||||
Closes gh-4642
|
||||
|
||||
(cherry picked from 90fed4b453a5becdb7f173d9e3c1492390a1441f)
|
||||
---
|
||||
src/manipulation.js | 9 +--------
|
||||
1 file changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/manipulation.js b/src/manipulation.js
|
||||
index 017345af..dec21ea0 100644
|
||||
--- a/src/manipulation.js
|
||||
+++ b/src/manipulation.js
|
||||
@@ -33,13 +33,6 @@ define( [
|
||||
|
||||
var
|
||||
|
||||
- /* eslint-disable max-len */
|
||||
-
|
||||
- // See https://github.com/eslint/eslint/issues/3229
|
||||
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
|
||||
-
|
||||
- /* eslint-enable */
|
||||
-
|
||||
// Support: IE <=10 - 11, Edge 12 - 13 only
|
||||
// In IE/Edge using regex groups here causes severe slowdowns.
|
||||
// See https://connect.microsoft.com/IE/feedback/details/1736512/
|
||||
@@ -236,7 +229,7 @@ function remove( elem, selector, keepData ) {
|
||||
|
||||
jQuery.extend( {
|
||||
htmlPrefilter: function( html ) {
|
||||
- return html.replace( rxhtmlTag, "<$1></$2>" );
|
||||
+ return html;
|
||||
},
|
||||
|
||||
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
|
||||
--
|
||||
2.20.1
|
||||
|
71
install/ui/util/jquery-patches/3.4.1/gh-4647.patch
Normal file
71
install/ui/util/jquery-patches/3.4.1/gh-4647.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From 966a70909019aa09632c87c0002c522fa4a1e30e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
|
||||
<m.goleb@gmail.com>
|
||||
Date: Mon, 30 Mar 2020 20:15:09 +0200
|
||||
Subject: [PATCH] Manipulation: Skip the select wrapper for <option> outside of
|
||||
IE 9
|
||||
|
||||
Closes gh-4647
|
||||
---
|
||||
src/manipulation/support.js | 6 ++++++
|
||||
src/manipulation/wrapMap.js | 15 ++++++++-------
|
||||
2 files changed, 14 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/manipulation/support.js b/src/manipulation/support.js
|
||||
index 4a5d9af4..62d6bb3e 100644
|
||||
--- a/src/manipulation/support.js
|
||||
+++ b/src/manipulation/support.js
|
||||
@@ -28,6 +28,12 @@ define( [
|
||||
// Make sure textarea (and checkbox) defaultValue is properly cloned
|
||||
div.innerHTML = "<textarea>x</textarea>";
|
||||
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
|
||||
+
|
||||
+ // Support: IE <=9 only
|
||||
+ // IE <=9 replaces <option> tags with their contents when inserted outside of
|
||||
+ // the select element.
|
||||
+ div.innerHTML = "<option></option>";
|
||||
+ support.option = !!div.lastChild;
|
||||
} )();
|
||||
|
||||
return support;
|
||||
diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js
|
||||
index 1f446f7d..da48bf9f 100644
|
||||
--- a/src/manipulation/wrapMap.js
|
||||
+++ b/src/manipulation/wrapMap.js
|
||||
@@ -1,13 +1,12 @@
|
||||
-define( function() {
|
||||
+define( [
|
||||
+ "./support"
|
||||
+], function( support ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// We have to close these tags to support XHTML (#13200)
|
||||
var wrapMap = {
|
||||
|
||||
- // Support: IE <=9 only
|
||||
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
||||
-
|
||||
// XHTML parsers do not magically insert elements in the
|
||||
// same way that tag soup parsers do. So we cannot shorten
|
||||
// this by omitting <tbody> or other required elements.
|
||||
@@ -19,11 +18,13 @@ var wrapMap = {
|
||||
_default: [ 0, "", "" ]
|
||||
};
|
||||
|
||||
-// Support: IE <=9 only
|
||||
-wrapMap.optgroup = wrapMap.option;
|
||||
-
|
||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
||||
wrapMap.th = wrapMap.td;
|
||||
|
||||
+// Support: IE <=9 only
|
||||
+if ( !support.option ) {
|
||||
+ wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
|
||||
+}
|
||||
+
|
||||
return wrapMap;
|
||||
} );
|
||||
--
|
||||
2.20.1
|
||||
|
29
install/ui/util/make-jquery.sh
Executable file
29
install/ui/util/make-jquery.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo 'The script requires exactly one argument (a jQuery version):'
|
||||
echo
|
||||
echo ' $ ./make-jquery.sh 3.4.1'
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=$(realpath $(dirname "${BASH_SOURCE[0]}"))
|
||||
JQUERY_VERSION=$1
|
||||
|
||||
# Clone jQuery and apply patches
|
||||
JQUERY_CLONE=$(mktemp -d)
|
||||
git clone -b ${JQUERY_VERSION} --depth 1 https://github.com/jquery/jquery.git $JQUERY_CLONE
|
||||
pushd $JQUERY_CLONE
|
||||
git am ${WD}/jquery-patches/${JQUERY_VERSION}/*
|
||||
|
||||
# Build jQuery
|
||||
npm install
|
||||
npm run-script build
|
||||
|
||||
# Replace the project version of jQuery with the built one
|
||||
cp -fv dist/jquery.min.js ${WD}/../src/libs/jquery.js
|
||||
|
||||
# Clean up
|
||||
popd
|
||||
rm -rf $JQUERY_CLONE
|
Loading…
Reference in New Issue
Block a user