Open joyously opened 6 years ago
We can't do anything for the first one (since -prefix-free only adds a prefix, doesn't rewrite), but would accept PRs for the others :)
Wouldn't changing stretch
to -moz-available
be a rewrite also?
And it looked to me like the selectors are set up to handle changes, like placeholder
does.
Yeah, I guess we have deviated from the original premise :) No strong opinions there, if you can implement it in a sane way, I'd merge it.
I was looking in to how to add :matches
and :is
, but this code seems to be doing something odd.
for(var selector in selectors) {
var standard = selectors[selector] || selector
var prefixed = selector.replace(/::?/, function($0) { return $0 + self.prefix })
if(!supported(standard) && supported(prefixed)) {
self.selectors.push(standard);
self.selectorMap[standard] = prefixed;
}
}
It gets the standardized selector and checks if that is supported instead of checking if the non-standard one is supported. So if the stylesheet has :input-placeholder
it remains untouched since it checked for ::placeholder
being supported. Is this the intended logic? Is this supposed to leave an unsupported style alone, in case it is followed by the supported one? Or should the selector being saved be the actual selector that is prefixed, not the standardized one?
Would this make more sense?
for(var selector in selectors) {
var standard = selectors[selector] || selector
var prefixed = selector.replace(/::?/, function($0) { return $0 + self.prefix })
if(!supported(standard) && supported(prefixed)) {
self.selectors.push(selector);
self.selectorMap[selector] = prefixed;
}
}
I think I'm understanding this better now. I got onto a tangent trying to do :matches
since it is a rewrite, so was looking at the others that way. Sorry!
But, leaving the original code alone, doesn't the list of selectors hold the one that should be used to build the prefix, and the standard to check for? So maybe it's a different issue, but I'm thinking the list should look more like this
'::placeholder': null,
':placeholder': ':placeholder-shown',
'::input-placeholder': '::placeholder',
':input-placeholder': ':placeholder-shown',
I started typing this and forgot... So I opened a different issue (#6143) for the :placeholder-shown
problem. If it's merged before the others that add to that list it won't interfere.
Looking through the tables at http://www.caniuse.com/#cats=CSS, I see these 3 things:
:matches
selector was:any
, can be:-webkit-any
or:-moz-any
stretch
keyword can be-webkit-stretch
or-moz-available
sticky
keyword forposition
is not in the list of keywords