Ticket #6590 (closed bug: invalid)
Error reading 'href' attribute in IE when userData Behavior is applied
| Reported by: | hallettj | Owned by: | hallettj |
|---|---|---|---|
| Priority: | undecided | Milestone: | |
| Component: | attributes | Version: | 1.4.2 |
| Keywords: | IE, IE6, IE7, userdata, behavior, href | Cc: | |
| Blocking: | Blocked by: |
Description
userData Behavior < http://msdn.microsoft.com/en-us/library/ms531424(VS.85).aspx> is a local storage implementation in IE.
jQuery calls getAttribute("href", 2) in IE to read the 'href' attribute of an element.
Apparently if userData Behavior is applied to an element and getAttribute() is later called on the same element with more than one argument the result is an error.
Steps to reproduce in IE7:
var a = $('<a href="#foo"/>');
a.get(0).addBehavior('#default#userData');
a.attr('href'); // Error: Wrong number of arguments or invalid property assignment
As far as I can tell this affects IE6 and IE7. I encountered this error when using jQuery in combination with persist.js.
Change History
comment:3 Changed 3 years ago by snover
- Priority set to undecided
So what happens to the href value? It becomes impossible to get the non-normalized value?
comment:4 Changed 3 years ago by snover
- Owner set to hallettj
- Status changed from new to pending
See previous question.
comment:5 Changed 2 years ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Looking further into this I see that elements with userData enabled have an expires attribute with an - often empty - string value. Elements that do not have userData enabled generally do not have an expires attribute. So that attribute could be used in a check in Expr.attrHandle.href(). Though I don't know of any way to get an unmodified href value from an attribute after it has userData enabled.