get offsetTop on SVG element

时间:2017-08-30 20:55:27

标签: javascript svg

Why is UIButton returning UIButton on this SVG element?

%%=HTTPPost2(@url,'application/json', @Json, true, @output,@respheader, 'client_id', 'CLient_ID_Here', 'client_secret',
offsetTop

1 个答案:

答案 0 :(得分:1)

The inheritance tree for DOM elements has Element as a base class with SVGElement and HTMLElement deriving separately from that. offsetTop is defined on the HTMLElement interface and not on the Element interface so SVG elements don't support it.

You could get this information by calling element.getBoundingClientRect() instead. This would work for all elements.