drawImage() fails silently when drawing an SVG image without @width or @height
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: spam, Unassigned)
References
Details
The default size of an <img> element is 0x0, so drawing an SVG image should be the same as drawing any other 0x0 image, due to it scaling down to 0x0. Idealy, the minimum dimensions of the SVG should be used, but roc has explained to me that this is not feasible to implement.
update: I'm on firefox 120.0.1 640bit on arch linux and it still happening with svg images.
Reporter | ||
Comment 1•1 year ago
|
||
this code from within a web compent doesn't recognize svg dimensions properly:
const images = this.shadowRoot.querySelectorAll(".sites img");
for (var i = 0; i < images.length; i++) {
const img = images[i];
if (img.naturalWidth === img.naturalHeight) {
img.classList.add("square");
}
}
Please provide a complete test case that reproduces this problem. I believe bug 700533 was meant to fix this.
Comment 3•1 year ago
|
||
Just a reminder, please provide a complete testcase (or a link to a live site) that demonstrates the bug; otherwise we can't do much here and we'll have to close this as "incomplete".
(I'll also note that comment 0 here seems to have been just a copypaste of the contents of bug 700533 comment 0 - in the future, please don't just copypaste bug comments from other bugs since that's quite confusing. You can link them or reference them or quote them, but just copypasting without attribution or reference to the original comment is quite weird and confusing. [as an example, you copypasted "roc has explained to me ..."
in comment 0 here, which is almost certainly not describing a real conversation that you personally had with roc])
Comment 4•1 year ago
|
||
Happy to consider reopening if you provide the necessary information.
Description
•