D
David Mark
It was recently opined here that upgrading a complex, interdependent
script like jQuery (or whatever) was only an issue if calling apps
made use of the parts touched by the loosely organized "team" of
developers.
Unfortunately, when you first attempt to take the giant leap from
browser sniffing to feature detection (all at once and ten years
late), you end up with fingerprints all over everything.
I recently noticed a plug for jQuery's reenactment of that favorite of
browser scripting neophytes: calculating offset positions. For the
uninitiated, a cross-browser solution to calculate *absolute* offsets
(from the "origin" of the HTML element) is strictly an academic
exercise. Production apps are *never* designed to rely on such
problematic measurements.
Since the early part of the century, "solutions" involved two
branches, one for IE using the proprietary getBoundingClientRect
(recently adopted by FF and Opera) and a loop adding offsetLeft/Top
(plus clientLeft/Top) properties in everything else. Occasionally, a
third branch would use getBoxObjectFor (now deprecated) in Mozilla-
based browsers. In a few specific contexts, viable solutions are
possible. In a general sense, attempting to solve this "problem" at
all is madness.
As jQuery's old rendition of this classic used browser sniffing
exclusively, the version of the offset method in 1.3x has changed
radically. As would be expected, so has its behavior across the
handful of browsers supported by jQuery. Certainly this is part of
the reason that jQuery only supports browsers released in the last
couple of years.
A useful and pragmatic function would have been one that calculated
the offset from its nearest positioned parent. For example, the body:
http://groups.google.com/group/jquery-dev/browse_thread/thread/5107d8bf230a3721#
"Greetings, fellow developers!
First of all, I would like to thank you guys for putting in so much
time and effort on this amazing framework. This will be basically a
repost of another email I sent to jquery ui, along with a ticket
filled on their bug tracking system, regarding to the behaviour of one
of the widgets in the presence of a positioned body element."
Poor bastard.
"Just write your own function that uses jquery's return value and adds
in your calculations for your offset body.
Matt Kruse"
Sure, use a just-released version of an impossible absolute position
function then adjust to suit!
Two more studied opinions on the OP's dilemna:
"Regardless of jQuery support or not, I am the only one who thinks
positioning the body is kind of weird? what's between the body and the
viewport limits, limbo?"
Yes, silly. That's the part you *don't* want to measure.
"No, you're not the only one. I, too was wondering why someone would
need to position the body."
The OP tried to be sane and asked for help. He got one disinegenuous
detour from a fanboy and tittering from the resident technicians.
More futility on this front:
http://groups.google.com/group/jquery-dev/browse_thread/thread/8f258f8d9ef4a23f#
http://groups.google.com/group/jquery-dev/browse_thread/thread/6b8770d069db1872
http://www.nabble.com/bug-report:-j...-(works-fine-with-1.2.6)-p22889489s27240.html
At least one of those recommends transplanting the 1.2x absolute
position function into 1.3x. Abbie something?
So what will they invent to smooth out the differences between jQuery
versions?
script like jQuery (or whatever) was only an issue if calling apps
made use of the parts touched by the loosely organized "team" of
developers.
Unfortunately, when you first attempt to take the giant leap from
browser sniffing to feature detection (all at once and ten years
late), you end up with fingerprints all over everything.
I recently noticed a plug for jQuery's reenactment of that favorite of
browser scripting neophytes: calculating offset positions. For the
uninitiated, a cross-browser solution to calculate *absolute* offsets
(from the "origin" of the HTML element) is strictly an academic
exercise. Production apps are *never* designed to rely on such
problematic measurements.
Since the early part of the century, "solutions" involved two
branches, one for IE using the proprietary getBoundingClientRect
(recently adopted by FF and Opera) and a loop adding offsetLeft/Top
(plus clientLeft/Top) properties in everything else. Occasionally, a
third branch would use getBoxObjectFor (now deprecated) in Mozilla-
based browsers. In a few specific contexts, viable solutions are
possible. In a general sense, attempting to solve this "problem" at
all is madness.
As jQuery's old rendition of this classic used browser sniffing
exclusively, the version of the offset method in 1.3x has changed
radically. As would be expected, so has its behavior across the
handful of browsers supported by jQuery. Certainly this is part of
the reason that jQuery only supports browsers released in the last
couple of years.
A useful and pragmatic function would have been one that calculated
the offset from its nearest positioned parent. For example, the body:
http://groups.google.com/group/jquery-dev/browse_thread/thread/5107d8bf230a3721#
"Greetings, fellow developers!
First of all, I would like to thank you guys for putting in so much
time and effort on this amazing framework. This will be basically a
repost of another email I sent to jquery ui, along with a ticket
filled on their bug tracking system, regarding to the behaviour of one
of the widgets in the presence of a positioned body element."
Poor bastard.
"Just write your own function that uses jquery's return value and adds
in your calculations for your offset body.
Matt Kruse"
Sure, use a just-released version of an impossible absolute position
function then adjust to suit!
Two more studied opinions on the OP's dilemna:
"Regardless of jQuery support or not, I am the only one who thinks
positioning the body is kind of weird? what's between the body and the
viewport limits, limbo?"
Yes, silly. That's the part you *don't* want to measure.
"No, you're not the only one. I, too was wondering why someone would
need to position the body."
The OP tried to be sane and asked for help. He got one disinegenuous
detour from a fanboy and tittering from the resident technicians.
More futility on this front:
http://groups.google.com/group/jquery-dev/browse_thread/thread/8f258f8d9ef4a23f#
http://groups.google.com/group/jquery-dev/browse_thread/thread/6b8770d069db1872
http://www.nabble.com/bug-report:-j...-(works-fine-with-1.2.6)-p22889489s27240.html
At least one of those recommends transplanting the 1.2x absolute
position function into 1.3x. Abbie something?
So what will they invent to smooth out the differences between jQuery
versions?