You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/06/15 17:06:37 UTC

git commit: WICKET-5605 Store browser capabilities in local variables in wicket-event-jquery.js

Repository: wicket
Updated Branches:
  refs/heads/master 16e908b54 -> 3ba15c951


WICKET-5605 Store browser capabilities in local variables in wicket-event-jquery.js

Remove Wicket.Browser.isIE(LessThan)7 methods. IE7 is not supported for a long time


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3ba15c95
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3ba15c95
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3ba15c95

Branch: refs/heads/master
Commit: 3ba15c9512f83e094e2f77a6b0b0fa96f2af0e3d
Parents: 16e908b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Jun 15 18:01:30 2014 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Jun 15 18:06:17 2014 +0300

----------------------------------------------------------------------
 .../ajax/res/js/wicket-ajax-jquery-debug.js     |  2 +-
 .../wicket/ajax/res/js/wicket-event-jquery.js   | 96 ++++++++++++++------
 .../ajax/markup/html/modal/res/modal.js         | 13 +--
 3 files changed, 72 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3ba15c95/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
index 573b6ac..3a61988 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery-debug.js
@@ -179,7 +179,7 @@
 
 
 					// Special style for Internet 6 and 7 in quirks mode
-					if (Wicket.Browser.isIELessThan11() && (Wicket.Browser.isIEQuirks() || !Wicket.Browser.isIE7())) {
+					if (Wicket.Browser.isIELessThan11() && Wicket.Browser.isIEQuirks()) {
 						html +=
 							"<a id='"+self.wicketDebugLink+"' style='position:absolute; right: 10px; bottom: 10px; z-index:1000000; padding-top: 0.3em; padding-bottom: 0.3em; line-height: normal ; _padding-top: 0em; width: 12em; border: 1px solid black; background-color: white; text-align: center; opacity: 0.7; filter: alpha(opacity=70); color: blue; " +
 							"                                  left: expression(-10 - wicketDebugLink.offsetWidth + eval(document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) +(document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth));"+

http://git-wip-us.apache.org/repos/asf/wicket/blob/3ba15c95/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
index 898bbdb..0d8e0d8 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-event-jquery.js
@@ -36,62 +36,100 @@
 	jQuery.extend(true, Wicket, {
 
 		Browser: {
+			_isKHTML: null,
 			isKHTML: function () {
-				return (/Konqueror|KHTML/).test(window.navigator.userAgent) && !/Apple/.test(window.navigator.userAgent);
+				var wb = Wicket.Browser;
+				if (wb._isKHTML === null) {
+					wb._isKHTML = (/Konqueror|KHTML/).test(window.navigator.userAgent) && !/Apple/.test(window.navigator.userAgent);
+				}
+				return wb._isKHTML;
 			},
 
+			_isSafari: null,
 			isSafari: function () {
-				return !/Chrome/.test(window.navigator.userAgent) && /KHTML/.test(window.navigator.userAgent) && /Apple/.test(window.navigator.userAgent);
+				var wb = Wicket.Browser;
+				if (wb._isSafari === null) {
+					wb._isSafari = !/Chrome/.test(window.navigator.userAgent) && /KHTML/.test(window.navigator.userAgent) && /Apple/.test(window.navigator.userAgent);
+				}
+				return wb._isSafari;
 			},
 
+			_isChrome: null,
 			isChrome: function () {
-				return (/KHTML/).test(window.navigator.userAgent) && /Apple/.test(window.navigator.userAgent) && /Chrome/.test(window.navigator.userAgent);
+				var wb = Wicket.Browser;
+				if (wb._isChrome === null) {
+					wb._isChrome = (/KHTML/).test(window.navigator.userAgent) && /Apple/.test(window.navigator.userAgent) && /Chrome/.test(window.navigator.userAgent);
+				}
+				return wb._isChrome;
 			},
 
+			_isOpera: null,
 			isOpera: function () {
-				return !Wicket.Browser.isSafari() && typeof(window.opera) !== "undefined";
+				var wb = Wicket.Browser;
+				if (wb._isOpera === null) {
+					wb._isOpera = !Wicket.Browser.isSafari() && typeof(window.opera) !== "undefined";
+				}
+				return wb._isOpera;
 			},
 
+			_isIE: null,
 			isIE: function () {
-				return !Wicket.Browser.isSafari() && (typeof(document.all) !== "undefined" || window.navigator.userAgent.indexOf("Trident/")>-1) && typeof(window.opera) === "undefined";
+				var wb = Wicket.Browser;
+				if (wb._isIE === null) {
+					wb._isIE = !Wicket.Browser.isSafari() && (typeof(document.all) !== "undefined" || window.navigator.userAgent.indexOf("Trident/")>-1) && typeof(window.opera) === "undefined";
+				}
+				return wb._isIE;
 			},
 
+			_isIEQuirks: null,
 			isIEQuirks: function () {
-				// is the browser internet explorer in quirks mode (we could use document.compatMode too)
-				return Wicket.Browser.isIE() && window.document.documentElement.clientHeight === 0;
-			},
-
-			isIELessThan7: function () {
-				var index = window.navigator.userAgent.indexOf("MSIE");
-				var version = parseFloat(window.navigator.userAgent.substring(index + 5));
-				return Wicket.Browser.isIE() && version < 7;
-			},
-
-			isIE7: function () {
-				var index = window.navigator.userAgent.indexOf("MSIE");
-				var version = parseFloat(window.navigator.userAgent.substring(index + 5));
-				return Wicket.Browser.isIE() && version >= 7;
+				var wb = Wicket.Browser;
+				if (wb._isIEQuirks === null) {
+					// is the browser internet explorer in quirks mode (we could use document.compatMode too)
+					wb._isIEQuirks = Wicket.Browser.isIE() && window.document.documentElement.clientHeight === 0;
+				}
+				return wb._isIEQuirks;
 			},
 
+			_isIELessThan9: null,
 			isIELessThan9: function () {
-				var index = window.navigator.userAgent.indexOf("MSIE");
-				var version = parseFloat(window.navigator.userAgent.substring(index + 5));
-				return Wicket.Browser.isIE() && version < 9;
+				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 () {
-				return !Wicket.Browser.isSafari() && typeof(document.all) !== "undefined" && typeof(window.opera) === "undefined";
+				var wb = Wicket.Browser;
+				if (wb._isIELessThan11 === null) {
+					wb._isIELessThan11 = !Wicket.Browser.isSafari() && typeof(document.all) !== "undefined" && typeof(window.opera) === "undefined";
+				}
+				return wb._isIELessThan11;
 			},
 
+			_isIE11: null,
 			isIE11: function () {
-				var userAgent = window.navigator.userAgent;
-				var isTrident = userAgent.indexOf("Trident");
-				var is11 = userAgent.indexOf("rv:11");
-				return isTrident && is11;
+				var wb = Wicket.Browser;
+				if (wb._isIE11 === null) {
+					var userAgent = window.navigator.userAgent;
+					var isTrident = userAgent.indexOf("Trident");
+					var is11 = userAgent.indexOf("rv:11");
+					wb._isIE11 = isTrident && is11;
+				}
+				return wb._isIE11;
 			},
 
+			_isGecko: null,
 			isGecko: function () {
-				return (/Gecko/).test(window.navigator.userAgent) && !Wicket.Browser.isSafari();
+				var wb = Wicket.Browser;
+				if (wb._isGecko === null) {
+					wb._isGecko = (/Gecko/).test(window.navigator.userAgent) && !Wicket.Browser.isSafari();
+				}
+				return wb._isGecko;
 			}
 		},
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/3ba15c95/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
----------------------------------------------------------------------
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 befc625..de15e13 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
@@ -371,7 +371,7 @@
 
 			if (Wicket.Browser.isIELessThan11()) {
 				// IE stupid 3px bug - not fixed even in IE7 quirks!
-				if (Wicket.Browser.isIE7() === false || Wicket.Browser.isIEQuirks()) {
+				if (Wicket.Browser.isIEQuirks()) {
 					this.topLeft.style.marginRight = "-3px";
 					this.topRight.style.marginLeft = "-3px";
 					this.bottomLeft.style.marginRight = "-3px";
@@ -1193,14 +1193,9 @@
 									"<div class=\"w_content_3\">"+
 			                            "<div class=\"w_content\">";
 					if (isFrame) {
-						s+= "<iframe";
-						if (Wicket.Browser.isIELessThan7()) {
-							s+= " src=\"about:blank\"";
-						}
-						s+= " frameborder=\"0\" id=\""+idContent+"\" allowtransparency=\"false\" style=\"height: 200px\" class=\"wicket_modal\"></iframe>";
+						s+= "<iframe frameborder=\"0\" id=\""+idContent+"\" allowtransparency=\"false\" style=\"height: 200px\" class=\"wicket_modal\"></iframe>";
 					} else {
-						var styleIE7 = Wicket.Browser.isIE7() ? "style='z-index: 20001'" : "";
-						s+= "<div id='"+idContent+"' class='w_content_container' " + styleIE7 + "></div>";
+						s+= "<div id='"+idContent+"' class='w_content_container'></div>";
 					}
 						s+=
 										"</div>"+
@@ -1449,7 +1444,7 @@
 				return;
 			}
 
-			if (Wicket.Browser.isIELessThan11() && Wicket.Browser.isIE7() === false) {
+			if (Wicket.Browser.isIELessThan11()) {
 				this.boxes = [];
 				var selects = doc.getElementsByTagName("select");
 				for (var i = 0; i < selects.length; i++) {