Using fall back text content for old Mozilla. Desk check by jgw. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3704 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/dom/client/DOMImplMozillaOld.java b/user/src/com/google/gwt/dom/client/DOMImplMozillaOld.java index 9aa5960..b4e375b 100644 --- a/user/src/com/google/gwt/dom/client/DOMImplMozillaOld.java +++ b/user/src/com/google/gwt/dom/client/DOMImplMozillaOld.java
@@ -63,4 +63,34 @@ return top + @com.google.gwt.user.client.impl.DocumentRootImpl::documentRoot.scrollTop; }-*/; + + @Override + public native String getInnerText(Element node) /*-{ + // To mimic IE's 'innerText' property in the W3C DOM, we need to recursively + // concatenate all child text nodes (depth first). + var text = '', child = node.firstChild; + while (child) { + // 1 == Element node + if (child.nodeType == 1) { + text += this.@com.google.gwt.dom.client.DOMImpl::getInnerText(Lcom/google/gwt/dom/client/Element;)(child); + } else if (child.nodeValue) { + text += child.nodeValue; + } + child = child.nextSibling; + } + return text; + }-*/; + + @Override + public native void setInnerText(Element elem, String text) /*-{ + // Remove all children first. + while (elem.firstChild) { + elem.removeChild(elem.firstChild); + } + // Add a new text node. + if (text != null) { + elem.appendChild($doc.createTextNode(text)); + } + }-*/; + }