Side navigation
#1675 closed bug (fixed)
Opened September 19, 2007 04:52AM UTC
Closed March 02, 2010 06:56PM UTC
expando related problem on removeData()
Reported by: | dimi | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.4.3 |
Component: | data | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
During a simple remove() call on a <div> that contains a Java applet via a <embed> tag, I get this error:
java class com.x.y.z has no public field or method named "jQuery12332451234"
on line 555 of jQuery 1.2.1 where we do a delete elem[ expando ];
This error is in Firefox 2.0.0.5 on Linux. Quite severe problem.
Attachments (0)
Change History (16)
Changed September 19, 2007 05:01AM UTC by comment:1
Changed September 27, 2007 01:36PM UTC by comment:2
resolution: | → fixed |
---|---|
status: | new → closed |
I believe this has already been fixed in SVN. I was unable to reproduce this. Please feel free to reopen if you still experience this issue with the latest SVN and attach a test case.
Changed November 17, 2007 12:09AM UTC by comment:3
resolution: | fixed |
---|---|
status: | closed → reopened |
When a $("#divName").html("") is called on a div tag (id="divName") that contains a java applet, the error above still exists:
Java class ptviewer has no public field or method named "jQuery1195256692140"
http://localhost:8080/t/resources/rpm3.0/js/lib/jQuery/jquery-1.2.1.js
Line 555
This occurs in Firefox but not in IE 6 & 7.
Test Case:
I have a page that displays virtual tours with an applet called PTViewer(http://www.fsoft.it/panorama/ptviewer.htm) and is set up in a way similar to a slideshow in that the problematic div holds the embedded virtual tour and beside it is a jCarousel which changes that div to the tour that you click on. When it first loads up, the applet works fine but when you click on any other button/image that replaces the code (in jCarousel or otherwise) in the problematic div the error occurs.
Temporary Solution:
The code on line 555 of jquery-1.2.1.js is as such:
delete elem[ expando ];
This line is surrounded by a try/catch block so you would think it would go to catch when the error occurs but instead it doesn't and the embedded code is still there on the page. If I only let IE run that line:
if(jquery.browser.msie){ delete elem[ expando ]; }else{ if ( elem.removeAttribute ) elem.removeAttribute( expando ); }
Then this works. Please note that the code in the else portion is also in the catch portion of the try/catch statement that the suspect line resides in.
Changed February 15, 2008 12:07PM UTC by comment:4
I have same problem in firefox version 2.0.0.12.
'xx.xxx.xxxx.class has no public field or method named "JQuery....'
Error introduced AFTER 1.2.1!
My html produce a valid html document with a applet tag. And everything works fine with jquery 1.2.1.
Error is when leaving page (cleanup cache?)
My html:
...
<div class="applet">
<script type="text/javascript">
/*<![CDATA[*/writeApplet('appletId','xx.xxx.xxxx.class','appletName','600','350','xxx.jar','/','MAYSCRIPT',{'archive':'xxx.jar','Cabbase':'xxx.cab','agent':''+navigator.userAgent+''});/*]]>*/
</script>
<script type="text/javascript">
/*<![CDATA[*/document.write('<\\/applet>')/*]]>*/
</script>
</div>
In jquery 1.2.3 (developer version) error is in line 674 (it seems to be when cleaning cache for elem = script!).
// Compute a unique ID for the element
673 if ( !id )
674 id = elem[ expando ] = ++uuid;
675
regards,
Changed April 03, 2008 02:54PM UTC by comment:5
I'm also having problems with applets in Firefox v2.x. It appears that the root problem is that you can't set expando on a Java applet tag (regardless if the tag's been written with the embed, object or applet tag.)
I could live without being able to alter an applet tag, but this causes problems with pages that just contain applets, since jQuery attempts to unbind all events on the element during the window.unload event.
Changed May 16, 2008 06:18PM UTC by comment:6
milestone: | 1.2.2 → 1.2.4 |
---|---|
resolution: | → fixed |
status: | reopened → closed |
This is how that part looks now:
try { delete elem[ expando ]; } catch(e){ // IE has trouble directly removing the expando // but it's ok with using removeAttribute if ( elem.removeAttribute ) elem.removeAttribute( expando ); }
So there's no chance of getting an error. I declare this fixed.
Changed June 16, 2008 05:33PM UTC by comment:7
For the other side of things (data() instead of removeData())...
Unwrapped elem[ expando ] in jquery-1.2.6.js for data():
554 // Compute a unique ID for the element
665 if ( !id )
666 id = elem[ expando ] = ++uuid;
Java class XXX has no public field or method named "jQuery1213636634264"
There's a ticket open for it #2349.
Changed October 30, 2008 01:08AM UTC by comment:8
milestone: | 1.2.4 → 1.3 |
---|---|
resolution: | fixed |
status: | closed → reopened |
Changed October 30, 2008 01:08AM UTC by comment:9
owner: | → flesler |
---|---|
status: | reopened → new |
Changed October 30, 2008 01:08AM UTC by comment:10
status: | new → assigned |
---|
Changed November 29, 2008 01:08PM UTC by comment:11
I see this problem in IE8 in IE7 compatibility mode now: Apparently, it is not possible to remove a Java Applet using jQuery, but I also have not found a workaround yet.
A demonstration of the problem is at http://vaxbusters.org/applet-prob.html
Changed November 29, 2008 01:30PM UTC by comment:12
Replying to [comment:11 hans]:
I see this problem in IE8 in IE7 compatibility mode now: Apparently, it is not possible to remove a Java Applet using jQuery, but I also have not found a workaround yet.
A workaround is to remove the applet element using direct DOM manipulation:
var applet = $("#applet")[0]; if (applet) { applet.parentNode.removeChild(applet); }
Changed December 15, 2008 10:39PM UTC by comment:13
A previously mentioned (in (#2349)
http://82.170.249.144/mediaBeez/lib/jquery/jquery-1.2.6.source_VIS.js
Seems to have worked for me, but only in tandem with replacing this:
$('#loader').load(this.href);
with:
$.get(this.href, function(data) { var applet = $('#loader applet')[0]; var loader = $('#loader')[0]; if(applet) { applet.parentNode.removeChild(applet); } loader.innerHTML = data; });
Hopepfully this finds someone well.
Changed December 07, 2009 04:02AM UTC by comment:14
component: | core → data |
---|---|
milestone: | 1.3 → 1.4 |
resolution: | → fixed |
status: | assigned → closed |
version: | 1.2.1 → 1.4a1 |
Changed March 02, 2010 06:46PM UTC by comment:15
resolution: | fixed |
---|---|
status: | closed → reopened |
I think this problem persists again, I currently have the same problem and as far as I can see the reason in jquery 1.4.2 is line 4514:
id = elem[ jQuery.expando ];
a simple fix would be to use jQuery.noData which was the previous fix for this issue.
I will prepare a patch if you agree to doing this, but I have not yet full insight in the internals of jQuery. So I simply don't know if this solves the problem or leaves events or other stuff uncleaned:
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { continue; } id = elem[ jQuery.expando ]; ... }
The original code to reproduce was to have something like:
<div id='a'> <applet ...></applet </div>
and then just empty it using either empty() or html(''), e.g.:
$('#a').empty();
Changed March 02, 2010 06:56PM UTC by comment:16
milestone: | 1.4 → 1.4.3 |
---|---|
resolution: | → fixed |
status: | reopened → closed |
version: | 1.4a1 → 1.4.2 |
Good catch, I've re-fixed this:
http://github.com/jquery/jquery/commit/04e31ff058548fbdbdf77c61d4edc3a974b080f4
To temporarily fix the problem, I've added this:
if (elem.nodeName.toLowerCase() == 'embed') return;
at the beginning of the removeData() function.