You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2019/05/09 06:33:00 UTC

[wicket] 07/11: JS removed Wicket.Browser.isIELess..()

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

svenmeier pushed a commit to branch wicket-js-cleanup
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit 5e2adc3049614ca4fbd6b15d69318ec8a3d6d813
Author: Sven Meier <sv...@apache.org>
AuthorDate: Mon May 6 15:01:02 2019 +0200

    JS removed Wicket.Browser.isIELess..()
    
    was used win wicket-autocomplete.js and modal.js for obscure reasons,
    anything lower ie 11 is no longer supported
---
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       | 55 ++-----------
 wicket-core/src/test/js/event.js                   | 16 +---
 .../html/autocomplete/wicket-autocomplete.js       |  8 --
 .../extensions/ajax/markup/html/modal/res/modal.js | 92 ++--------------------
 4 files changed, 16 insertions(+), 155 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 6eaf581..dab6b21 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -1966,37 +1966,16 @@
 						// serialize the style to string
 						var content = Wicket.DOM.serializeNodeChildren(node);
 
-						// create stylesheet
-						if (Wicket.Browser.isIELessThan11()) {
-							try  {
-								document.createStyleSheet().cssText = content;
-								return FunctionsExecuter.DONE;
-							}
-							catch (ignore) {
-								var run = function() {
-									try {
-										document.createStyleSheet().cssText = content;
-									}
-									catch(e) {
-										Wicket.Log.error("Head.Contributor.processStyle: " + e);
-									}
-									notify();
-								};
-								window.setTimeout(run, 1);
-								return FunctionsExecuter.ASYNC;
-							}
-						} else {
-							// create style element
-							var style = Wicket.Head.createElement("style");
+						// create style element
+						var style = Wicket.Head.createElement("style");
 
-							// copy id attribute
-							style.id = node.getAttribute("id");
+						// copy id attribute
+						style.id = node.getAttribute("id");
 
-							var textNode = document.createTextNode(content);
-							style.appendChild(textNode);
+						var textNode = document.createTextNode(content);
+						style.appendChild(textNode);
 
-							Wicket.Head.addElement(style);
-						}
+						Wicket.Head.addElement(style);
 
 						// continue to next step
 						return FunctionsExecuter.DONE;
@@ -2473,26 +2452,6 @@
 				return wb._isIEQuirks;
 			},
 
-			_isIELessThan9: null,
-			isIELessThan9: function () {
-				var wb = Wicket.Browser;
-				if (wb._isIELessThan9 === null) {
-					var index = window.navigator.userAgent.indexOf("MSIE");
-					var version = parseFloat(window.navigator.userAgent.substring(index + 5));
-					wb._isIELessThan9 = Wicket.Browser.isIE() && version < 9;
-				}
-				return wb._isIELessThan9;
-			},
-
-			_isIELessThan11: null,
-			isIELessThan11: function () {
-				var wb = Wicket.Browser;
-				if (wb._isIELessThan11 === null) {
-					wb._isIELessThan11 = typeof(document.all) !== "undefined" && typeof(window.opera) === "undefined";
-				}
-				return wb._isIELessThan11;
-			},
-
 			_isIE11: null,
 			isIE11: function () {
 				var wb = Wicket.Browser;
diff --git a/wicket-core/src/test/js/event.js b/wicket-core/src/test/js/event.js
index c29ebf4..25bb050 100644
--- a/wicket-core/src/test/js/event.js
+++ b/wicket-core/src/test/js/event.js
@@ -329,25 +329,15 @@ jQuery(document).ready(function() {
 
 		stop();
 
-		if (Wicket.Browser.isIELessThan11()) {
-			expect(3);
-		} else {
-			expect(1);
-		}
+		expect(1);
 
 		var $input = jQuery("#inputChangeInput");
 		$input.on("inputchange", function() {
 			ok(true, "inputchange event is triggered!");
 		});
 
-		if (Wicket.Browser.isIELessThan11()) {
-			$input.trigger("paste");
-			$input.trigger("keyup");
-			$input.trigger("cut");
-		} else {
-			$input.trigger("input");
-		}
+		$input.trigger("input");
+		
 		start();
-
 	});
 });
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
index 2610beb..4093cab 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
@@ -668,14 +668,6 @@
 
 			Wicket.Log.info("Response processed successfully.");
 			hideIndicator();
