Bug Tracker

Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#162 closed bug (fixed)

cloneNode() issues

Reported by: john Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

Description

I'm experiencing some problems on a site with some apparently simple code. It used to work with jQuery R226, but when I updated to 1.0 final (R231), it broke in Firefox (Mac) with the following error:

Error: $(e.cloneNode(true)) has no properties Source: http://sgmvoc.optimistweb.org/sites/sgmvoc.optimistweb.org/ themes/clubhouse/scripts/jq.js Line: 376

It works fine in Safari and possibly other browsers too.

This is in the following code from jquery-1.0.js:

jQuery.swap( e, old, function() { if (jQuery.css(e,"display") != "none") { oHeight = e.offsetHeight; oWidth = e.offsetWidth; } else { e = $(e.cloneNode(true)).css({ visibility: "hidden", position: "absolute", display: "block" }).prependTo("body")[0];

oHeight = e.clientHeight; oWidth = e.clientWidth;

e.parentNode.removeChild(e); } });

which was last changed in revision 230->231. The problem happens when doing a plain slideDown() from inside a .click() callback:

jQuery("a.login").click(function(){ jQuery("#header-forms > div").filter(":visible").slideUp("slow"); jQuery("#login-box").slideDown("slow"); ... });

in: http://sgmvoc.optimistweb.org/sites/sgmvoc.optimistweb.org/themes/ clubhouse/scripts/jq-clubhouse.js

This is pretty simple jQuery usage, and it works fine with 1.0 final in Firefox if I extract the immediate markup and try it on a stand- alone, unstyled .html page. It is only in combination with the other markup on that page that it breaks. It could be a browser bug, jquery bug or something in my markup that's messing stuff up, I'm not sure.

You can try it for yourself on: http://sgmvoc.optimistweb.org/ (click the 'Register' or 'Member log- in' in the header)

Has anyone got any ideas about this? Have you seen it before?

Steven Wittens

Change History (1)

comment:1 Changed 16 years ago by dave.methvin

Resolution: fixed
Status: newclosed

That page uses $ for document.getElementById. This caused a conflict in the use of $() within jQuery itself, and has been fixed in recent releases by using jQuery() internally.

Note: See TracTickets for help on using tickets.