【问题标题】:Normalise style attribute in javascript规范化javascript中的样式属性
【发布时间】:2023-03-09 09:40:01
【问题描述】:

在 IE11 中当我们block.getAttribute('style') 我们返回

border-bottom-width: 1pt; border-bottom-style: dotted; border-bottom-color: rgb(10, 49, 132)

但在 chrome 中它返回 border-bottom: 1pt dotted rgb(10, 49, 132)

如何让 IE11 返回与 chrome 相同的内容?

【问题讨论】:

  • 能否提供a minimal code snippet 可以重现问题?请提供相关的html 和css 代码,并说明您想要获取哪个元素的样式。这样我们就可以进行测试,看看如何提供帮助。我们不知道您的代码中block 的含义以及代码中的实际样式是什么样的。

标签: javascript google-chrome selenium-webdriver internet-explorer-11 wdio-v5


【解决方案1】:

我认为这是在 IE11 中

block.style.border-button

因为只有信息“边框按钮”

【讨论】:

    【解决方案2】:

    两种浏览器都有不同的页面元素默认样式。在 Chrome 中使用此默认值:https://gist.github.com/ambidexterich/34828a904dd97dd2a345

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-20
      • 2014-02-08
      • 2013-03-02
      • 2014-01-13
      • 2019-07-07
      • 2017-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多