Extract hint tags from <input placeholder="text">

This is useful for very many input fields, especially prominent on
GitHub itself.
This commit is contained in:
Niklas Haas 2016-08-08 17:28:13 +02:00
parent 58fb41ab9d
commit cf26201e86

View File

@ -1021,6 +1021,7 @@ class WordHinter:
"alt": lambda elem: elem["alt"],
"name": lambda elem: elem["name"],
"title": lambda elem: elem["title"],
"placeholder": lambda elem: elem["placeholder"],
"src": lambda elem: elem["src"].split('/')[-1],
"href": lambda elem: elem["href"].split('/')[-1],
"text": str,
@ -1029,7 +1030,7 @@ class WordHinter:
extractable_attrs = collections.defaultdict(list, {
"img": ["alt", "title", "src"],
"a": ["title", "href", "text"],
"input": ["name"]
"input": ["name", "placeholder"]
})
return (attr_extractors[attr](elem)