javascript - Modinizer 测试颜色输入类型是否可用

标签 javascript

在我们的应用程序中,我们有几个 html5 颜色输入,用户可以在其中选择背景颜色等。我刚刚在 ie 中进行测试,发现颜色选择器不想工作并且不受支持。

为了解决这个问题,我找到了一个垫片并将其插入 Modinizer。但是我似乎无法弄清楚如何在负载中测试它,并且无法真正找到任何示例。

我的代码如下所示

 {
  test: //window.Color ??,
  nope: ['spectrum.js', 'spectrum.css']
}

最佳答案

在modernizr网站上它是clearly stated那个

HTML5 introduces thirteen new values for the 's type attribute. They are as follows: search, tel, url, email, datetime, date, month, week, time, datetime-local, number, range, color. These types can enable native datepickers, colorpickers, URL validation, and so on. If a browser doesn’t support a given type, it will be rendered as a text field. Modernizr cannot detect that date inputs create a datepicker, the color input create a colorpicker, and so on—it will detect that the input values are sanitized based on the spec. In the case of WebKit, we have received confirmation that sanitization will not be added without the UI widgets being in place.

所以,不幸的是,modernizr 没有给你任何关于 html5 输入的线索。

关于javascript - Modinizer 测试颜色输入类型是否可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29567299/

相关文章:

javascript - 组合来自多个 javascript block 的代码会导致错误?

javascript - 使用 attach() 时 Strophe 中的 404(无效的 SID 值)

javascript - 如果使用 dom 图像元素,为什么 canvas drawImage 不起作用?

Javascript onclick 监听器

Javascript 函数只允许 anchor 标记上的一个类

javascript - 正则表达式在 javascript 中一次又一次失败

javascript - 我应该在 PWA 中缓存 ServiceWorker 文件吗?

javascript - 关闭弹出模式时如何重置文本区域的大小?

javascript - "Delete"的键码触发浏览器的后退按钮 — jQuery

javascript - 使用 Electron 通过 Squirrel 事件创建桌面快捷方式