Intent to Remove: SVGElement.offsetParent/offsetTop/offsetLeft/offsetWidth/offsetHeight

2,631 vistas
Ir al primer mensaje no leído

Philip Jägenstedt

no leída,
22 feb 2016, 10:24:52 p.m.22/2/16
para blink-dev

Primary eng (and PM) emails

phi...@opera.com


Link to “Intent to Deprecate” thread

https://groups.google.com/a/chromium.org/d/msg/blink-dev/JlAEmQpWMWA/63acYbmdDwAJ


Summary

Remove the attributes offsetParent, offsetTop, offsetLeft, offsetWidth and offsetHeight on SVGElement. These have been deprecated in M48-49, with the deprecation message saying that it will be gone in M50.


Motivation

In Gecko and Edge, these attributes are only supported on HTMLElement. AFAIK, they were never spec'd for Element generally or SVGElement specifically.


Compatibility Risk

There was some pushback on the Intent to Deprecate, based on https://github.com/jquery/jquery/issues/2895. jQuery does not try to support SVG, and the issue was eventually closed. 


AFAICT, people have triggered the deprecation messages by using jQuery's custom :visible/:hidden selectors and position().


For :visible/:hidden, the issue has been fixed in jQuery 2.2.0, and if upgrading isn't feasible then simply overwriting with the new definitions after loading jQuery should work:

jQuery.expr.filters.hidden = function( elem ) {
  return !jQuery.expr.filters.visible( elem );
};
jQuery.expr.filters.visible = function( elem ) {
  return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
};


The position() method uses a custom offsetParent() internally, which in turn depends on offsetParent. https://jsfiddle.net/3ktj99m4/4/ illustrates the difference:

Blink/WebKit:
offsetParent(): div
position(): {"top":20,"left":20}


Edge:
offsetParent(): html
position(): {"top":29.5,"left":29.5}


Gecko:
offsetParent(): html
position(): {"top":30,"left":30}


After the change Blink will match Gecko. The "simple" advice here is to do whatever currently works in Edge/Gecko. These jQuery APIs are essentially wrappers for the removed APIs, so trying to polyfill the old behavior does not sound like a good idea.


Nevertheless, one can get the position of an element relative to another by calling getBoundingClientRect() on both and calculating the difference. offsetParent can also be faked to some degree. https://jsfiddle.net/3ktj99m4/6/ sketches these ideas, but this kind of approach ought to be a last resort.


Usage information from UseCounter


OWP launch tracking bug

https://crbug.com/463116


Entry on the feature dashboard

https://www.chromestatus.com/features/5724912467574784


Rick Byers

no leída,
23 feb 2016, 11:30:42 a.m.23/2/16
para Philip Jägenstedt,blink-dev
I'm a little worried about the compat risk here, but the fact that Edge (with a WebKit UA string) already successfully has this behavior mitigates the risk substantially.  

LGTM1 to remove.


Dimitri Glazkov

no leída,
23 feb 2016, 11:31:08 a.m.23/2/16
para Rick Byers,Philip Jägenstedt,blink-dev
LGTM2.

:DG<

Chris Harrelson

no leída,
23 feb 2016, 12:07:00 p.m.23/2/16
para Dimitri Glazkov,Rick Byers,Philip Jägenstedt,blink-dev
LGTM3

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

tapio.ha...@gmail.com

no leída,
24 abr 2016, 8:45:40 a.m.24/4/16
para blink-dev

Philip Jägenstedt

no leída,
25 abr 2016, 5:46:30 a.m.25/4/16
para Chris Harrelson,Dimitri Glazkov,Rick Byers,blink-dev
There was some fallout from this, with a broken SVG graph on six-swiss-exchange.com. That was also broken in Edge (see screenshot in comment) and would probably also be fixed by using a newer version of dojo, so I closed the issue as WontFix. Given enough breakage of this sort we should reconsider, so if anybody sees more of it, please poke issue 463116 or this thread.

oro.ja...@gmail.com

no leída,
21 jun 2016, 11:09:04 a.m.21/6/16
para blink-dev

oro.ja...@gmail.com

no leída,
21 jun 2016, 11:21:23 a.m.21/6/16
para blink-dev

Implementation Status

Enabled by default in desktop Chrome 52 (launch bug)

Available in Chrome for Android release 52.

Available in Android WebView release 52.

Consensus & Standardization

  • In development
  • No public signals
  • Shipped in release 39
  • Shipped in release 39
  • No public signals
  • No signals

Owners

Last updated on 2016-05-31


On Tuesday, 23 February 2016 11:24:52 UTC+8, Philip Jägenstedt wrote:

PhistucK

no leída,
21 jun 2016, 12:11:36 p.m.21/6/16
para oro.ja...@gmail.com,blink-dev
Stop spamming the group.


PhistucK

naveenbro...@gmail.com

no leída,
14 jul 2016, 6:32:08 a.m.14/7/16
para blink-dev
Se borró el mensaje

wadood...@gmail.com

no leída,
27 ago 2016, 3:29:27 p.m.27/8/16
para blink-dev,phi...@opera.com
when i open Facebook .automatically closed and aw loop option come.

wadood...@gmail.com

no leída,
27 ago 2016, 3:30:36 p.m.27/8/16
para blink-dev,phi...@opera.com
when i open facebook .automatically closed .aw loop option come.


On Monday, February 22, 2016 at 7:24:52 PM UTC-8, Philip Jägenstedt wrote:

PhistucK

no leída,
27 ago 2016, 3:51:25 p.m.27/8/16
para wadood...@gmail.com,blink-dev,Philip Jägenstedt
This is completely off topic. Use the product forums instead.


PhistucK

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

madr...@orange.fr

no leída,
13 mar 2017, 2:02:43 p.m.13/3/17
para blink-dev,phi...@opera.com

vivosmar...@gmail.com

no leída,
22 mar 2017, 4:47:34 a.m.22/3/17
para blink-dev,phi...@opera.com
เมื่อ วันอังคารที่ 23 กุมภาพันธ์ ค.ศ. 2016 10 นาฬิกา 24 นาที 52 วินาที UTC+7, Philip Jägenstedt เขียนว่า:

lordo...@gmail.com

no leída,
23 mar 2020, 2:33:24 p.m.23/3/20
para blink-dev
Remove. I am not interested
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos