Opened 14 years ago
Closed 13 years ago
#4143 closed bug (invalid)
http://www.gcforum.org/forumdisplay.php?fid=2410 can't not use jQuery selector to find elements??
Reported by: | Jumann | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | unfiled | Version: | 1.3.1 |
Keywords: | selector | Cc: | |
Blocked by: | Blocking: |
Description
as title. I can't use jQuery selector to find html dom element. example: var body = jQuery('body');==> body.length will be 0; but get(0) will returned the element. var wrap = jQuery('div#wrap', body); ==> wrap.length will be 0; but get(0) will returned undefined. Is this a bug in jQuery 1.3.1???
Change History (6)
comment:1 Changed 14 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 Changed 14 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
javascript:(function(){window.t=document.createElement('script');window.t.src='http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js';window.document.body.appendChild(window.t);setTimeout(function(){alert(jQuery('body').length);},2000)})();
You can copy the sentence above here. Then link to http://www.gcforum.org/forumdisplay.php?fid=2410 and paste it to address bar. It both returned 0 in FF3 and IE7. Thanks for your reply.
comment:3 follow-up: 5 Changed 14 years ago by
It sounds like some other code on that page is interfering with jQuery. I couldn't see it in a quick look at common.js where I figured it would be. So, if you can create a simple test case that demonstrates the problem, attach it. If you need help debugging the code, it would be best to post on a forum because we haven't yet established this is a bug in jQuery. A simple test case would help to determine that.
comment:4 Changed 14 years ago by
I found commom.js overrides Array.prototype.push function.
Array.prototype.push = function(value) { this[this.length] = value; return this.length; }
It seems that affects result of "ret.push( array[i] )". (at 2026 line of jQuery1.3.1.js) It caused jQuery('body');==> body.length will be 0; Does that problem resemble #2721?
comment:5 Changed 14 years ago by
I found commom.js overrides Array.prototype.push function.
Array.prototype.push = function(value) { this[this.length] = value; return this.length; }
It seems that affects result of "ret.push( array[i] )". (at 2026 line of jQuery1.3.1.js) It caused jQuery('body');==> body.length will be 0; Does that problem resemble #2721?
comment:6 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Sounds like this was a problem outside jQuery.
That would be pretty obvious if it didn't work. I tried
alert(jQuery('body').length)
with 1.3.1 and 1.2.6 in FF3 and IE7 and they both returned 1 as they should. If you can create a simple test case, attach it.