Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window.getComputedStyle does not implement interface Element error in Firefox

I'd like to append some data to the HTML element, so I've used the following code:

$("#bookListDiv").append(data.HTMLString);

and everything has working, but then I'd like to add a fadein animation while displaying this element, so I've modified it to:

$(data.HTMLString).hide().appendTo("#bookListDiv").fadeIn(1000);

Animation is working on Chrome but on Firefox I see the following error in console: TypeError: Argument 1 of Window.getComputedStyle does not implement interface Element. I'm using jquery 1.8.2.

Could you advise me what can be wrong? I supposed something with data, but in the first approach everything is working correctly.

like image 879
Steve Macculan Avatar asked Apr 03 '14 21:04

Steve Macculan


People also ask

What is window getComputedStyle?

The Window. getComputedStyle() method returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.

What are computed styles?

The computed style is the style used on the element after all styling sources have been applied. Style sources: external and internal style sheets, inherited styles, and browser default styles.


1 Answers

You will also get this if you call getComputedStyleon <html>. It should be common sense, but I had a recursive function that was bubbling up from inner elements with this function and giving the error when it ended up at the document root.

like image 194
Chad Hedgcock Avatar answered Sep 21 '22 00:09

Chad Hedgcock