| Index: src/com/dom_distiller/client/ContentExtractor.java
|
| diff --git a/src/com/dom_distiller/client/ContentExtractor.java b/src/com/dom_distiller/client/ContentExtractor.java
|
| index 0598bc6f272138141076156ec87122a3f2b8511f..18e954c6c7ce47db6dfbc717b33a49bb1aae180f 100644
|
| --- a/src/com/dom_distiller/client/ContentExtractor.java
|
| +++ b/src/com/dom_distiller/client/ContentExtractor.java
|
| @@ -7,7 +7,6 @@ package com.dom_distiller.client;
|
| import com.google.gwt.dom.client.AnchorElement;
|
| import com.google.gwt.dom.client.Document;
|
| import com.google.gwt.dom.client.Element;
|
| -import com.google.gwt.dom.client.ImageElement;
|
| import com.google.gwt.dom.client.Node;
|
| import com.google.gwt.dom.client.NodeList;
|
|
|
| @@ -73,8 +72,8 @@ public class ContentExtractor implements Exportable {
|
| }
|
|
|
| // The base URL in the distilled page viewer is different from that in
|
| - // the live page. This breaks all relative links (in anchors and
|
| - // images), so make them absolute in the distilled content.
|
| + // the live page. This breaks all relative links (in anchors,
|
| + // images, etc.), so make them absolute in the distilled content.
|
| makeAllLinksAbsolute(clonedSubtree);
|
|
|
| // TODO(cjhopman): this discards the top element and just returns its children. This might
|
| @@ -106,11 +105,13 @@ public class ContentExtractor implements Exportable {
|
| AnchorElement link = AnchorElement.as(allLinks.getItem(i));
|
| link.setHref(link.getHref());
|
| }
|
| + makeAllSrcAttributesAbsolute(root);
|
| + }
|
|
|
| - NodeList<Element> allImages = root.getElementsByTagName("IMG");
|
| - for (int i = 0; i < allImages.getLength(); i++) {
|
| - ImageElement image = ImageElement.as(allImages.getItem(i));
|
| - image.setSrc(image.getSrc());
|
| + private static native void makeAllSrcAttributesAbsolute(Element root) /*-{
|
| + var elementsWithSrc = root.querySelectorAll('img,source,track,video');
|
| + for (var key in elementsWithSrc) {
|
| + elementsWithSrc[key].src = elementsWithSrc[key].src;
|
| }
|
| - }
|
| + }-*/;
|
| }
|
|
|