jquery 3.4.0

  • jQuery 3.4.0 的更新内容主要是错误修复和功能改进,列举部分如下:

    • 针对 .width 和 .height 的性能改进
    • 支持 nonce 和 nomodule
    • 针对 Radio 元素新增事件处理程序中的预期状态
    • 针对 Object.prototype pollution 问题的小修复
// 示例代码

var $radios = jQuery(".example");
var $firstRadio = $radios.first();
var firstCheckedState = $firstRadio.prop("checked");
$radio.on("click", function() {
  console.log($firstRadio.prop("checked") === firstCheckedState);
});
$radios.eq(1).click();
  • 针对 Object.prototype pollution 问题的小修复
// 示例代码

Example
jQuery.extend(true, {},
  JSON.parse('{"__proto__": {"test": true}}')
);
console.log( "test" in {} ); // true
posted @ 2019-04-12 09:34  ୠZeroଙ  阅读(563)  评论(0编辑  收藏  举报