This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17844 - Spec img.x/y
Summary: Spec img.x/y
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM View (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 07:01 UTC by contributor
Modified: 2014-07-30 08:40 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:01:32 UTC
This was was cloned from bug 16842 as part of operation convergence.
Originally filed: 2012-04-24 18:12:00 +0000
Original reporter: Ms2ger <Ms2ger@gmail.com>

================================================================================
 #0   Ms2ger                                          2012-04-24 18:12:56 +0000 
--------------------------------------------------------------------------------
I tried removing those attributes from Gecko, but failed. See
https://bugzilla.mozilla.org/show_bug.cgi?id=587021
https://bugzilla.mozilla.org/show_bug.cgi?id=731832
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-08-23 21:57:43 UTC
...what do they do?
Comment 2 Ian 'Hixie' Hickson 2012-08-23 21:58:55 UTC
(Maybe this should just be in CSSOM?)
Comment 3 Ian 'Hixie' Hickson 2012-10-29 23:48:49 UTC
ms2ger: ping
Comment 4 Ms2ger 2012-10-30 07:52:31 UTC
Looks like the position relative to the nearest positioned ancestor, in CSS pixels (in Gecko).
Comment 5 Ian 'Hixie' Hickson 2012-10-31 19:58:31 UTC
Glenn, do you agree that this belongs more in CSSOM than in HTML?
Comment 6 Glenn Adams 2012-10-31 21:41:41 UTC
(In reply to comment #5)
> Glenn, do you agree that this belongs more in CSSOM than in HTML?

The greater question for me is whether it should be in either HTML or CSSOM... Is this is basically shorthand for HTMLImageElement.style.{top,left}?
Comment 7 Ian 'Hixie' Hickson 2012-10-31 22:44:16 UTC
I didn't understand your last comment.
Comment 8 Glenn Adams 2012-11-01 09:10:40 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Glenn, do you agree that this belongs more in CSSOM than in HTML?
> 
> The greater question for me is whether it should be in either HTML or
> CSSOM...

I'm asking why we should standardize this extension when it appears to be superfluous (with offset{Left,Top} -- see below).

> Is this is basically shorthand for HTMLImageElement.style.{top,left}?

I had meant getComputedStyle(img).{left,top}, but I see that HTMLElement.offset{Left,Top} seems to be the correct mapping, at least according to [1][2].

[1] http://hg.csswg.org/test/raw-file/tip/contributors/gadams/incoming/cssom-view/htmlimagelement-equivalence-xy-absolute.xht

[2] http://hg.csswg.org/test/raw-file/tip/contributors/gadams/incoming/cssom-view/htmlimagelement-equivalence-xy-static.xht
Comment 9 Ms2ger 2012-11-01 10:39:11 UTC
Did you read the bug? These attributes are required for web compatibility.
Comment 10 Glenn Adams 2012-11-01 10:48:33 UTC
(In reply to comment #9)
> Did you read the bug? These attributes are required for web compatibility.

yes I did; the mere existence of such usage does not mean these properties should be standardized, particularly when there appears to be an existing standard defined mechanism that already supports this function (unless offset{Left,Top} are somehow different behaviorally speaking)

also, though I did test WK/OP/FF, i haven't checked IE to see if they are supported there; [FF also failed two tests]

p.s. i suppose it would be possible to document x/y as obsoleted non-conforming features, such as is done in [1]; if this were done, then my preference would be to specify in HTML spec, and refer there to the normative CSSOM View properties (offset{Left,Top}).

[1] http://dev.w3.org/html5/spec/single-page.html#non-conforming-features
Comment 11 Ian 'Hixie' Hickson 2012-11-01 22:29:51 UTC
Ms2ger: Are they in fact exactly equivalent to offsetLeft/offsetTop?
Comment 12 Ms2ger 2012-11-02 08:14:37 UTC
The implementations aren't trivially equivalent, at least not to my untrained eyes.
Comment 13 Glenn Adams 2012-11-02 08:32:59 UTC
(In reply to comment #12)
> The implementations aren't trivially equivalent, at least not to my
> untrained eyes.

to show they are different, we need a test that shows a difference in actual values, independent of the implementation; if they are different, that may be a bug as opposed to the intended behavior

at first order, at least testing on 3 engines, they appear to be the same for both static and absolute positioned images
Comment 14 Ian 'Hixie' Hickson 2012-11-02 21:17:14 UTC
Ms2ger: Do you have a test showing how they're different?

If they're the same, then it makes sense to define them in the "obsolete APIs" part of the HTML spec, deferring to the equivalents in CSSOM.
Comment 15 Ms2ger 2013-03-22 18:38:16 UTC
I know nothing about their implementation.
Comment 16 Robert O'Callahan (Mozilla) 2013-03-23 06:00:48 UTC
I don't really know this code but the implementation looks like x/y are the offset of the <img> border-box top-left to the top-left of the border-box of the nearest ancestor (excluding the <img>) that's positioned or not overflow:visible, ignoring transforms.

(In reply to comment #10)
> yes I did; the mere existence of such usage does not mean these properties
> should be standardized

It does, actually, unless we can find a way to eliminate the usage or treat it as insignificant.
Comment 17 Ms2ger 2013-06-27 11:59:09 UTC
And we accidentally removed them in Fx 20-21, and people started to rely on that too:

https://bugzilla.mozilla.org/show_bug.cgi?id=887660
Comment 18 Ian 'Hixie' Hickson 2013-10-23 20:42:44 UTC
Comment 16 suggests this should be a CSSOM issue. zcorpan, do you want to take this, or if not, can you provide me with a hook to define this?
Comment 19 Simon Pieters 2013-10-24 14:51:33 UTC
https://dvcs.w3.org/hg/csswg/rev/a65682fccc9b

In Blink it appears to always be relative to the initial containing block, position and overflow on ancestors doesn't matter. This seems simpler, so unless Gecko's behavior better matches what Web content expects I think simpler wins. (In Presto position matters but overflow doesn't. IE10 doesn't support x/y.)
Comment 20 Philip Jägenstedt 2014-07-30 08:40:36 UTC
There's an ongoing blink-dev thread about HTMLImageElement.x/y:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/zpLuYu8tmdA/uA_7TQSQDzQJ