Intent to prototype: SVG discard element

83 views
Skip to first unread message

Robert Longson

unread,
Mar 28, 2023, 8:14:27 AM3/28/23
to dev-pl...@mozilla.org
Summary: The SVG discard element was originally introduced in SVG 1.2 tiny and carried forward into the SVG 2 specification. It is useful in non-scripted contexts such as images to reduce memory overhead once animation has finished. The discard element removes both the element it references and itself from the DOM once it is activated. In a scripted context it could be emulated by using a set element that triggers a script to remove elements from the DOM. There's an example questioning why it doesn't work here: https://stackoverflow.com/questions/63411964/svg-animation-discard-element

Bug: 1069931


Standards body: w3c

Platform coverage: All. This is part of the SVG specification that is exposed in all contexts.

Preference: given that it is a new element it will only affect content that contains that element. We're not expecting any backwards compatibility problems here.

DevTools: this element has no UI. It would need to be treated like any other SVG SMIL animation element.

Link to standards-positions discussion: Mozilla has committed to implementing and supporting the SVG specification and SMIL within that specification.

Other browsers: Chrome implemented support for discard but backed out that implementation when it discovered that the tests were flaky. I imagine they could be persuaded to land the patch again, particularly as our patch will include web platform tests that aren't flaky but that cover the same ground.
http://code.google.com/p/chromium/issues/detail?id=327339

web-platform-tests: there are tests in svg/idlharness.window.js and svg/styling/presentation-attributes-special-cases.html that we currently fail but we'll be landing more tests too.

Reply all
Reply to author
Forward
0 new messages