Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cssom] Accessing the DOM of images #1568

Open
SebastianZ opened this issue Jun 27, 2017 · 3 comments
Open

[cssom] Accessing the DOM of images #1568

SebastianZ opened this issue Jun 27, 2017 · 3 comments
Labels
cssom-1 Current Work

Comments

@SebastianZ
Copy link
Contributor

Moved from https://lists.w3.org/Archives/Public/www-style/2017Jun/0029.html, posted by Henrik Andersson.

One thing I've realized is that css allows for the use of SVG images.
And those have a DOM of their own. It'd be interesting if it was
possible to access the DOM of the image in javascript. The user agent
already needs to have it anyway.

@SebastianZ
Copy link
Contributor Author

On 25 June 2017 at 23:20, Henrik Andersson henke@henke37.cjb.net wrote:

One thing I've realized is that css allows for the use of SVG images.
And those have a DOM of their own.

I'm not an implementer, but I assume that currently SVGs integrated into a page via CSS don't have a DOM.

It'd be interesting if it was possible to access the DOM of the image in javascript. The user agent
already needs to have it anyway.

Note that you can already access the DOM of SVGs by integrating the SVG code directly in the HTML.
It might make sense to be able to access the SVG's DOM when it's integrated via CSS to allow to change it dynamically, though based on the assumption above I assume it would have some impact on speed and memory if a DOM needs to be created for them.

Sebastian

@upsuper
Copy link
Member

upsuper commented Jun 28, 2017

I'm not an implementer, but I assume that currently SVGs integrated into a page via CSS don't have a DOM.

IIUC, engines need to create document, as well as DOM stuff, for SVG-as-image.

Although browsers already create that, it may still impact speed and memory depending on how it would behave. For example, if there are multiple image referring the same SVG file, would mutating one changes others? Either true or false, there could be lots of things to do if an engine tries to reuse one document everywhere.

@svgeesus
Copy link
Contributor

SVGs do have a DOM. Depending on how the SVG is included in other content, that DOM may or may not be available. See the definitions for 'secure animated mode' and 'secure static mode':
https://www.w3.org/TR/SVG2/conform.html#processing-modes

@fantasai fantasai changed the title [css-backgrounds][css-images][cssom] Accessing the DOM of images [cssom] Accessing the DOM of images Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cssom-1 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants