Side navigation
#10570 closed bug (fixed)
Opened October 25, 2011 07:13AM UTC
Closed June 19, 2012 06:26AM UTC
Last modified April 19, 2013 09:38AM UTC
:text selector throws an error in IE7 when there is a cross domain iframe on the page
Reported by: | matt@gweax.de | Owned by: | timmywil |
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | selector | Version: | 1.6.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This bug origins in Sizzle, there is already a bug report there (https://github.com/jquery/sizzle/issues/66), but since nothing happened there during the last three months, I think it's apropriate to file a bug report here as well, since jQuery is directly affected by this bug.
When there is an iframe with a cross domain source, the :text selector fails in IE7 with the error "Permission denied". The problem lies in line 4394 (jQuery 1.6.4):
var attr = elem.getAttribute( "type" ), type = elem.type;
For some reason, getAttribute("type") is not allowed on cross domain iframes in IE7. A possible solution would be to only check the attribute when the element indeed is an input element:
text: function( elem ) { var attr, type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type, attr = elem.getAttribute("type"), "text" === type) && ( attr === type || attr === null ); },
See http://jsfiddle.net/VvnGm/ for an example
Attachments (0)
Change History (9)
Changed October 26, 2011 01:18AM UTC by comment:1
Changed October 29, 2011 11:00PM UTC by comment:2
component: | unfiled → selector |
---|---|
priority: | undecided → low |
status: | new → open |
Changed October 30, 2011 01:20AM UTC by comment:3
milestone: | None → 1.next |
---|---|
owner: | → timmywil |
status: | open → assigned |
Changed February 28, 2012 03:06PM UTC by comment:4
I've got the same problem - in my case the cross domain iframe is facebook widget.
Changed April 26, 2012 10:10AM UTC by comment:5
I have the same problem. Grrrrrrrrrrrrr...........
Changed April 26, 2012 10:45AM UTC by comment:6
A workaround is to add this in a file just after jquery:
if ($.browser.msie && $.browser.version === "7.0") { $.find.selectors.filters.text: function( elem ) { var attr, type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type, attr = elem.getAttribute("type"), "text" === type) && ( attr === type || attr === null ); }; }
Changed June 19, 2012 06:26AM UTC by comment:7
milestone: | 1.next → 1.8 |
---|---|
resolution: | → fixed |
status: | assigned → closed |
This has been implemented in 1.8.
Changed December 04, 2012 01:21PM UTC by comment:8
Hi All ,
I have been struggling for this to get solution. Finally i got the issue and solution.
This issue exists only in IE7 and IE9 compatibility view.
Problem:
In your page when you have an IFRAME with crossdomain source and suppose for example you have a jquery logic to get all
":input" elements , that time jquery loops through all the elements in the page and gets the "type" attibute, but when it hits the
IFRAME element to get the type attibute it throws error "PERMISSION DENIED" since IFRAME has crossdomain source.
Solution:
Just add dummy type attribute to your IFRAME tag and get rid of error
ex.
<iframe type="MyFrame" src="http://www.xyz.com/iframe/customer-success-resources.html"/></iframe>
Hope this helps for those who are looking for solution.
Changed April 19, 2013 09:38AM UTC by comment:9
Thanks Mahesh! Was having the same issue and it was driving me nuts! ;)
I'm seeing a similar problem at line 4125. Like yours, this has to do with cross-domain iframe only.
Will try to post a bug report later.