草案
此页面不完整。
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
equals()
方法在
CSSNumericValue
interface returns a boolean indicating whether the passed value are strictly equal. To return a value of
true
, all passed values must be of the same type and value and must be in the same order. This allows structural equality to be tested quickly.
var boolean = CSSNumericValue.equals(number);
Number
或
CSSNumericValue
.
A
布尔
.
None.
As stated earlier, all passed values must be of the same type and value and must be in the same order. Some of the following examples illustrate what happens when they are not.
let cssMathSum = new CSSMathSum(CSS.px(1), CSS.px(2));
let matchingCssMathSum = new CSSMathSum(CSS.px(1), CSS.px(2));
// Prints true
console.log(cssMathSum.equals(matchingCssMathSum));
let otherCssMathSum = CSSMathSum(CSS.px(2), CSS.px(1));
// Prints false
console.log(cssMathSum.equals(otherCssMathSum));
// Also prints false
console.log(CSS.cm("1").equal(CSS.in("0.393701")));
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Typed OM Level 1
The definition of 'equals' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
等于
|
Chrome 66 | Edge 79 | Firefox No | IE No | Opera 53 | Safari No | WebView Android 66 | Chrome Android 66 | Firefox Android No | Opera Android 47 | Safari iOS No | Samsung Internet Android 9.0 |
完整支持
不支持
实验。期望将来行为有所改变。