Skip to content

Fix #489 Add CSS.supports #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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