[webkit-help] difficulties creating a new Element attribute

Julien Chaffraix julien.chaffraix at gmail.com
Tue Aug 24 08:06:03 PDT 2010


Hi,

> Take a look at this overload which doesn't require qualified name:
>
> void Element::setAttribute(const AtomicString& name, const AtomicString&
> value, ExceptionCode&);
>
> Qualified name has something to do with XML/XHTML, I believe.

It is indeed from the XML world [1]. HTML does not use prefixes or
namespaces (note that all HTML elements are in the XHTML namespace
[2]).
The namespace has the same function as in C++ (namely provide some
scope for the names so that you can redefine the name). The prefix is
used to determine the namespace: for example, xml:lang tells you that
'lang' is in the 'xml' namespace (you have to define the prefix so
that the XML parser knows which namespace it refers to).

> Don't know if
> you are allowed to come up with your own "my_something" attributes in HTML,
> but you may give it a try.

You are authorized to create your own elements / attributes in HTML.
The engine will just don't know how to handle them and you will end up
with a generic element and the engine will not do any special
treatment on them.

Regards,
Julien

[1] http://www.w3.org/TR/REC-xml-names/#ns-qualnames
[2] http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#namespaces


More information about the webkit-help mailing list