<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>7518</bug_id>
          
          <creation_ts>2006-02-28 13:44:38 -0800</creation_ts>
          <short_desc>attribute assignment not working in javascript</short_desc>
          <delta_ts>2006-11-26 04:15:42 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>416.x</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>7602</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="mitch gart">mitch.gart</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ian</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>34456</commentid>
    <comment_count>0</comment_count>
    <who name="mitch gart">mitch.gart</who>
    <bug_when>2006-02-28 13:44:38 -0800</bug_when>
    <thetext>In this code

            var link = document.createElement(&quot;a&quot;);
            link.name = link.innerHTML = childNodes[i].getAttribute(&quot;name&quot;);

childNodes[i].getAttribute(&quot;name&quot;) returns a string that contains a Euro
char (0x20ac).  What are the values of link.name and link.innerHTML after this
assignment?  Link.innerHTML contains the correct string, and link.name
doesn&apos;t.  The Euro has been replaced with a hex 80 character.

It has nothing to do with the double assignment or the order, it&apos;s just
that one attribute seems to accept the Euro and the other doesn&apos;t.

The code as written is fine in IE and Firefox but not Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34461</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-02-28 14:03:32 -0800</bug_when>
    <thetext>Reporter, could you please attach a complete test case? There are quite a few factors that could potentially affect the behavior and that we would have to guess about otherwise. In any case, thank you for reporting this!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34657</commentid>
    <comment_count>2</comment_count>
    <who name="mitch gart">mitch.gart</who>
    <bug_when>2006-03-01 11:07:37 -0800</bug_when>
    <thetext>There&apos;s a bug here somewhere but I wasn&apos;t able to get it to fail 
reliably for a simple case.  I can&apos;t put my finger on exactly what
the bug was.

     var link = document.createElement(&quot;a&quot;);
     link.name = link.innerHTML = childNodes[i].getAttribute(&quot;name&quot;);

fails, but

     var link = document.createElement(&quot;a&quot;);
     link.innerHTML = childNodes[i].getAttribute(&quot;name&quot;);
     link.name = link.innerHTML; 

works correctly.  I got the problem in my web application code fixed, 
and then spent a bunch of extra time trying to isolate the Safari bug, 
and couldn&apos;t.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34701</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-01 22:05:58 -0800</bug_when>
    <thetext>So, it had something to do with double assignment, after all? That&apos;s pretty weird...

Thank you for the time you spent on isolating the problem! If you can afford to spend some more time, could you please try the following?
1) Is the problem reproducible in recent nightly builds from &lt;http://nightly.webkit.org&gt;?
2) What is logged to the console if you insert the following snippet before and after the troublesome part:
console.log(escape(childNodes[i].getAttribute(&quot;name&quot;)));
console.log(escape(link.innerHTML));
console.log(escape(link.name));

The JavaScript console is accessible via Safari debug menu, I assume you already have it enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34725</commentid>
    <comment_count>4</comment_count>
    <who name="mitch gart">mitch.gart</who>
    <bug_when>2006-03-02 07:05:14 -0800</bug_when>
    <thetext>link.name = link.innerHTML = value2Html(childNodes[i].getAttribute(&quot;name&quot;));
console.log(&quot;attr: &quot; + escape(childNodes[i].getAttribute(&quot;name&quot;)));
console.log(&quot;innerHTML: &quot; + escape(link.innerHTML));
console.log(&quot;name: &quot; + escape(link.name));

prints

attr: Euro%80
innerHTML: Euro%U20AC
name: Euro%80

The value that I put in the attribute was Euro€ or Euro\u20AC

This is so weird.  It seems like the double assignment isn&apos;t quite working,
only I wrote a little stand-alone javascript program and double assignments
seem to work fine.  I can&apos;t make up a mental model of why this is failing.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34882</commentid>
    <comment_count>5</comment_count>
      <attachid>6813</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-02 13:12:09 -0800</bug_when>
    <thetext>Created attachment 6813
