English 中文(简体)
外国侨民的返回应如何 目标X 载于SVG的超文本元素?
原标题:What should getBoundingClientRect() return for foreignObject XHTML elements embedded in SVG?

考虑一份特殊群体文件,如此......

<svg viewBox="0 0 200 200" width="100%" height="100%" …>
  <g transform="rotate(45) skewX(10)">
    <foreignObject x="100" y="200" width="10" …>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p id="foo">Hi Mom!</p>
      </body>
    </foreignObject>
  </g>
</svg>

......

console.log( document.getElementById( foo ).getBoundingClientRect() );

通知:

  • The body of the HTML document is offset in the SVG, and rotated, and skewed.
  • The SVG is scaled so that 1 SVG unit is not the same as 1 screen pixel.

是否应在网上浏览器中将屏幕配对的束缚线左侧/右边/上下层/下游接回getBoundingClientRect(?

Or should it return the coordinates of the object within the context of the body, and leave it up to the user to transform from the foreignObject space into the screen pixels for the scaled/rotated/skewed SVG?

I m not so much interested in your opinion of how this should behave as a clear interpretation of how the specifications involved dictate that this shall behave.

下面是这方面的一个简单例子,显示“ Chrome”与“ Firefox”一样,后者:

http://bugs.webkit.org/show_bug.cgi?id=71819“rel=”nofollow。

最佳回答

如Boris Zbarsky在my (incorrect) bug report,。 缩略语:

…and the specification elsewhere explicitly defines viewport as:

[...] defined by CSS 2.1 unless there is an ancestor foreignObject element in the http://www.w3.org/2000/svg namespace in which case that element acts as viewport and initial containing block.

In summary, getBoundingClientRect() called on an HTML element inside a <foreignObject> in an <svg> element should return the bounding box of the element within the viewport specifically for the HTML body; it is up to the scripter to transform from this into screen space, if desired.

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签