Changeset 18575 for lang/javascript
- Timestamp:
- 09/01/08 14:07:14 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/javascript-xpath/trunk/test/misc/ejohn_s_selectors_api_test.html
r18567 r18575 225 225 <script> 226 226 window.onload = function(){ 227 // for IE 228 if (!('DOMException' in window)) { 229 window.DOMException = { 230 SYNTAX_ERR: 12, 231 NAMESPACE_ERR: 14 232 }; 233 } 234 227 235 document.getElementById("toggle").onclick = function(){ 228 236 document.documentElement.className = this.checked ? "unitTest nopass" : "unitTest"; … … 239 247 var cache = {}; 240 248 241 var css = document.getElementById("test"). firstChild.nodeValue.split("\n");249 var css = document.getElementById("test").innerHTML.split("\n"); 242 250 for ( var i = 0; i < css.length; i++ ) { 243 251 css[i] = css[i].replace(/\/\*.*?\*\//g, "") … … 245 253 } 246 254 247 var ecss = document.getElementById("error"). firstChild.nodeValue.split("\n");255 var ecss = document.getElementById("error").innerHTML.split("\n"); 248 256 for ( var i = 0; i < ecss.length; i++ ) { 249 257 ecss[i] = ecss[i].replace(/\/\*.*?\*\//g, "") … … 435 443 436 444 function check( type, root, expect, fragment ){ 445 446 (function(div) { 447 448 if (div.nodeType == 1) { 449 if ( (div.getAttribute("class") || "").toString().indexOf("unitTest") > -1 && 450 (!fragment || div.getAttribute("id") !== "nofragment") ) { 451 //var bg = div.style.backgroundColor; 452 var win = document.defaultView || document.parentWindow; 453 try { 454 var view = win.getComputedStyle(div, null); 455 } 456 catch(e) { 457 view = div.currentStyle; 458 } 459 try { 460 var bg = view.getPropertyValue("background-color") || div.style.backgroundColor; 461 } 462 catch(e) { 463 var bg = view.backgroundColor || div.style.backgroundColor; 464 } 465 466 var pass = bg && bg.indexOf("(255, 0, 0") == -1 && bg.indexOf("#ff0000") == -1 && bg.indexOf("red") == -1; 467 //var pass = bg && bg.indexOf("(255, 0, 0") == -1 && bg.indexOf("#ff0000") == -1; 468 assert(pass === expect, type + ": " + (div.title || div.parentNode.title)); 469 } 470 } 471 472 for (var child = div.firstChild; child; child = child.nextSibling) arguments.callee(child); 473 })(root); 474 /* 437 475 var walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT, { acceptNode: function(){ return 1; } }, false ); 438 476 … … 450 488 } 451 489 } 490 */ 452 491 } 453 492 … … 463 502 function query(q, resolver){ 464 503 try { 465 return root[select](q, resolver); 504 if (resolver === void(0)) { 505 return root[select](q); 506 } 507 else { 508 return root[select](q, resolver); 509 } 466 510 } catch(e){ 511 if (e.number == -2147467259) { 512 return [] 513 } 467 514 if ( e.message.indexOf("ERR") > -1 || e.code == DOMException.NAMESPACE_ERR || 468 515 e.code == DOMException.SYNTAX_ERR)
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)