Code Duplication    Length = 38-38 lines in 2 locations

api/js/etemplate/test/jquery.js 1 location

@@ 4903-4940 (lines=38) @@
4900
4901
// Check to see if the browser returns elements by name when
4902
// querying by getElementById (and provide a workaround)
4903
(function(){
4904
	// We're going to inject a fake input element with a specified name
4905
	var form = document.createElement("div"),
4906
		id = "script" + (new Date()).getTime(),
4907
		root = document.documentElement;
4908
4909
	form.innerHTML = "<a name='" + id + "'/>";
4910
4911
	// Inject it into the root element, check its status, and remove it quickly
4912
	root.insertBefore( form, root.firstChild );
4913
4914
	// The workaround has to do additional checks after a getElementById
4915
	// Which slows things down for other browsers (hence the branching)
4916
	if ( document.getElementById( id ) ) {
4917
		Expr.find.ID = function( match, context, isXML ) {
4918
			if ( typeof context.getElementById !== "undefined" && !isXML ) {
4919
				var m = context.getElementById(match[1]);
4920
4921
				return m ?
4922
					m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
4923
						[m] :
4924
						undefined :
4925
					[];
4926
			}
4927
		};
4928
4929
		Expr.filter.ID = function( elem, match ) {
4930
			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4931
4932
			return elem.nodeType === 1 && node && node.nodeValue === match;
4933
		};
4934
	}
4935
4936
	root.removeChild( form );
4937
4938
	// release memory in IE
4939
	root = form = null;
4940
})();
4941
4942
(function(){
4943
	// Check to see if the browser returns only elements

api/js/egw_action/test/js/jquery.js 1 location

@@ 4259-4296 (lines=38) @@
4256
4257
// Check to see if the browser returns elements by name when
4258
// querying by getElementById (and provide a workaround)
4259
(function(){
4260
	// We're going to inject a fake input element with a specified name
4261
	var form = document.createElement("div"),
4262
		id = "script" + (new Date()).getTime(),
4263
		root = document.documentElement;
4264
4265
	form.innerHTML = "<a name='" + id + "'/>";
4266
4267
	// Inject it into the root element, check its status, and remove it quickly
4268
	root.insertBefore( form, root.firstChild );
4269
4270
	// The workaround has to do additional checks after a getElementById
4271
	// Which slows things down for other browsers (hence the branching)
4272
	if ( document.getElementById( id ) ) {
4273
		Expr.find.ID = function( match, context, isXML ) {
4274
			if ( typeof context.getElementById !== "undefined" && !isXML ) {
4275
				var m = context.getElementById(match[1]);
4276
4277
				return m ?
4278
					m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
4279
						[m] :
4280
						undefined :
4281
					[];
4282
			}
4283
		};
4284
4285
		Expr.filter.ID = function( elem, match ) {
4286
			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
4287
4288
			return elem.nodeType === 1 && node && node.nodeValue === match;
4289
		};
4290
	}
4291
4292
	root.removeChild( form );
4293
4294
	// release memory in IE
4295
	root = form = null;
4296
})();
4297
4298
(function(){
4299
	// Check to see if the browser returns only elements