Re: xlink:href test case

Am 15.04.2010 um 16:51 schrieb Patrick Dengler:

> Test case for xlink:href; note the different behaviors across browsers
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> 	<head>
> 		<meta http-equiv="X-UA-Compatible" content="IE=9"/>
>
>             <script type="text/javascript">
>       <![CDATA[
>            function testUpdatesetAttrib()
>            {
>                var err = document.getElementById("err");
>                err.setAttribute("xlink:href", "ie7_logo.png" );
>
>            }
>            function testUpdatesetAttribNS()
>            {
>                var err = document.getElementById("err");
>                err.setAttributeNS("xlink","href", "ie7_logo.png" );


Hi Patrick,

I did not try your testcase, but the setAttributeNS statement is not  
correct,
According to http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-ElSetAttrNS 
,
the first argument is the namespaceURI which is http://www.w3.org/1999/xlink 
" for XLink.
The second argument should be the qualifiedName, which is "xlink:href"  
for this attribute.

So you might want to try:
err.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href",  
"ie7_logo.png");

Another issue is that you're defining the id="err" element twice, is  
that intentional??
What's the exact issue? Or you referring to the fact, that your "wrong  
example" actually works in some browsers?

Have a nice day,
Niko

Received on Friday, 16 April 2010 07:28:31 UTC