diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-11-08 12:46:04 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-11-08 12:46:04 +0300 |
commit | ae9e910b57e7ed0403793bdf51270385d79564fc (patch) | |
tree | b6d8030533a4ba8403203ec97bb8af6d0219ce01 /web | |
parent | 9cf5fc9bf5df03ccd5c8fd35d4725e680a0702d2 (diff) |
2005-11-08 Atsushi Enomoto <atsushi@ximian.com>
* cormissing.js : make it work w/ indented HTML sources.
svn path=/trunk/mono/; revision=52687
Diffstat (limited to 'web')
-rw-r--r-- | web/web/deploy/cm/cormissing.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/web/web/deploy/cm/cormissing.js b/web/web/deploy/cm/cormissing.js index 51b743987e7..ad1f5009ff8 100644 --- a/web/web/deploy/cm/cormissing.js +++ b/web/web/deploy/cm/cormissing.js @@ -3,7 +3,7 @@ function toggle (elt) if (elt == null) return; - var eltLink = elt.firstChild; + var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); @@ -22,7 +22,7 @@ function toggle (elt) function setView (elt, fView) { - var eltLink = elt.firstChild; + var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); @@ -39,6 +39,17 @@ function setView (elt, fView) } } +function firstElement (elt) +{ + var c = elt.firstChild; + while (c != null) { + if (c.nodeType == 1) // Node.ELEMENT_NODE (IE6 does not recognize it) + return c; + c = c.nextSibling; + } + return null; +} + function trimSrc (strSrc) { return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.')); @@ -48,7 +59,7 @@ function getChildrenByTagName (elt, strTag) { strTag = strTag.toLowerCase (); var rgChildren = new Array (); - var eltChild = elt.firstChild; + var eltChild = firstElement (elt); while (eltChild) { if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag) @@ -86,7 +97,7 @@ function viewAll (elt, dictTypes) function getView (elt) { - var eltLink = elt.firstChild; + var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); @@ -121,7 +132,7 @@ function getName (elt) if (span.innerText) return span.innerText; else - return span.firstChild.nodeValue; + return firstElement (elt).nodeValue; } } return null; |