Open GoogleCodeExporter opened 8 years ago
What I see is the argument passed to goog.style.getBoundingClientRect_ is a
document, not an element. Does it help debugging the issue?
Does the same error happen if the code isn't compiled?
Original comment by pall...@gmail.com
on 25 Oct 2010 at 12:55
Unfortunately I cannot reproduce the error in compiled or uncompiled mode.
This is just what I'm getting periodically via an auto-report mechanism on my
script.
From the stacktrace above you can see that I call goog.style.getClientPosition
with an anchor element. So the bug must be with 'goog.style.getClientPosition'
which then calls goog.style.getBoundingClientRect_ with the document element.
Original comment by guido.tapia@gmail.com
on 26 Oct 2010 at 3:13
The first few lines of goog.style.getClientPosition:
goog.style.getClientPosition = function(el) {
var pos = new goog.math.Coordinate;
if (el.nodeType == goog.dom.NodeType.ELEMENT) {
if (el.getBoundingClientRect) { // IE and Gecko 1.9+
var box = goog.style.getBoundingClientRect_(/** @type {Element} */ (el));
According to this code it is impossible that the 'el' argument becomes a
document before getBoundingClientRect_ is called.
If it is indeed replaced with a document, the replacement must be done outside
Closure.
I'm marking this as WontFix until someone can reproduce the bug.
Original comment by pall...@google.com
on 26 Oct 2010 at 9:23
I found the issue. If an element becomes detached from its parent and then u
call goog.style.getClientPosition then this problem occurs (only in IE) other
browsers return {0, 0}. I have implemented a fix (patch attached) that I think
is performant but please review carefully as my knowledge of DOM and quirks in
different browsers is not great.
Thanks
Guido Tapia
Original comment by guido.tapia@gmail.com
on 31 Oct 2010 at 11:26
Attachments:
Thanks for the investigation, I reopened the bug.
Original comment by pall...@google.com
on 1 Nov 2010 at 1:48
Original comment by nn...@google.com
on 27 Apr 2012 at 9:53
Original issue reported on code.google.com by
guido.tapia@gmail.com
on 24 Oct 2010 at 8:40