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? 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? Best Wishes, Rob
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@apple.com)
On Sep 1, 2006, at 10:14 PM, David Hyatt wrote:
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.
The method Is was looking for in this earlier query were "lookupNamespaceURI" and "lookupPrefix". They're both DOM level 3 methods, but they weren't documented in the headers yet. I was wondering how to use namespaces sufficiently without a such a method. j Best wishes, Rob
participants (2)
-
David Hyatt
-
Rob Burns