Skip to content
This repository
Browse code

BUGFIX Replaced logic for checking external URLs in CMS Menu with mor…

…e stable jQuery Mobile codebase (fixes problems on IE not loading menu entries via ajax) (#7002)
  • Loading branch information...
commit c518a19ec2e41609cfcc6f218c3e39f876e07943 1 parent 58433d3
Ingo Schommer authored March 30, 2012
6  admin/javascript/LeftAndMain.Content.js
@@ -159,10 +159,10 @@
159 159
 						  self.submitForm_responseHandler(form, xmlhttp.responseText, status, xmlhttp, formData);
160 160
 						}
161 161
 
162  
-						// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it
  162
+						// Simulates a redirect on an ajax response - just exchange the URL without re-requesting it.
163 163
 						if(window.History.enabled) {
164 164
 							var url = xmlhttp.getResponseHeader('X-ControllerURL');
165  
-							if(url) window.history.replaceState({}, '', url);
  165
+							if(url) window.History.replaceState({}, '', url);
166 166
 						}
167 167
 						
168 168
 						// Re-init tabs (in case the form tag itself is a tabset)
@@ -287,7 +287,7 @@
287 287
 				var url = $(node).find('a:first').attr('href');
288 288
 				if(url && url != '#') {
289 289
 
290  
-					if($(node).find('a:first').is(':internal')) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
  290
+					if($.path.isExternal($(node).find('a:first'))) url = url = $.path.makeUrlAbsolute(url, $('base').attr('href'));
291 291
 					// Reload only edit form if it exists (side-by-side view of tree and edit view), otherwise reload whole panel
292 292
 					if(container.find('.cms-edit-form').length) {
293 293
 						url += '?cms-view-form=1';
10  admin/javascript/LeftAndMain.Menu.js
@@ -207,16 +207,16 @@
207 207
 			onclick: function(e) {
208 208
 				// Only catch left clicks, in order to allow opening in tabs.
209 209
 				// Ignore external links, fallback to standard link behaviour
210  
-				if(e.which > 1 || this.is(':external')) return;
  210
+				var isExternal = $.path.isExternal(this.attr('href'));
  211
+				if(e.which > 1 || isExternal) return;
211 212
 				e.preventDefault();
212 213
 
213 214
 				var item = this.getMenuItem();
214 215
 
215 216
 				var url = this.attr('href');
216  
-				if(this.is(':internal')) url = $('base').attr('href') + url;
  217
+				if(!isExternal) url = $('base').attr('href') + url;
217 218
 				
218 219
 				var children = item.find('li');
219  
-
220 220
 				if(children.length) {
221 221
 					children.first().find('a').click();
222 222
 				} else {
@@ -261,8 +261,4 @@
261 261
 		});
262 262
 		
263 263
 	});
264  
-
265  
-	// Internal Helper
266  
-	$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
267  
-	$.expr[':'].external = function(obj){return !$(obj).is(':internal');};
268 264
 }(jQuery));
4  admin/javascript/lib.js
@@ -232,8 +232,4 @@
232 232
 	};
233 233
 	
234 234
 	$.path = path;
235  
-
236  
-	// Internal Helper
237  
-	$.expr[':'].internal = function(obj){return obj.href.match(/^mailto\:/) || (obj.hostname == location.hostname);};
238  
-	$.expr[':'].external = function(obj){return !$(obj).is(':internal')};
239 235
 }(jQuery));

0 notes on commit c518a19

Please sign in to comment.
Something went wrong with that request. Please try again.