mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
HTML attributes handling:
- SAX.c: HTML attributes need normalization too (Bjorn Reese) - HTMLparser.[ch]: addded htmlIsScriptAttribute() Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Sun Oct 15 16:21:27 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* SAX.c: HTML attributes need normalization too (Bjorn Reese)
|
||||||
|
* HTMLparser.[ch]: addded htmlIsScriptAttribute()
|
||||||
|
|
||||||
Sun Oct 15 13:18:36 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
Sun Oct 15 13:18:36 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* doc/*: rebuilt docs preparing for 2.2.5 release, added URI
|
* doc/*: rebuilt docs preparing for 2.2.5 release, added URI
|
||||||
|
55
HTMLparser.c
55
HTMLparser.c
@ -559,6 +559,33 @@ static char *htmlNoContentElements[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list of HTML attributes which are of content %Script;
|
||||||
|
* NOTE: when adding ones, check htmlIsScriptAttribute() since
|
||||||
|
* it assumes the name starts with 'on'
|
||||||
|
*/
|
||||||
|
static char *htmlScriptAttributes[] = {
|
||||||
|
"onclick",
|
||||||
|
"ondblclick",
|
||||||
|
"onmousedown",
|
||||||
|
"onmouseup",
|
||||||
|
"onmouseover",
|
||||||
|
"onmousemove",
|
||||||
|
"onmouseout",
|
||||||
|
"onkeypress",
|
||||||
|
"onkeydown",
|
||||||
|
"onkeyup",
|
||||||
|
"onload",
|
||||||
|
"onunload",
|
||||||
|
"onfocus",
|
||||||
|
"onblur",
|
||||||
|
"onsubmit",
|
||||||
|
"onrest",
|
||||||
|
"onchange",
|
||||||
|
"onselect"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static char** htmlStartCloseIndex[100];
|
static char** htmlStartCloseIndex[100];
|
||||||
static int htmlStartCloseIndexinitialized = 0;
|
static int htmlStartCloseIndexinitialized = 0;
|
||||||
|
|
||||||
@ -896,6 +923,34 @@ htmlCheckParagraph(htmlParserCtxtPtr ctxt) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* htmlIsScriptAttribute:
|
||||||
|
* @name: an attribute name
|
||||||
|
*
|
||||||
|
* Check if an attribute is of content type Script
|
||||||
|
*
|
||||||
|
* Returns 1 is the attribute is a script 0 otherwise
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
htmlIsScriptAttribute(const xmlChar *name) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
return(0);
|
||||||
|
/*
|
||||||
|
* all script attributes start with 'on'
|
||||||
|
*/
|
||||||
|
if ((name[0] != 'o') || (name[1] != 'n'))
|
||||||
|
return(0);
|
||||||
|
for (i = 0;
|
||||||
|
i < sizeof(htmlScriptAttributes)/sizeof(htmlScriptAttributes[0]);
|
||||||
|
i++) {
|
||||||
|
if (xmlStrEqual(name, (const xmlChar *) htmlScriptAttributes[i]))
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* The list of HTML predefined entities *
|
* The list of HTML predefined entities *
|
||||||
|
@ -90,6 +90,7 @@ int htmlEncodeEntities(unsigned char* out,
|
|||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char* in,
|
||||||
int *inlen, int quoteChar);
|
int *inlen, int quoteChar);
|
||||||
|
int htmlIsScriptAttribute(const xmlChar *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaces for the Push mode
|
* Interfaces for the Push mode
|
||||||
|
11
SAX.c
11
SAX.c
@ -740,13 +740,12 @@ attribute(void *ctx, const xmlChar *fullname, const xmlChar *value)
|
|||||||
name = xmlSplitQName(ctxt, fullname, &ns);
|
name = xmlSplitQName(ctxt, fullname, &ns);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the last stave of the attribute normalization
|
* Do the last stage of the attribute normalization
|
||||||
|
* Needed for HTML too:
|
||||||
|
* http://www.w3.org/TR/html4/types.html#h-6.2
|
||||||
*/
|
*/
|
||||||
if (ctxt->html)
|
nval = xmlValidNormalizeAttributeValue(ctxt->myDoc, ctxt->node,
|
||||||
nval = NULL;
|
fullname, value);
|
||||||
else
|
|
||||||
nval = xmlValidNormalizeAttributeValue(ctxt->myDoc,
|
|
||||||
ctxt->node, fullname, value);
|
|
||||||
if (nval != NULL)
|
if (nval != NULL)
|
||||||
value = nval;
|
value = nval;
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ int htmlEncodeEntities(unsigned char* out,
|
|||||||
int *outlen,
|
int *outlen,
|
||||||
const unsigned char* in,
|
const unsigned char* in,
|
||||||
int *inlen, int quoteChar);
|
int *inlen, int quoteChar);
|
||||||
|
int htmlIsScriptAttribute(const xmlChar *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaces for the Push mode
|
* Interfaces for the Push mode
|
||||||
|
Reference in New Issue
Block a user