Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Unified Diff: java/org/chromium/distiller/extractors/embeds/ImageExtractor.java

Issue 2670643006: Skip non-text elements in <a> without href in <figcaption> (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/EmbedExtractorTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: java/org/chromium/distiller/extractors/embeds/ImageExtractor.java
diff --git a/java/org/chromium/distiller/extractors/embeds/ImageExtractor.java b/java/org/chromium/distiller/extractors/embeds/ImageExtractor.java
index 37a8d329ecb56b951ec3b3183165150c508ddb7e..b1d6e5b5a08a2f3868c7210a5a8365e8542c4101 100644
--- a/java/org/chromium/distiller/extractors/embeds/ImageExtractor.java
+++ b/java/org/chromium/distiller/extractors/embeds/ImageExtractor.java
@@ -66,7 +66,8 @@ public class ImageExtractor implements EmbedExtractor {
// elements into <figcaption>. For example: image credit
// could contain a link. So we get the whole DOM structure within
// <figcaption> only when it contains links, otherwise we get the innerText.
- figcaption = DomUtil.getFirstElementByTagName(cap, "A") != null ?
+ NodeList<Element> links = DomUtil.querySelectorAll(cap, "A[HREF]");
+ figcaption = links.getLength() > 0 ?
cap : createFigcaptionElement(cap);
} else {
figcaption = createFigcaptionElement(e);
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/EmbedExtractorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698