zoukankan      html  css  js  c++  java
  • 使用新的CSS类型对象模型

    el.attributeStyleMap.set('padding', CSS.px(42));
    const padding = el.attributeStyleMap.get('padding');
    console.log(padding.value, padding.unit); // 42, 'px'
    
    // Element styles.
    el.attributeStyleMap.set('opacity', 0.3);
    typeof el.attributeStyleMap.get('opacity').value === 'number' // Yay, a number!
    
    // Stylesheet rules.
    const stylesheet = document.styleSheets[0];
    stylesheet.cssRules[0].styleMap.set('background', 'blue');
    
    // All 3 of these are equivalent:
    el.attributeStyleMap.set('opacity', 0.3);
    el.attributeStyleMap.set('opacity', '0.3');
    el.attributeStyleMap.set('opacity', CSS.number(0.3)); // see next section
    // el.attributeStyleMap.get('opacity').value === 0.3
    
    // StylePropertyMaps are iterable.
    for (const [prop, val] of el.attributeStyleMap) {
      console.log(prop, val.value);
    }
    // → opacity, 0.3
    
    el.attributeStyleMap.has('opacity') // true
    
    el.attributeStyleMap.delete('opacity') // remove opacity.
    
    el.attributeStyleMap.clear(); // remove all styles.
    
    if (window.CSS && CSS.number) {
      // Supports CSS Typed OM.
    }
    
  • 相关阅读:
    zabbix_agent 主动模式配置
    zabbix 监控ipmi
    超级详细全截图化VMware 安装ubantu
    docker 部署
    C# DataTable和List转换操作类
    C#类型转换工具类
    C# 注册windows 服务
    C# wsdl.exe 生成类文件
    visual studio code download url
    c# xml序列化和反序列化
  • 原文地址:https://www.cnblogs.com/linr/p/8657310.html
Copyright © 2011-2022 走看看