This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13859 - It seems href IDL attribute on base element doesn't reflect content attribute when there is more than one base element with "href".
Summary: It seems href IDL attribute on base element doesn't reflect content attribute...
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-22 08:02 UTC by contributor
Modified: 2011-10-25 02:01 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2011-08-22 08:02:57 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#the-base-element
Complete: http://www.whatwg.org/c#the-base-element

Comment:
It seems href IDL attribute on base element doesn't reflect content attribute
when there is more than one base element with "href". 

Posted from: 114.80.133.8 by csf178@163.com
User agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1
Comment 1 Shaofei Cheng 2011-08-22 08:12:23 UTC
Consider the following html:

<!DOCTYPE html>
<html xmlns="  http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <base id="a" href="  http://www.baidu.com" />
    <base id="b" href="  http://www.google.com" />
    <title></title>
</head>
<body>
    <script type="text/javascript">
        alert([document.getElementById("a").href,document.getElementById("b").href]);
    </script>
</body>
</html>

According to the standard
"The href IDL attribute, on getting, must return the page's document base URL"

a.href and b.href should return the same value " http://www.baidu.com". But this behavior is different from most implementations'.
Comment 2 Ms2ger 2011-08-22 10:12:39 UTC
From code inspection, webkit reflects, and Gecko returns the content attribute, if it exists, and the page's document base URL otherwise.
Comment 3 Ian 'Hixie' Hickson 2011-10-04 23:40:23 UTC
Opera seems to just reflect as well.

How important is Gecko's behaviour when there's no attribute?

Anyone know what IE does?
Comment 4 Ms2ger 2011-10-05 13:04:11 UTC
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1180

I get

log: http://software.hixie.ch/utilities/js/live-dom-viewer/foo
log: http://software.hixie.ch/utilities/js/live-dom-viewer/bar
log: 

with IE9 (and the same without a doctype), so seems like they reflect as well.

Ignore what I said before about Gecko, I don't actually understand what the code does. See <https://bugzilla.mozilla.org/show_bug.cgi?id=600809> for its behaviour, though.
Comment 5 Boris Zbarsky 2011-10-05 14:27:25 UTC
> I don't actually understand what the code does.

Gecko's code for .href on a <base> attribute is as follows:

1)  Try to create a valid URI using the document's current URI as the base URI
    and the value of the attribute as the uri reference.
2)  If this succeeeds,  return the result.
3)  If not, return the value of the attribute.
Comment 6 Shaofei Cheng 2011-10-11 03:25:25 UTC
(In reply to comment #5)
> > I don't actually understand what the code does.
> 
> Gecko's code for .href on a <base> attribute is as follows:
> 
> 1)  Try to create a valid URI using the document's current URI as the base URI
>     and the value of the attribute as the uri reference.
> 2)  If this succeeeds,  return the result.
> 3)  If not, return the value of the attribute.

I tried the HTML above in Firefox 7.0 and the two base element returns different value when get IDL attribute href.

It looks conflict with Boris' comment?
Comment 7 Boris Zbarsky 2011-10-11 16:45:04 UTC
> It looks conflict with Boris' comment?

Only if you misunderstood my comment.  Step 1 from my comment would lead to different values for the HTML from comment 1, if that's what you were testing on.
Comment 8 Shaofei Cheng 2011-10-12 10:46:58 UTC
(In reply to comment #7)
> > It looks conflict with Boris' comment?
> 
> Only if you misunderstood my comment.  Step 1 from my comment would lead to
> different values for the HTML from comment 1, if that's what you were testing
> on.

Ah. Sorry, I misunderstand step 1. It should lead to different values.

I tried IE8&#12289;Chrome and Firefox.

I set a relative URL to href and all the three browsers returned the resolved URL on getting.
Comment 9 Ian 'Hixie' Hickson 2011-10-24 17:44:44 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Ok, I went with just reflecting. This doesn't match Gecko in the case where the attribute is absent, but that doesn't seem necessary for compat since the other browsers don't do it.
Comment 10 contributor 2011-10-24 17:45:16 UTC
Checked in as WHATWG revision r6734.
Check-in comment: <base>.href reflects, apparently.
http://html5.org/tools/web-apps-tracker?from=6733&to=6734