Side navigation
#3509 closed enhancement (invalid)
Opened October 22, 2008 10:00AM UTC
Closed November 13, 2010 07:41PM UTC
Last modified March 14, 2012 05:48PM UTC
Make selectors work across iframes
Reported by: | paul | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | selector | Version: | 1.2.6 |
Keywords: | Cc: | paul, flesler, joern | |
Blocked by: | Blocking: |
Description
I propose to add navigating through iframes for the immediate next version of jQuery.
That would basically allow you to do stuff like $("iframe div") and fail gracefully on iframes you're not allowed to access.
Although I never worked on the selector engine, implementation seems quite easy -
a initial test showed that adding something like
if(ret[i].nodeName.toLowerCase() == "iframe") ret[i] = ret[i].contentDocument || ret[i].document;
at line 232 in selector.js would do the job (probably not in all cases though). I personally think
it would be a very valuable addition, and I can see quite a few usecases in jQuery UI.
Attachments (0)
Change History (5)
Changed October 22, 2008 11:18AM UTC by comment:1
owner: | → john |
---|
Changed October 22, 2008 11:18AM UTC by comment:2
cc: | → paul, flesler |
---|
Changed October 22, 2008 11:19AM UTC by comment:3
cc: | paul, flesler → paul, flesler, joern |
---|
Changed October 22, 2008 11:32AM UTC by comment:4
Since it's not possible to navigate through cross-domain iframes, jQuery would simply return a empty collection in that case.
Changed November 13, 2010 07:41PM UTC by comment:5
resolution: | → invalid |
---|---|
status: | new → closed |
The standard querySelectorAll selector syntax tdoesn't support this so I'm closing it.
I can add that some people asked me how to scroll (using scrollTo/localScroll) to items in iframes when links on parent win are clicked.
This would do the trick.
There are some restrictions with cross domain iframes, right ? that needs to be taken into account.