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

Side by Side Diff: src/com/dom_distiller/client/SchemaOrgParser.java

Issue 449923002: gwt getInnerText -> javascript innerText or textContent (Closed) Base URL: https://code.google.com/p/dom-distiller/@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package com.dom_distiller.client; 5 package com.dom_distiller.client;
6 6
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.HashMap; 8 import java.util.HashMap;
9 import java.util.List; 9 import java.util.List;
10 import java.util.Map; 10 import java.util.Map;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 437 }
438 438
439 // Extracts the property value from |e|. For some tags, the value is a spec ific attribute, 439 // Extracts the property value from |e|. For some tags, the value is a spec ific attribute,
440 // while for others, it's the text between the start and end tags. 440 // while for others, it's the text between the start and end tags.
441 private static String getPropertyValue(Element e) { 441 private static String getPropertyValue(Element e) {
442 String value = ""; 442 String value = "";
443 String tagName = e.getTagName(); 443 String tagName = e.getTagName();
444 if (sTagAttributeMap.containsKey(tagName)) { 444 if (sTagAttributeMap.containsKey(tagName)) {
445 value = e.getAttribute(sTagAttributeMap.get(tagName)); 445 value = e.getAttribute(sTagAttributeMap.get(tagName));
446 } 446 }
447 if (value.isEmpty()) value = e.getInnerText(); 447 // Use javascript textContent (instead of javascript innerText) to inclu de invisible text.
448 if (value.isEmpty()) value = DomUtil.javascriptTextContent(e);
448 return value; 449 return value;
449 } 450 }
450 451
451 // Extracts the author property from the "rel=author" attribute of an anchor or a link element. 452 // Extracts the author property from the "rel=author" attribute of an anchor or a link element.
452 private static String getAuthorFromRelAttribute(Element e) { 453 private static String getAuthorFromRelAttribute(Element e) {
453 String author = ""; 454 String author = "";
454 String tagName = e.getTagName(); 455 String tagName = e.getTagName();
455 if ((tagName.equalsIgnoreCase("A") || tagName.equalsIgnoreCase("LINK")) && 456 if ((tagName.equalsIgnoreCase("A") || tagName.equalsIgnoreCase("LINK")) &&
456 e.getAttribute("REL").equalsIgnoreCase(AUTHOR_REL)) { 457 e.getAttribute("REL").equalsIgnoreCase(AUTHOR_REL)) {
457 author = e.getInnerText(); 458 // Use javascript textContent (instead of javascript innerText) to i nclude invisible
459 // text.
460 author = DomUtil.javascriptTextContent(e);
458 } 461 }
459 return author; 462 return author;
460 } 463 }
461 464
462 private static String concat(String first, String second) { 465 private static String concat(String first, String second) {
463 String concat = first; 466 String concat = first;
464 if (!concat.isEmpty() && !second.isEmpty()) concat += " "; 467 if (!concat.isEmpty() && !second.isEmpty()) concat += " ";
465 concat += second; 468 concat += second;
466 return concat; 469 return concat;
467 } 470 }
468 } 471 }
OLDNEW
« no previous file with comments | « src/com/dom_distiller/client/PagingLinksFinder.java ('k') | test/com/dom_distiller/client/ContentExtractorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698