whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
7.85k stars 2.57k forks source link

Elements with invalid filters #10455

Closed shallawa closed 1 day ago

shallawa commented 2 days ago

What is the issue with the HTML Standard?

What should happen if an invalid filter is applied to an element?

  1. Should the element be rendered without any filter?
  2. Should the rendering of the element be omitted entirely?
  3. Should the invalid filter be corrected so the element with a valid filter be displayed?

The browsers disagree with displaying this test case:

<style>
    svg {
        border: 1px red solid;
        width: 400px;
        height: 300px;
    }
    .box {
        width: 200px;
        height: 200px;
        background-color: green;
        margin: 20px;
    }
    .filtered-1 {
        filter: drop-shadow(10px 10px -4px #4444dd);
    }
    .filtered-2 {
        filter: url(#shadow);
    }
</style>
<body>
    <p>A div element with invalid CSS filter:</p>
    <div class="box filtered-1"></div>
    <p>A div element with invalid referenced SVG filter:</p>
    <div class="box filtered-2"></div>
    <p>A rect element with invalid SVG filter:</p>
    <svg>
        <filter id="shadow">
            <feDropShadow dx="10" dy="10" stdDeviation="-4" flood-color="#4444dd" />
        </filter>
        <rect width="200" height="200" style="fill:green; filter:url(#shadow);" />
    </svg>
</body>
  1. Safari does not display any SVG element with invalid SVG filter
  2. Chrome seems to correct the SVG filter and is able to display any element that references this SVG filter
  3. FireFox does no display any element with invalid SVG filters
shallawa commented 2 days ago

See https://bugs.webkit.org/show_bug.cgi?id=275843

annevk commented 2 days ago

Hey, this should probably be filed against https://github.com/w3c/fxtf-drafts/labels/filter-effects-1 instead. https://github.com/w3c/fxtf-drafts/issues/237#issuecomment-354621234 seems to discuss a subset of this issue.

shallawa commented 1 day ago

As @annevk suggested, I filed https://github.com/w3c/fxtf-drafts/issues/564.