Closed Bug 298023 Opened 20 years ago Closed 20 years ago

[quirks] location.href and base tag outside head show inconsistent behaviour

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: adam, Unassigned)

Details

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 location.href appears to ignore the base command. IE works. e.g. <base href="http://www.test.com/test/"> <button type="button" onClick="location.href='test.html'">go</button> Reproducible: Always Actual Results: redirects using the url as the base Expected Results: should have used the base from the base tag
Attached file tescase
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050617 Firefox/1.0+ ID:2005061707 WFM
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 WFM
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
wfm with Mozilla/5.0 (Windows; U; Windows NT 5.2; de-DE; rv:1.8b2) Gecko/20050617 verified
Status: RESOLVED → VERIFIED
Attached file base outside head
Problem occurs when base tag is outside head (see new test case). It is probably not strict w3c to put a base tag outside the head. Altho it works for regular links and works in IE.
Status: VERIFIED → UNCONFIRMED
Resolution: WORKSFORME → ---
From the html 4 spec: When present, the BASE element must appear in the HEAD section of an HTML document, before any element that refers to an external source. The path information specified by the BASE element only affects URIs in the document where the element appears. Maybe the base tag for a href links only works here for compatibility reasons? Anyway, the bug you see here is no bug (since the spec forbids the base tag where you put it)...
Even so, surely being consistent is important. I've found it convenient to use multiple base tags in a document when I have multiple sets of links from different sources.
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
Here we have no doctype, so it forces quirks mode. This bug is present using quirks mode, as the provided testcase shows. I fully understand why the base tag isn't parsed outside of the head tag when gecko is in standards-compliance mode, but this shouldn't be happening IMO in quirks mode.
Yes probably we should fix this, i talked to a developer, but one problem is that this bug here probably cannot be solved easily.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: location.href and base tag → [quirks] location.href and base tag outside head show inconsistent behaviour
We store the "base outside the head" on elements. But there's no obvious way to tell what element some random snippet of script "belongs to" (if any). I suspect we should just wontfix this. This is not nearly common enough to be worth yet more quirks.
Would this have any impact on this bug: <http://blogs.msdn.com/ie/archive/2005/08/29/457667.aspx>. (Or perhaps on a new bug on not doing the quirks.)
Ah, yes. Excellent. I don't think we should drop the quirk until a bit after IE ships, at least. We don't really want to break existing working pages.
Status: NEW → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → WONTFIX
I don't think we should drop the current way we handle <base> tags ever (or at least not in a very long time). Our current implementation supports <base> quriks really well at a very low cost, and without all the issues described in that blog for IE. The issue filed in this bug is the first time i've ran into someone having issues with our base implementation. So keeping our current code will keep developers and users happy, at a negligable cost for us. It might even drive a few IE users over to us once pages stop working for them :)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: