#12462 closed bug (wontfix)
getComputedStyle is used without checking the node
Reported by: | 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。
Change History (12)
comment:1 follow-up: 2 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Replying to 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.
comment:3 Changed 10 years ago by
Owner: | changed from [email protected]… to mikesherov |
---|---|
Status: | pending → assigned |
comment:4 Changed 10 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
comment:5 Changed 10 years ago by
Owner: | changed from mikesherov to [email protected]… |
---|---|
Status: | assigned → pending |
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?
comment:6 Changed 10 years ago by
Here is an example case using ajax where this problem happens when the resulting HTML contains return characters http://jsfiddle.net/RBSF7/1/
comment:7 Changed 10 years ago by
Cc: | dmethvin added |
---|---|
Owner: | changed from [email protected]… to mikesherov |
Status: | pending → assigned |
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?
comment:8 Changed 10 years ago by
Priority: | low → high |
---|
comment:9 Changed 10 years ago by
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/
comment:10 Changed 10 years ago by
'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.
comment:11 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
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!
comment:12 Changed 10 years ago by
Thanks for this fix it fixed our Drupal installation which is stuck in the dark ages with JQuery. Brillliant!!
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?