Skip to content

Commit

Permalink
Adds support for contenteditable attribute as input mode trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
j1r1k committed Aug 22, 2015
1 parent 98f8e56 commit 764b8f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@ gboolean dom_focus_input(Document *doc)
gboolean dom_is_editable(Element *element)
{
gboolean result = false;
char *tagname, *type;
char *tagname, *type, *editable;

if (!element) {
return result;
}

tagname = webkit_dom_element_get_tag_name(element);
type = webkit_dom_element_get_attribute(element, "type");
tagname = webkit_dom_element_get_tag_name(element);
type = webkit_dom_element_get_attribute(element, "type");
editable = webkit_dom_element_get_attribute(element, "contenteditable");
/* element is editable if it's a text area or input with no type, text or
* pasword */
if (!g_ascii_strcasecmp(tagname, "textarea")) {
Expand All @@ -201,11 +202,14 @@ gboolean dom_is_editable(Element *element)
|| !g_ascii_strcasecmp(type, "week"))
) {
result = true;
} else if (!g_ascii_strcasecmp(editable, "true")) {
result = true;
} else {
result = false;
}
g_free(tagname);
g_free(type);
g_free(editable);

return result;
}
Expand Down

0 comments on commit 764b8f1

Please sign in to comment.