mirror of
https://github.com/lexborisov/Modest
synced 2024-11-22 05:41:32 +03:00
Sync myhtml module
This commit is contained in:
parent
140a41a539
commit
fc1f5d7ce7
@ -1315,6 +1315,16 @@ myhtml_node_tag_id(myhtml_tree_node_t *node);
|
||||
bool
|
||||
myhtml_node_is_close_self(myhtml_tree_node_t *node);
|
||||
|
||||
/**
|
||||
* Node is a void element?
|
||||
*
|
||||
* @param[in] myhtml_tree_node_t*
|
||||
*
|
||||
* @return true or false (1 or 0)
|
||||
*/
|
||||
bool
|
||||
myhtml_node_is_void_element(myhtml_tree_node_t *node);
|
||||
|
||||
/**
|
||||
* Get first attribute of a node
|
||||
*
|
||||
|
@ -173,6 +173,7 @@ myhtml_tag_id_t myhtml_node_tag_id(myhtml_tree_node_t *node);
|
||||
const char * myhtml_tag_name_by_id(myhtml_tree_t* tree, myhtml_tag_id_t tag_id, size_t *length);
|
||||
myhtml_tag_id_t myhtml_tag_id_by_name(myhtml_tree_t* tree, const char *tag_name, size_t length);
|
||||
bool myhtml_node_is_close_self(myhtml_tree_node_t *node);
|
||||
bool myhtml_node_is_void_element(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_first(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_last(myhtml_tree_node_t *node);
|
||||
const char * myhtml_node_text(myhtml_tree_node_t *node, size_t *length);
|
||||
|
@ -1315,6 +1315,16 @@ myhtml_node_tag_id(myhtml_tree_node_t *node);
|
||||
bool
|
||||
myhtml_node_is_close_self(myhtml_tree_node_t *node);
|
||||
|
||||
/**
|
||||
* Node is a void element?
|
||||
*
|
||||
* @param[in] myhtml_tree_node_t*
|
||||
*
|
||||
* @return true or false (1 or 0)
|
||||
*/
|
||||
bool
|
||||
myhtml_node_is_void_element(myhtml_tree_node_t *node);
|
||||
|
||||
/**
|
||||
* Get first attribute of a node
|
||||
*
|
||||
|
@ -757,6 +757,37 @@ bool myhtml_node_is_close_self(myhtml_tree_node_t *node)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool myhtml_node_is_void_element(myhtml_tree_node_t *node)
|
||||
{
|
||||
// http://w3c.github.io/html-reference/syntax.html#void-elements
|
||||
switch (node->tag_id)
|
||||
{
|
||||
case MyHTML_TAG_AREA:
|
||||
case MyHTML_TAG_BASE:
|
||||
case MyHTML_TAG_BR:
|
||||
case MyHTML_TAG_COL:
|
||||
case MyHTML_TAG_COMMAND:
|
||||
case MyHTML_TAG_EMBED:
|
||||
case MyHTML_TAG_HR:
|
||||
case MyHTML_TAG_IMG:
|
||||
case MyHTML_TAG_INPUT:
|
||||
case MyHTML_TAG_KEYGEN:
|
||||
case MyHTML_TAG_LINK:
|
||||
case MyHTML_TAG_META:
|
||||
case MyHTML_TAG_PARAM:
|
||||
case MyHTML_TAG_SOURCE:
|
||||
case MyHTML_TAG_TRACK:
|
||||
case MyHTML_TAG_WBR:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_first(myhtml_tree_node_t *node)
|
||||
{
|
||||
if(node->token)
|
||||
|
@ -173,6 +173,7 @@ myhtml_tag_id_t myhtml_node_tag_id(myhtml_tree_node_t *node);
|
||||
const char * myhtml_tag_name_by_id(myhtml_tree_t* tree, myhtml_tag_id_t tag_id, size_t *length);
|
||||
myhtml_tag_id_t myhtml_tag_id_by_name(myhtml_tree_t* tree, const char *tag_name, size_t length);
|
||||
bool myhtml_node_is_close_self(myhtml_tree_node_t *node);
|
||||
bool myhtml_node_is_void_element(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_first(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_last(myhtml_tree_node_t *node);
|
||||
const char * myhtml_node_text(myhtml_tree_node_t *node, size_t *length);
|
||||
|
Loading…
Reference in New Issue
Block a user