Skip to content

RFC: Drop isAttributeNameSafe() check #11667

Open
@gaearon

Description

@gaearon

We currently validate DOM attributes on the client and ignore the ones with invalid names:

if (!isAttributeNameSafe(name)) {
return;
}

This check used to be important for safety when we did innerHTML rendering on the client side, but it's not anymore. If we just let it call setAttribute, the browser would throw on a bad attribute name.

This check used to run very infrequently (only for data attributes and custom elements), but now more attributes follow this code path (since any "simple" attributes with the same names are effectively treated as unknown attributes). So even though we cache the result, it seems unfortunate to do the work that the browser is already doing for us.

While this would be a breaking change (so it has to go in 17), I think we should just remove this check, and let the browser throw. This does make spreading props blindly a bit more dangerous, but we have a warning so it should be visible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions