Closed
Bug 392756
Opened 17 years ago
Closed 17 years ago
[1.8 branch] node.getAttribute and node.href return strings with different escaping
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mkaply, Unassigned)
References
()
Details
When using JavaScript to access the href of an anchor, accessing .href directly returns a string that has been escaped, whereas accessing the href via getAttribute is not.
there should be consistency between the return of these two values.
Testcase at URL.
Comment 1•17 years ago
|
||
This is, IMO, invalid. getAttribute returns the string value in DOM, .href (according to DOM Level 2 HTML) returns "The absolute URI [IETF RFC 2396] of the linked resource".
If you modify the test a bit, you'll notice that .href does return the absolute
value (and .getAttribute still just the string value).
Comment 2•17 years ago
|
||
Yep. This is invalid.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 3•17 years ago
|
||
What am I supposed to do with what I get back from the href then? decodeURIComponent doesn't work on it, and escape is deprecated.
How do I get it back to a real string?
Comment 4•17 years ago
|
||
decodeURIComponent works fine on the value I get from document.links[0].href. Tested with Mac trunk.
Comment 5•17 years ago
|
||
if decodeURIComponent doesn't work, that's the bug you should file.
Comment 6•17 years ago
|
||
> What am I supposed to do with what I get back from the href then?
What do you mean by "do"? That's the value we'll send to the server. You can do anything you want with it...
> decodeURIComponent doesn't work on it,
How exactly? Never mind that in this case you probably want decodeURI instead.
> How do I get it back to a real string?
What do you mean by "real string"? If you want the attribute value, then just get the attribute value. If you want the URI, you can get that via .href.
Maybe I'm missing what the problem is, exactly?
Reporter | ||
Comment 7•17 years ago
|
||
I analyzed this wrong. i narrowed my testcase too much.
The bug is with decodeURI on iso-8859-1 pages.
See:
bug 392838
Updated•17 years ago
|
Summary: node.getAttribute and node.href return strings with different escaping → [1.8 branch] node.getAttribute and node.href return strings with different escaping
Version: unspecified → 1.8 Branch
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•