The procedure to set CSSCounterStyleRule.name does not exclude invalid <custom-ident>:
On setting the name attribute, run the following steps:
- If the value is an ASCII case-insensitive match for "none" or one of the non-overridable counter-style names, do nothing and return.
- If the value is an ASCII case-insensitive match for any of the predefined counter styles, lowercase it.
- Replace the associated rule’s name with an identifier equal to the value.
I suggest:
On setting, the name attribute must replace its value by the result of parsing the given value against <counter-style-name> if this result is valid, otherwise it must not replace its value.