test case

This test case shows a result of double assignment being different from a result of two assignments. It also shows that WebKit handles \u0080 (Unicode code point &quot;nbsp control&quot;) in a pretty strange manner.

Assuming this is what happens in the real code, we have one more major mystery left - how this code point found its way into the name attribute. Please note that %80 means Euro in many encodings, including Latin-1.

Could it be that the real application specifies an encoding in HTTP headers or in an HTTP-Equiv meta, and your reduced tests don&apos;t? Maybe there is a mismatch between the actual and specified encodings?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34889</commentid>
    <comment_count>6</comment_count>
    <who name="mitch gart">mitch.gart</who>
    <bug_when>2006-03-02 13:58:24 -0800</bug_when>
    <thetext>I put the console.log lines (temporarily) into the real application,
not into a small test program.  So whatever encoding was in effect
for one line should have also been in effect for the other line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35883</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-11 03:35:09 -0800</bug_when>
    <thetext>Reporter, please note that the fix in bug 7602 will likely break your workaround - U+0080 will no longer be mistakenly converted to U+20AC during parsing (i.e. assigning to innerHTML).

You write that childNodes[i].getAttribute(&quot;name&quot;) contains %80, even after you put %U20AC there. This probably indicates that there is some other bug besides 7602, but I could not reproduce such behavior myself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44245</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-11-26 04:15:42 -0800</bug_when>
    <thetext>This report doesn&apos;t have enough information for further action to be taken, closing.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>6813</attachid>
            <date>2006-03-02 13:12:09 -0800</date>
            <delta_ts>2006-03-02 13:12:09 -0800</delta_ts>
            <desc>test case</desc>
            <filename>euro.html</filename>
            <type>text/html</type>
            <size>777</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9InRl
eHQvaHRtbDsgY2hhcnNldD11cy1hc2NpaSI+CjwvaGVhZD4KPGJvZHk+CjxzY3JpcHQ+CnZhciBs
aW5rID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiYSIpOwoKbGluay5uYW1lID0gbGluay5pbm5l
ckhUTUwgPSAiRXVyb1x1MDA4MCI7CmRvY3VtZW50LndyaXRlKCI8cD5pbm5lckhUTUw6ICIgKyBs
aW5rLmlubmVySFRNTCArICIgKCIgKyBlc2NhcGUobGluay5pbm5lckhUTUwpICsgIik8L3A+Iik7
CmRvY3VtZW50LndyaXRlKCI8cD5uYW1lOiAiICsgbGluay5uYW1lICsgIiAoIiArIGVzY2FwZShs
aW5rLm5hbWUpICsgIik8L3A+Iik7CgpsaW5rLm5hbWUgPSBsaW5rLmlubmVySFRNTDsKZG9jdW1l
bnQud3JpdGUoIjxwPm5hbWU6ICIgKyBsaW5rLm5hbWUgKyAiICgiICsgIGVzY2FwZShsaW5rLm5h
bWUpICsgIik8L3A+Iik7CgpsaW5rLm5hbWUgPSBsaW5rLmlubmVySFRNTCA9ICJFdXJvXHUyMEFD
IjsKZG9jdW1lbnQud3JpdGUoIjxwPmlubmVySFRNTDogIiArIGxpbmsuaW5uZXJIVE1MICsgIiAo
IiArIGVzY2FwZShsaW5rLmlubmVySFRNTCkgKyAiKTwvcD4iKTsKZG9jdW1lbnQud3JpdGUoIjxw
Pm5hbWU6ICIgKyBsaW5rLm5hbWUgKyAiICgiICsgZXNjYXBlKGxpbmsubmFtZSkgKyAiKTwvcD4i
KTsKCmRvY3VtZW50LndyaXRlKCI8cD4iICsgIkV1cm+AICgiICsgZXNjYXBlKCJFdXJvgCIpICsg
Iik8L3A+Iik7Cjwvc2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>