<?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>18951</bug_id>
          
          <creation_ts>2008-05-08 14:04:40 -0700</creation_ts>
          <short_desc>all DOM operations stop working when location.hash set to &apos;#&apos;</short_desc>
          <delta_ts>2008-07-07 13:36:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>525.x (Safari 3.1)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.nick-santos.com/tests/safari_hash_test.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nick Santos">nicksantos</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>brettw</cc>
    
    <cc>ian.eng.webkit</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>79923</commentid>
    <comment_count>0</comment_count>
    <who name="Nick Santos">nicksantos</who>
    <bug_when>2008-05-08 14:04:40 -0700</bug_when>
    <thetext>The following javascript code:

     window.location.hash = &apos;#b=BBB&apos;;

     var node = document.createElement(&apos;span&apos;);
     node.innerHTML = &apos;Safari &apos;;
     document.body.appendChild(node);

     window.location.hash = &apos;#&apos;;
  
     var node2 = document.createElement(&apos;span&apos;);
     node2.innerHTML = &apos;can\&apos;t take the heat!&apos;;
     document.body.appendChild(node2);

makes all subsequent DOM operations fail. Weird.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79925</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2008-05-08 14:06:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/5921760&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79931</commentid>
    <comment_count>2</comment_count>
    <who name="Feng Qian">ian.eng.webkit</who>
    <bug_when>2008-05-08 15:02:34 -0700</bug_when>
    <thetext>KURL::setRef drops &quot;#&quot; if the hash string is empty, but FF appends &apos;#&apos; to the end of URL.

Is it safe to just append &quot;#&quot; to new url even when the hash string is empty?

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79934</commentid>
    <comment_count>3</comment_count>
    <who name="Feng Qian">ian.eng.webkit</who>
    <bug_when>2008-05-08 15:36:33 -0700</bug_when>
    <thetext>I tried this patch on my local build, and it fixes the issue described by Nick.
Does this change has side-effect? and why &apos;#&apos; makes difference?

Index: KURL.cpp
===================================================================
--- KURL.cpp	(revision 32987)
+++ KURL.cpp	(working copy)
@@ -705,7 +705,7 @@ void KURL::setRef(const String&amp; s)
 {
     if (!m_isValid)
         return;
-    parse(m_string.left(m_queryEnd) + (s.isEmpty() ? &quot;&quot; : &quot;#&quot; + s));
+    parse(m_string.left(m_queryEnd) + &quot;#&quot; + s);
 }
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79993</commentid>
    <comment_count>4</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2008-05-09 11:36:01 -0700</bug_when>
    <thetext>You could change the setter to clear the # when you pass a NULL string, but make the ref empty (leaving the #) when you pass an empty string. I think this pattern would be good to use for the other setters as well (at least, the query) so that &quot;foo?&quot; and &quot;foo&quot; can be differentiated in the setter.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80001</commentid>
    <comment_count>5</comment_count>
    <who name="Feng Qian">ian.eng.webkit</who>
    <bug_when>2008-05-09 13:12:22 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; You could change the setter to clear the # when you pass a NULL string, but
&gt; make the ref empty (leaving the #) when you pass an empty string. I think this
&gt; pattern would be good to use for the other setters as well (at least, the
&gt; query) so that &quot;foo?&quot; and &quot;foo&quot; can be differentiated in the setter.
&gt; 

That&apos;s good point. What&apos;s the difference between a URL with &apos;#&apos; and empty hash, and the same URL without &apos;#&apos; and hash? It seems changed loader behavior.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85374</commentid>
    <comment_count>6</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2008-07-07 12:28:57 -0700</bug_when>
    <thetext>Working on this right now - seems that a tweak inside KURL will be the solution.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85384</commentid>
    <comment_count>7</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2008-07-07 13:36:38 -0700</bug_when>
    <thetext>Fixed in http://trac.webkit.org/changeset/35040</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>