[webkit-dev] xmlns attribute

David Hyatt hyatt at apple.com
Fri Sep 1 20:14:21 PDT 2006


On Sep 1, 2006, at 6:50 PM, Rob Burns wrote:

> Hello all,
>
> I think I've encountered a few bugs, but wanted to post  here  
> before I submit them to make sure I'm not doing something wrong.
>
> First, when I use "getAttribute:xmlns:SomePrefix" on a DOMElement  
> it returns NUL even though this attribute is set on the root  
> element and is still valid for the current scope. I thought this  
> attribute was inherited and therefore should work on any sub- 
> element in the hierarchy (scope). If that's not the proper way to  
> get the namespaceURI for a namespacePrefix, is there another method  
> for that?
>

getAttribute is just about explicit attribute declarations in the  
DOM, so no, this should not work on any sub-element in a hierarchy.   
To get the namespace URI on your element you can just say

myElement.namespaceURI

This value will reflect the actual computed namespace URI for that  
element.

> Second, when calling className method on a DOMElement I'm getting  
> the class description for the instance rather than the class  
> attribute. My sense  was that the "className" was created to avoid  
> collisions with "class" Shouldn't "className" return the "class"  
> attribute while "class" instance method returns the instances  
> class? Do I have these backwards?
>

className (meaning the value of the class attribute) is only defined  
on HTML elements.  I am guessing that your elements are not HTML.

dave
(hyatt at apple.com)





More information about the webkit-dev mailing list