[patch] working out namespaces/css issues (was xml+css borken in head)

David Faure dfaure at klaralvdalens-datakonsult.se
Sun Oct 26 00:49:06 BST 2003


On Saturday 25 October 2003 20:07, Germain Garand wrote:
> Le Samedi 25 Octobre 2003 17:49, David Faure a écrit :
> @@ -1618,27 +1623,27 @@ NodeImpl::Id DocumentImpl::getId( NodeIm
>      NodeImpl::Id id = 0;
>      QConstString n(_name->s, _name->l);
>      bool cs = true; // case sensitive
> -    if (_type != NodeImpl::NamespaceId) {
> +    // Do those hacks only for attributes. Keep everything clean for 
> elements,
> +    // it's all handled in createElement*
> +    if (_type == NodeImpl::AttributeId) {
>          // Each document maintains a mapping of tag name -> id for every tag 
> name encountered
>          // in the document.
>          cs = (htmlMode() == XHtml);
>          // First see if it's a HTML element name
> 
> 
> mmhh... I see one problem here though : you are skipping the lookup in the 
> standard tag hash for elements...
Yes because it breaks createElementNS( xhtml, "InPuT" ) in an html-compat doc,
since it will use the case-insensitive lookup, given that htmlMode()==html-compat.

So if you need those "hacks" to be done in getId, I think we need a bool so that
createElementNS can say "I know what I'm doing, don't use the htmlMode() do to hacks".

But a cleaner solution would be to split up the method IMHO.
We need a clean one (i.e. the current one without the contents of that if())
and a new method which only does the html-mode-dependent lookup in the
standard html tags table, and then calls the other one if it didn't find anything).
I was wondering if this was also needed during normal parsing, but apparently
it's not (?).

> yet the css parser does a getId lookup for  
> each new element and thus will fail to identify standard tags.
> Should it first do a getTagName, then a getId? (i.e. do you think getId should 
> only lookup for non-preregistered elements?)
You mean getTagID then getId? That's effectively what my above rambling might mean,
indeed :) But I think it'd be better to have that "do it all" method in DocumentImpl too. 

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions




More information about the kfm-devel mailing list