[PATCH v3 2/3] mshtml: Implement inline attributes parsing for createElement.
Jacek Caban
jacek at codeweavers.com
Fri Nov 5 09:11:20 CDT 2021
On 11/4/21 3:10 PM, Gabriel Ivăncescu wrote:
> + /* Create a temporary html element and parse it there */
> + nsAString_InitDepend(&str, L"HTML");
> + nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &str, (nsIDOMElement**)&nshtml);
> + nsAString_Finish(&str);
> + if(NS_FAILED(nsres))
> + return map_nsresult(nsres);
> +
> + if(name_len == 4 && !wcsnicmp(tag + 1, L"HTML", 4)) {
> + FIXME("Returning <html> element with no attributes\n");
> +*ret = (nsIDOMElement*)nshtml;
> + return S_OK;
> + }
Did you try using <template> element instead of <html>? I'd expect it do
do the right thing, but I didn't try.
> +
> + nsAString_InitDepend(&str, tag);
> + nsres = nsIDOMHTMLElement_SetInnerHTML(nshtml, &str);
> + nsAString_Finish(&str);
> + if(NS_FAILED(nsres)) {
> + hres = map_nsresult(nsres);
> + goto fail;
> + }
> +
> + /* Get the element and remove it from the temporary */
> + if(!(p = heap_alloc((name_len + 1) * sizeof(WCHAR))))
> + hres = E_OUTOFMEMORY;
> + else {
> + memcpy(p, tag + 1, name_len * sizeof(WCHAR));
> + p[name_len] = '\0';
> + nsAString_InitDepend(&str, p);
> + nsres = nsIDOMHTMLElement_GetElementsByTagName(nshtml, &str, &nscol);
> + nsAString_Finish(&str);
> + heap_free(p);
> + if(NS_FAILED(nsres))
> + goto fail;
That's making things more complicated that they need to be. You could
just use firstElementChild or something similar.
Thanks,
Jacek
More information about the wine-devel
mailing list