Side navigation
#12905 closed bug (notabug)
Opened November 16, 2012 06:40AM UTC
Closed November 21, 2012 06:06PM UTC
jqery 1.8.2: Uncaught TypeError: Object #<Text> has no method 'getAttribute'
Reported by: | marc.boehret@cupoco.com | Owned by: | marc.boehret@cupoco.com |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
1. the following code leads to Uncaught TypeError: Object #<Text> has no method 'getAttribute'
2. fixed it locally by adding "typeof(b.getAttribute) == 'function'" check
3. started since jquery 1.8, in jQuery 1.7.2 it was working fine
4. 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;
});
5. 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
}
},
Attachments (0)
Change History (4)
Changed November 16, 2012 06:44AM UTC by comment:1
Changed November 16, 2012 01:39PM UTC by comment:2
owner: | → marc.boehret@cupoco.com |
---|---|
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.
Changed November 17, 2012 06:37AM UTC by comment:3
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
Changed November 21, 2012 06:06PM UTC by comment:4
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/