Opened 10 years ago
Closed 10 years ago
#12905 closed bug (notabug)
jqery 1.8.2: Uncaught TypeError: Object #<Text> has no method 'getAttribute'
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
- the following code leads to Uncaught TypeError: Object #<Text> has no method 'getAttribute'
- fixed it locally by adding "typeof(b.getAttribute) == 'function'" check
- started since jquery 1.8, in jQuery 1.7.2 it was working fine
- code example
$('#TestLink').live('click', function() {
console.log('click'); testLink = $(this); targetUrl = testLink.attr('href'); $.ajax({
url: targetUrl, success: function(data) {
console.log('ajax success'); dataElement = $(data); dataElement.is("#main-content");
}
}); return false;
});
- my local fix in jquery 1.8.2
filter: {
ID: d ? function(a) {
return a = a.replace(V, ""), function(b) {
return typeof(b.getAttribute) == 'function' && b.getAttribute("id") === a
}
} : function(a) {
return a = a.replace(V, ""), function(b) {
var c = typeof b.getAttributeNode !== n && b.getAttributeNode("id"); return c && c.value === a
}
},
Change History (4)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
Which browser gave you the error?
Does the ajax really have anything to do with it? It seems like the problem would be with the id selection. Please reduce this further.
comment:3 Changed 10 years ago by
Status: | pending → new |
---|
I was checking if it is browser-specific but the exception raised on firefox and on google chrome - in safari and others i didn't check.
I can give you the return object of the ajax call.
Real Code Example
comment:4 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
Sorry but it's not possible to debug the problem given what's been presented here. Please ask someone to help you debug this in our forum or on StackOverflow and create a new bug with a specific and reduced test case if you can.
In the code above, the dataElement = $(data)
stands out as particularly flakey but I don't want to start a blind debugging session in the bug tracker.
i wanted to use jsFiddle but it does not work for ajax-requests for some reason.
http://jsfiddle.net/gLjdg/19/