Skip to content

Commit a5466fe

Browse files
authored
Merge pull request #492 from scala-js/issue/489
Fix #489 Add CSS.supports
2 parents c9f60ce + abd7c2e commit a5466fe

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

api-reports/2_12.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ css[SO] type RuleList = raw.CSSRuleList
217217
css[SO] type StyleDeclaration = raw.CSSStyleDeclaration
218218
css[SO] type StyleRule = raw.CSSStyleRule
219219
css[SO] type StyleSheet = raw.CSSStyleSheet
220+
css[SO] def CSS = raw.CSS
220221
css[SO] def Rule = raw.CSSRule
221222
experimental/AbortController[JC] def abort(): Unit
222223
experimental/AbortController[JC] val signal: AbortSignal
@@ -2592,6 +2593,8 @@ raw/CDATASection[JC] def splitText(offset: Int): Text
25922593
raw/CDATASection[JC] def substringData(offset: Int, count: Int): String
25932594
raw/CDATASection[JC] var textContent: String
25942595
raw/CDATASection[JC] def wholeText: String
2596+
raw/CSS[JO] def supports(propertyName: String, value: String): Boolean
2597+
raw/CSS[JO] def supports(supportCondition: String): Boolean
25952598
raw/CSSFontFaceRule[JC] var CHARSET_RULE: Int
25962599
raw/CSSFontFaceRule[JC] var FONT_FACE_RULE: Int
25972600
raw/CSSFontFaceRule[JC] var IMPORT_RULE: Int

api-reports/2_13.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ css[SO] type RuleList = raw.CSSRuleList
217217
css[SO] type StyleDeclaration = raw.CSSStyleDeclaration
218218
css[SO] type StyleRule = raw.CSSStyleRule
219219
css[SO] type StyleSheet = raw.CSSStyleSheet
220+
css[SO] def CSS = raw.CSS
220221
css[SO] def Rule = raw.CSSRule
221222
experimental/AbortController[JC] def abort(): Unit
222223
experimental/AbortController[JC] val signal: AbortSignal
@@ -2592,6 +2593,8 @@ raw/CDATASection[JC] def splitText(offset: Int): Text
25922593
raw/CDATASection[JC] def substringData(offset: Int, count: Int): String
25932594
raw/CDATASection[JC] var textContent: String
25942595
raw/CDATASection[JC] def wholeText: String
2596+
raw/CSS[JO] def supports(propertyName: String, value: String): Boolean
2597+
raw/CSS[JO] def supports(supportCondition: String): Boolean
25952598
raw/CSSFontFaceRule[JC] var CHARSET_RULE: Int
25962599
raw/CSSFontFaceRule[JC] var FONT_FACE_RULE: Int
25972600
raw/CSSFontFaceRule[JC] var IMPORT_RULE: Int

src/main/scala/org/scalajs/dom/css.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package org.scalajs.dom
44
* Short aliases of all the dom.CSSThing classes
55
*/
66
object css {
7+
@inline def CSS = raw.CSS
78
type FontFaceRule = raw.CSSFontFaceRule
89
type ImportRule = raw.CSSImportRule
910
type KeyframeRule = raw.CSSKeyframeRule

src/main/scala/org/scalajs/dom/raw/Css.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ package org.scalajs.dom.raw
1212
import scala.scalajs.js
1313
import scala.scalajs.js.annotation._
1414

15+
@js.native
16+
@JSGlobal
17+
object CSS extends js.Object {
18+
19+
/**
20+
* The CSS.supports() method returns a boolean value indicating if the browser supports a given CSS feature, or not.
21+
* Allows to test the support of a pair property-value.
22+
*
23+
* MDN
24+
*/
25+
def supports(propertyName: String, value: String): Boolean = js.native
26+
27+
/**
28+
* The CSS.supports() method returns a boolean value indicating if the browser supports a given CSS feature, or not.
29+
* Takes one parameter matching the condition of @supports.
30+
*
31+
* MDN
32+
*/
33+
def supports(supportCondition: String): Boolean = js.native
34+
35+
}
36+
1537
/**
1638
* A CSSStyleDeclaration is an interface to the declaration block returned by the
1739
* style property of a cssRule in a stylesheet, when the rule is a CSSStyleRule.

0 commit comments

Comments
 (0)