Skip to main content

Bug Tracker

Side navigation

#12462 closed bug (wontfix)

Opened September 05, 2012 05:28AM UTC

Closed September 29, 2012 02:03AM UTC

Last modified December 13, 2012 09:09AM UTC

getComputedStyle is used without checking the node

Reported by: 229298434@qq.com Owned by: mikesherov
Priority: high Milestone: None
Component: css Version: 1.8.1
Keywords: Cc: dmethvin
Blocked by: Blocking:
Description

In firefox 14,when run this code

$("<a></a>test<a></a>").animate({left:'-100px'})

it will get error message "NS_ERROR_XPC_BAD_CONVERT_JS:Could not convert JavaScript argument arg 0 [nsIDOMWindow.getComputedStyle]"

The reason is that the 'getComputedStyle' method is called without checking the node whether can apply this method.(when the elem is a textnode,it with got error).In the previous version like 1.7.2 you did check this。

Attachments (0)
Change History (12)

Changed September 05, 2012 01:16PM UTC by mikesherov comment:1

owner: → 229298434@qq.com
status: newpending

Thanks for contributing to the jQuery project! May I ask why you're trying to animate something that can't be animated like a textnode? What's the real world use case here, and what do you expect to happen?

Changed September 05, 2012 02:45PM UTC by anonymous comment:2

Replying to [comment:1 mikesherov]:

Thanks for contributing to the jQuery project! May I ask why you're trying to animate something that can't be animated like a textnode? What's the real world use case here, and what do you expect to happen?

i use a template engine and it comtain the this html string "<div>.....</div>\\n<div>...</div>".The '\\n' was convert to a textnode when i put this string to the jQuery selector . so when i call the animate function ,it raise error .I just want to append those node to the dom and show it. and now i must use filter('*') to filter out the textnode.

Changed September 05, 2012 03:08PM UTC by mikesherov comment:3

owner: 229298434@qq.commikesherov
status: pendingassigned

Changed September 08, 2012 07:04PM UTC by mikesherov comment:4

component: unfiledcss
priority: undecidedlow

Changed September 10, 2012 01:33AM UTC by mikesherov comment:5

owner: mikesherov229298434@qq.com
status: assignedpending

I'm sorry, but this didn't work in jQuery 1.7.2 either in Firefox: http://jsfiddle.net/Lb2zM/1/

Can you show me a situation using jsfiddle in which it did work in 1.7.2 and not in 1.8.0?

Changed September 13, 2012 12:02PM UTC by anonymous comment:6

Here is an example case using ajax where this problem happens when the resulting HTML contains return characters http://jsfiddle.net/RBSF7/1/

Changed September 13, 2012 12:14PM UTC by mikesherov comment:7

cc: → dmethvin
owner: 229298434@qq.commikesherov
status: pendingassigned

confirmed. Thanks for the test case. This is clearly a place where jQuery used to "just work". I wonder if it has anything to do with #12523.

dmethvin?

Changed September 13, 2012 12:16PM UTC by mikesherov comment:8

priority: lowhigh

Changed September 18, 2012 01:54AM UTC by mikesherov comment:9

What's fun about this is that it only ACCIDENTALLY worked for your use case in 1.7.2. I can change it to slideUp and it breaks in 1.7.2 : http://jsfiddle.net/RBSF7/2/

Changed September 27, 2012 05:40AM UTC by anonymous comment:10

'result.hide().slideDown()' work fine in 1.7.2 and should work fine in 1.8.2 also.

I think, this problem caused by '\\n' including '<p>some html to echo</p>\\n<p>some more html</p>'.

This code work fine without '\\n' both in 1.7.2 and in 1.8.2.

Changed September 29, 2012 02:03AM UTC by mikesherov comment:11

resolution: → wontfix
status: assignedclosed

So I investigated this for a while, and there's no reasonable fix for this. While I can get this to work in FF and Chrome, it was and will always be broken in IE7/6. Really, you should be passing arbitrary HTML to animate as it may contain text nodes.

There are many ways around this in code, one of which you outlined yourself.

For these reasons, I'm marking this as wontfix. Thanks for the bug report!

Changed December 13, 2012 09:09AM UTC by Slipstreamer comment:12

Thanks for this fix it fixed our Drupal installation which is stuck in the dark ages with JQuery. Brillliant!!