Skip to content

Commit

Permalink
Fix #489 Add CSS.supports
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Aug 15, 2021
1 parent e613d16 commit abd7c2e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ css[SO] type RuleList = raw.CSSRuleList
css[SO] type StyleDeclaration = raw.CSSStyleDeclaration
css[SO] type StyleRule = raw.CSSStyleRule
css[SO] type StyleSheet = raw.CSSStyleSheet
css[SO] def CSS = raw.CSS
css[SO] def Rule = raw.CSSRule
experimental/AbortController[JC] def abort(): Unit
experimental/AbortController[JC] val signal: AbortSignal
Expand Down Expand Up @@ -2460,6 +2461,8 @@ raw/CDATASection[JC] def splitText(offset: Int): Text
raw/CDATASection[JC] def substringData(offset: Int, count: Int): String
raw/CDATASection[JC] var textContent: String
raw/CDATASection[JC] def wholeText: String
raw/CSS[JO] def supports(propertyName: String, value: String): Boolean
raw/CSS[JO] def supports(supportCondition: String): Boolean
raw/CSSFontFaceRule[JC] var CHARSET_RULE: Int
raw/CSSFontFaceRule[JC] var FONT_FACE_RULE: Int
raw/CSSFontFaceRule[JC] var IMPORT_RULE: Int
Expand Down
3 changes: 3 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ css[SO] type RuleList = raw.CSSRuleList
css[SO] type StyleDeclaration = raw.CSSStyleDeclaration
css[SO] type StyleRule = raw.CSSStyleRule
css[SO] type StyleSheet = raw.CSSStyleSheet
css[SO] def CSS = raw.CSS
css[SO] def Rule = raw.CSSRule
experimental/AbortController[JC] def abort(): Unit
experimental/AbortController[JC] val signal: AbortSignal
Expand Down Expand Up @@ -2460,6 +2461,8 @@ raw/CDATASection[JC] def splitText(offset: Int): Text
raw/CDATASection[JC] def substringData(offset: Int, count: Int): String
raw/CDATASection[JC] var textContent: String
raw/CDATASection[JC] def wholeText: String
raw/CSS[JO] def supports(propertyName: String, value: String): Boolean
raw/CSS[JO] def supports(supportCondition: String): Boolean
raw/CSSFontFaceRule[JC] var CHARSET_RULE: Int
raw/CSSFontFaceRule[JC] var FONT_FACE_RULE: Int
raw/CSSFontFaceRule[JC] var IMPORT_RULE: Int
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/org/scalajs/dom/css.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package org.scalajs.dom
* Short aliases of all the dom.CSSThing classes
*/
object css {
@inline def CSS = raw.CSS
type FontFaceRule = raw.CSSFontFaceRule
type ImportRule = raw.CSSImportRule
type KeyframeRule = raw.CSSKeyframeRule
Expand Down
22 changes: 22 additions & 0 deletions src/main/scala/org/scalajs/dom/raw/Css.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ package org.scalajs.dom.raw
import scala.scalajs.js
import scala.scalajs.js.annotation._

@js.native
@JSGlobal
object CSS extends js.Object {

/**
* The CSS.supports() method returns a boolean value indicating if the browser supports a given CSS feature, or not.
* Allows to test the support of a pair property-value.
*
* MDN
*/
def supports(propertyName: String, value: String): Boolean = js.native

/**
* The CSS.supports() method returns a boolean value indicating if the browser supports a given CSS feature, or not.
* Takes one parameter matching the condition of @supports.
*
* MDN
*/
def supports(supportCondition: String): Boolean = js.native

}

/**
* A CSSStyleDeclaration is an interface to the declaration block returned by the
* style property of a cssRule in a stylesheet, when the rule is a CSSStyleRule.
Expand Down

0 comments on commit abd7c2e

Please sign in to comment.