@@ -676,24 +676,48 @@ partial namespace CSS {
676
676
<dt><code> supports(CSSOMString conditionText)</code> , returns <code> boolean</code>
677
677
<dd>
678
678
When the {{supports(property, value)}} method is invoked
679
- with two arguments <var> property</var> and <var> value</var> ,
680
- it must return <code> true</code> if <var> property</var> is a literal match for the name of a CSS property that the UA supports,
681
- and <var> value</var> would be successfully parsed as a supported value for that property.
682
- (Literal match means that no CSS escape processing is performed,
683
- and leading and trailing whitespace are not stripped,
684
- so any leading whitespace, trailing whitespace,
685
- or CSS escapes equivalent to the name of a property
686
- would cause the method to return <code> false</code> .)
687
- Otherwise, it must return <code> false</code> .
688
-
689
- When {{supports(conditionText)}} invoked with a single <var> conditionText</var> argument,
690
- it must return <code> true</code> if <var> conditionText</var> ,
691
- when either parsed and evaluated as a <<supports-condition>>
692
- or parsed as a <<declaration>> ,
693
- wrapped in implied parentheses,
694
- and evaluated as a <<supports-condition>> ,
695
- would return true.
696
- Otherwise, it must return <code> false</code> .
679
+ with two arguments <var> property</var> and <var> value</var> :
680
+
681
+ <div algorithm="supports(property, value)">
682
+ 1. If |property| is an [=ASCII case-insensitive=] match
683
+ for any defined CSS property that the UA supports,
684
+ and |value| successfully [=CSS/parses=] according to that property's grammar,
685
+ return <code> true</code> .
686
+ 2. Otherwise, if |property| is an exact match for the property name of any item
687
+ in the document's {{[[registeredPropertySet]]}} slot,
688
+ and the syntax of that item is not "*":
689
+
690
+ 1. If |value| successfully [=CSS/parses=] according to the syntax of that item,
691
+ return <code> true</code> .
692
+ 2. Otherwise, return <code> false</code> .
693
+ 3. Otherwise, if |property| is a [=custom property name string=] ,
694
+ return <code> true</code> .
695
+ 4. Otherwise, return <code> false</code> .
696
+
697
+ Note: No CSS escape or whitespace processing is performed on the property name,
698
+ so <code> CSS.supports(" width", "5px")</code> will return <code> false</code> ,
699
+ as " width" isn't the name of any property due to the leading space.
700
+
701
+ Note: This version of the method will verify the grammar of registered custom properties,
702
+ but the other version will not.
703
+ </div>
704
+
705
+ When the {{supports(conditionText)}} method is invoked
706
+ with a single <var> conditionText</var> argument:
707
+
708
+ <div algorithm="supports(conditionText)">
709
+ 1. If |conditionText|,
710
+ [=CSS/parsed=] and evaluated as a <<supports-condition>> ,
711
+ would return true,
712
+ return <code> true</code> .
713
+ 2. Otherwise,
714
+ If |conditionText|,
715
+ wrapped in parentheses
716
+ and then [=CSS/parsed=] and evaluated as a <<supports-condition>> ,
717
+ would return true,
718
+ return <code> true</code> .
719
+ 3. Otherwise, return <code> false</code> .
720
+ </div>
697
721
</dl>
698
722
699
723
<h2 class=no-num id=priv-sec>Privacy and Security Considerations</h2>
0 commit comments