PageRenderTime 21ms CodeModel.GetById 7ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/testing/selenium-core/lib/cssQuery/src/cssQuery-standard.js

http://datanucleus-appengine.googlecode.com/
JavaScript | 53 lines | 31 code | 9 blank | 13 comment | 10 complexity | 7c4344381aa799ed118f8e4b84c7da97 MD5 | raw file
 1/*
 2	cssQuery, version 2.0.2 (2005-08-19)
 3	Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
 4	License: http://creativecommons.org/licenses/LGPL/2.1/
 5*/
 6
 7cssQuery.addModule("css-standard", function() { // override IE optimisation
 8
 9// cssQuery was originally written as the CSS engine for IE7. It is
10//  optimised (in terms of size not speed) for IE so this module is
11//  provided separately to provide cross-browser support.
12
13// -----------------------------------------------------------------------
14// browser compatibility
15// -----------------------------------------------------------------------
16
17// sniff for Win32 Explorer
18isMSIE = eval("false;/*@cc_on@if(@\x5fwin32)isMSIE=true@end@*/");
19
20if (!isMSIE) {
21	getElementsByTagName = function($element, $tagName, $namespace) {
22		return $namespace ? $element.getElementsByTagNameNS("*", $tagName) :
23			$element.getElementsByTagName($tagName);
24	};
25
26	compareNamespace = function($element, $namespace) {
27		return !$namespace || ($namespace == "*") || ($element.prefix == $namespace);
28	};
29
30	isXML = document.contentType ? function($element) {
31		return /xml/i.test(getDocument($element).contentType);
32	} : function($element) {
33		return getDocument($element).documentElement.tagName != "HTML";
34	};
35
36	getTextContent = function($element) {
37		// mozilla || opera || other
38		return $element.textContent || $element.innerText || _getTextContent($element);
39	};
40
41	function _getTextContent($element) {
42		var $textContent = "", $node, i;
43		for (i = 0; ($node = $element.childNodes[i]); i++) {
44			switch ($node.nodeType) {
45				case 11: // document fragment
46				case 1: $textContent += _getTextContent($node); break;
47				case 3: $textContent += $node.nodeValue; break;
48			}
49		}
50		return $textContent;
51	};
52}
53}); // addModule