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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20378</bug_id>
          
          <creation_ts>2012-12-13 17:43:21 +0000</creation_ts>
          <short_desc>Need to define base URI for the document created via DOMParser</short_desc>
          <delta_ts>2014-12-01 18:30:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM Parsing and Serialization</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Travis Leithead [MSFT]">travil</assigned_to>
          <cc>annevk</cc>
    
    <cc>dtrebbien</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps-bugzilla</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80114</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-12-13 17:43:21 +0000</bug_when>
    <thetext>This is needed by various DOM methods.

Note that in Gecko this is the base URI of the document of the current window of the browsing context of the window the DOMParser is created from or something like that.  No idea what other UAs do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80166</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-12-14 09:02:44 +0000</bug_when>
    <thetext>The base URL would not be simply the document&apos;s URL? (The latter I think should be about:blank.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80168</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-12-14 09:10:26 +0000</bug_when>
    <thetext>It could be, sure.  Just needs to be defined.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80175</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-12-14 10:58:10 +0000</bug_when>
    <thetext>Ah right, so for Gecko the document&apos;s URL is indeed the &quot;page URL&quot;. Other browsers use null, which I think they should change to about:blank so we can make document.documentURI and document.URL always be a string.

I can change the document to remove the open issue and just say that URL should be about:blank.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113062</commentid>
    <comment_count>4</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2014-10-13 23:55:21 +0000</bug_when>
    <thetext>In, ... this currently says:

&quot;Additionally, the document must have a URL value equal to the URL of the active document&quot;

This does not say &quot;base URI&quot;. That should be added. Anything else here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113067</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-10-14 07:08:56 +0000</bug_when>
    <thetext>Can&apos;t we use about:blank as the document&apos;s URL? That seems much cleaner than some kind of override.

No need to add a base URL, it&apos;s derived.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113098</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-10-14 12:04:27 +0000</bug_when>
    <thetext>Assuming that&apos;s web-compatible, that seems doable.

Right now interop seems to be mixed.  Consider this testcase meant to test simple base URI behavior: http://jsfiddle.net/n9zb6yox/

The results I see are as follows:

Gecko: http://fiddle.jshell.net/n9zb6yox/show/foo
Blink: empty string
Safari: foo
IE11: http://fiddle.jshell.net/n9zb6yox/show/foo

and this testcase tests document.URL: http://jsfiddle.net/n9zb6yox/2/

Results:

Gecko: http://fiddle.jshell.net/n9zb6yox/2/show/
Blink: empty string
Safari: empty string
IE11: http://fiddle.jshell.net/n9zb6yox/2/show/

and this testcase tests document.baseURI: http://jsfiddle.net/n9zb6yox/3/

Results:

Gecko: http://fiddle.jshell.net/n9zb6yox/3/show/
Blink: null
Safari: null
IE11: undefined; looks like it has no .baseURI support yet.

and this testcase tests what happens with &lt;base&gt; in the main doc: http://jsfiddle.net/n9zb6yox/4/

Results:

Gecko: http://example.com/foo
Blink: empty string
Safari: foo
IE11: http://fiddle.jshell.net/n9zb6yox/4/foo

And with &lt;base&gt; in the parsed doc: http://jsfiddle.net/n9zb6yox/5/

Results:

Gecko: http://example.com/foo
Blink: http://example.com/foo
Safari: http://example.com/foo
IE11: http://example.com/foo

Hey, some sanity at last!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>