Closed
Bug 600809
Opened 16 years ago
Closed 16 years ago
Base href is repeated when reading JS ".href" attribute of the base tag
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | final+ |
People
(Reporter: BYK, Assigned: sicking)
References
Details
(Keywords: regression, testcase, Whiteboard: [ready to land])
Attachments
(1 file, 1 obsolete file)
|
2.14 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6) Gecko/20100101 Firefox/4.0b6
When a <base href="somepath/somepath2/"> is defined on the page and when you access that base element with JavaScript and read its "href" property like document.getElementsByTagName('base')[0].href, it doubles the href. The expected value is "somepath/somepath2/" or "http://mydomain.com/somepath/somepath2" though the read value is "http://mydomain.com/somepath/somepath2/somepath/somepath2/".
Reading via the getAttribute method temporarily solves my problem since it reports the exact value defined in the href attribute.
Reproducible: Always
Steps to Reproduce:
1. Create a <base href="somepath/"> element in the head of your document
2. Access and read the href JavaScript property of this base element
Actual Results:
See that the base href is repeated.
Expected Results:
Expected result is the normal path to the base href.
This might be the case only with relative base href's though I have not tested it.
Also it seems that this problem also exists on the previous versions of Firefox like 3.6.
| Reporter | ||
Comment 2•16 years ago
|
||
"Note: The base URL must be an absolute URL!"
My bad. Sorry for disturbing everybody.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Comment 3•16 years ago
|
||
(In reply to comment #1)
> Can a base href actually be relative according to the spec?
Yes in HTML5, although not in HTML4. See bug 553074
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Updated•16 years ago
|
blocking2.0: --- → ?
Keywords: regression
| Assignee | ||
Updated•16 years ago
|
Assignee: nobody → jonas
blocking2.0: ? → final+
| Assignee | ||
Comment 5•16 years ago
|
||
Trivial patch, just resolve against the document uri.
Attachment #479788 -
Attachment is obsolete: true
Attachment #481157 -
Flags: review?
| Assignee | ||
Updated•16 years ago
|
Attachment #481157 -
Flags: review? → review?(Olli.Pettay)
Comment 6•16 years ago
|
||
Comment on attachment 481157 [details] [diff] [review]
Patch to fix
Could you add still some tests to verify that
::GetHref works properly after calling ::SetHref.
Attachment #481157 -
Flags: review?(Olli.Pettay) → review+
| Assignee | ||
Comment 7•16 years ago
|
||
Doesn't the included test-change do that?
Whiteboard: [ready to land]
Comment 8•16 years ago
|
||
Well, yes one variation. But perhaps you could add a check that it works
also with absolute urls... just to prevent regressions in the future.
| Assignee | ||
Comment 9•16 years ago
|
||
Ah, yes, will add absolute urls as a test too.
| Assignee | ||
Comment 10•16 years ago
|
||
Checked in, with additional test, thanks for the quick review
http://hg.mozilla.org/mozilla-central/rev/94f44cf059a6
Status: NEW → RESOLVED
Closed: 16 years ago → 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•