-
-			// hack for a focus issue in IE, WICKET-2279
-			if (Wicket.Browser.isIELessThan11()) {
-				var range = document.selection.createRange();
-				if (range !== null) {
-					range.select();
-				}
-			}
 		}
 
 		function scheduleEmptyCheck() {
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index 2b2eddf..2e8ad15 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -240,23 +240,6 @@
 			this.bottom = _(idBottom);
 			this.captionText = _(idCaptionText);
 
-			if (Wicket.Browser.isIELessThan11()) {
-				// IE stupid 3px bug - not fixed even in IE7 quirks!
-				if (Wicket.Browser.isIEQuirks()) {
-					this.topLeft.style.marginRight = "-3px";
-					this.topRight.style.marginLeft = "-3px";
-					this.bottomLeft.style.marginRight = "-3px";
-					this.bottomRight.style.marginLeft = "-3px";
-				}
-			}
-
-			// HACK - IE doesn't support position:fixed. Gecko does, however for a reason
-			// we need to have background position: absolute, which makes the movement of
-			// the window really jerky if the window stays position: fixed
-			if (Wicket.Browser.isIELessThan11()) {
-				this.window.style.position = "absolute";
-			}
-
 			// fix the cursors
 			if (this.settings.resizable === false) {
 				this.top.style.cursor =  this.topLeft.style.cursor = this.topRight.style.cursor =
@@ -350,11 +333,6 @@
 			var scTop = 0;
 			var scLeft = 0;
 
-			if (Wicket.Browser.isIELessThan11()) {
-				scLeft = Wicket.Window.getScrollX();
-				scTop = Wicket.Window.getScrollY();
-			}
-
 			var width = Wicket.Window.getViewportWidth();
 			var height = Wicket.Window.getViewportHeight();
 
@@ -695,20 +673,6 @@
 			}
 
 			this.adjustOpenWindowsStatusAndZIndexesOnClose();
-
-			if (Wicket.Browser.isIELessThan11()) {
-				// There's a strange focus problem in IE that disables focus on entire page,
-				// unless something focuses an input
-				var e = document.createElement("input");
-				var x = Wicket.Window.getScrollX();
-				var y = Wicket.Window.getScrollY();
-				e.style.position = "absolute";
-				e.style.left = x + "px";
-				e.style.top = y + "px";
-				document.body.appendChild(e);
-				e.focus();
-				document.body.removeChild(e);
-			}
 		},
 
 		adjustOpenWindowsStatusAndZIndexesOnClose: function() {
@@ -1126,13 +1090,6 @@
 					e.style.backgroundImage = "none";
 				}
 
-				// HACK - it really sucks that we have to set this to absolute even for gecko.
-				// however background with position:fixed makes the text cursor in textfieds
-				// in modal window disappear
-				if (Wicket.Browser.isIELessThan11()) {
-					e.style.position = "absolute";
-				}
-
 				// set the element
 				this.element = e;
 
@@ -1288,25 +1245,6 @@
 			if (!this.shown) {
 				return;
 			}
-
-			if (Wicket.Browser.isIELessThan11()) {
-				this.boxes = [];
-				var selects = doc.getElementsByTagName("select");
-				for (var i = 0; i < selects.length; i++) {
-					var element = selects[i];
-
-					// if this is not an iframe window and the select is child of window content,
-					// don't hide it
-					if (win.isIframe() === false && this.isParent(element, win.content)) {
-						continue;
-					}
-
-					if (element.style.visibility !== "hidden") {
-						element.style.visibility = "hidden";
-						this.boxes.push(element);
-					}
-				}
-			}
 		},
 
 		/**
@@ -1345,15 +1283,13 @@
 			if (!this.shown) {
 				return;
 			}
-			// explorer doesn't need this, because for IE disableTabs() is called.
-			// plus in IE this causes problems because it scrolls document		);
-			if (Wicket.Browser.isIELessThan11() === false) {
-				this.focusRevertList = [];
-				var body = doc.getElementsByTagName("body")[0];
-				for (var i = 0; i < body.childNodes.length; ++i) {
-					this.disableFocusElement(body.childNodes[i], this.focusRevertList, win);
-				}
+			
+			this.focusRevertList = [];
+			var body = doc.getElementsByTagName("body")[0];
+			for (var i = 0; i < body.childNodes.length; ++i) {
+				this.disableFocusElement(body.childNodes[i], this.focusRevertList, win);
 			}
+			
 			this.focusDisabled=true;
 		},
 
@@ -1385,22 +1321,6 @@
 			if (typeof (this.tabbableTags) === "undefined") {
 				this.tabbableTags = ["A", "BUTTON", "TEXTAREA", "INPUT", "IFRAME", "SELECT"];
 			}
-			if (Wicket.Browser.isIELessThan11()) {
-				this.disabledTabsRevertList = [];
-				for (var j = 0; j < this.tabbableTags.length; j++) {
-					var tagElements = doc.getElementsByTagName(this.tabbableTags[j]);
-					for (var k = 0 ; k < tagElements.length; k++) {
-						// if this is not an iframe window and the element is child of modal window,
-						// don't disable tab on it
-						if (win.isIframe() === true || this.isParent(tagElements[k], win.window) === false) {
-							var element = tagElements[k];
-							element.hiddenTabIndex = element.tabIndex;
-							element.tabIndex="-1";
-							this.disabledTabsRevertList.push(element);
-						}
-					}
-				}
-			}
 		},
 
 		/**