Re: [csswg-drafts] [all] Can we start ignoring CSSRule.type? (#4142)

The CSS Working Group just discussed `Can we start ignoring CSSRule.type?`, and agreed to the following:

* `RESOLVED: Do not use .type in the future`
* `RESOLVED: Don't invent new .type values for future rules; recommend usage of .constructor.name`

<details><summary>The full IRC log of that discussion</summary>
&lt;dael> Topic: Can we start ignoring CSSRule.type?<br>
&lt;dael> github: https://github.com/w3c/csswg-drafts/issues/4142<br>
&lt;dael> TabAtkins: Was defining @property rule. I remembered we have to register .type on the wiki page. It's a terrible pattern from the 90s. We just do strings now. Does anyone find it valuable to make the change? We deprecate .type and all new CSS rules us a placeholder value. Add a new property that exposes name of rule as a string<br>
&lt;fremy> +1<br>
&lt;dbaron> sounds like a good plan<br>
&lt;dael> TabAtkins: That's how other things work. SVG now works like this. It's easier to work with.<br>
&lt;fantasai> maybe .typeName<br>
&lt;fantasai> ?<br>
&lt;dael> TabAtkins: Objections? Anyone feel it's worthwhile to do or not and we live with current system?<br>
&lt;dael> emilio: Usually when I do CSSOM stuff I do instance of rather then checking .type. Is new prop really necessary?<br>
&lt;AmeliaBR> .constructor.name works<br>
&lt;dael> fremy: If you go across iFrames it doesn't work. Have to get constructor constrained to a string<br>
&lt;dael> TabAtkins: True<br>
&lt;dael> TabAtkins: Mostly this is just terrible smell and have to keep doing it for new rule types. Would like to stop. If we're okay with instance of and iFrames are awk. I'm okay with just saying we stop using /type and future rules get a placeholder<br>
&lt;astearns> +1 to stop using .type<br>
&lt;dael> emilio: No strong opinion. I'm happy with string API. fremy point is nice<br>
&lt;dael> fantasai: No obj to adding, but do we want everythign else to have same type or maintain pattern going forward and enoughrage string<br>
&lt;dael> TabAtkins: Biggest encouragement is make int not work<br>
&lt;dael> AmeliaBR: Do we have use counter on how often .type are being accessed?<br>
&lt;dael> TabAtkins: No. pretty certain it's non-0. Removing .type isn't needed, just leave as is as a fossil<br>
&lt;dael> AmeliaBR: I support doing what we did with SVG where new things get unknown enum and you have to figure it out with some other way. Knowing how much current enums are used we'd know how many people would lose going forward.<br>
&lt;dael> TabAtkins: They can switch for new values<br>
&lt;dael> myles: Can't you use object.constructor.name and get a string?<br>
&lt;dael> fremy: True. But then you need class for each thing you create<br>
&lt;dael> TabAtkins: We don't right now. Weird thing HTML does. We use a fresh class for new rules<br>
&lt;dael> fremy: Reasonable to me. That works for everybody. Create unknown and stop increment the counter<br>
&lt;dael> myles: RIght now all css rules have own subclasses. WOuld work.<br>
&lt;dael> TabAtkins: Okay with that. Works across iFrames. Would let us drop to tombstone .type and not use in the future<br>
&lt;dael> TabAtkins: Let's ask for resolution on that<br>
&lt;dael> Rossen_: Objections?<br>
&lt;dael> RESOLVED: Do not use .type in the future<br>
&lt;dael> myles: Should resolution say use?<br>
&lt;dael> TabAtkins: I'll clarify in the issue<br>
&lt;astearns> s/in the future/in future specifications<br>
&lt;dael> fantasai: Let's retype the resolution TabAtkins<br>
&lt;TabAtkins> RESOLVED: Don't invent new .type values for future rules; recommend usage of .constructor.name<br>
&lt;dael> AmeliaBR: Do we want to get more specific and say that any rule type that doesn't yet have a declared type value should return 0 which is the unknown rule from DOM2?<br>
&lt;dael> AmeliaBR: And with that are there any specs that declare a value and haven't been impl? Should they be included?<br>
&lt;dael> TabAtkins: The only recent one is feature values. I'm fine with it staying how it is. I don't think any new @rules other then @property<br>
&lt;dael> fantasai: Might be in future<br>
&lt;dael> TabAtkins: Yeah, but this ask was about new @rules in specs that could be changes to match resolution<br>
&lt;dael> TabAtkins: We'll find them<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4142#issuecomment-516931967 using your GitHub account

Received on Wednesday, 31 July 2019 16:54:01 UTC