随笔分类 - js
摘要:// 创建xml数据 let doc = document.implementation.createDocument('', 'root', null); // 创建一个文档 let root =doc.documentElement; // 获取文档 let user = doc.createE
阅读全文
摘要:"MDN" 监听css动画,开始,迭代次数,结束,中断 回调函数返回 animationEvent属性 html <!DOCTYPE html .a { width: 100px; height: 100px; background: red; animation: test 2.5s cubic
阅读全文
摘要:/** * * 根据秒数返回 一个日期范围 * timerFilter(10) */ function timerFilter(n) { let days = 31; // 一月多少天 const oneM = 60; // 一分钟s const halfAnHour = oneM * 30; //
阅读全文
摘要:MDN文档 MSDN文档 该对象下有 5个方法 Collator:ƒ Collator() DateTimeFormat:ƒ DateTimeFormat() NumberFormat:ƒ NumberFormat() getCanonicalLocales:ƒ getCanonicalLocale
阅读全文
posted @ 2017-12-27 17:22
Ajanuw
摘要:MDN文档 拦截 // index.html var obj = { name:'ajanuw' } var handle = { // 通过代理可以 约束,验证 向一个对象传的 key:value get(target, key){ return Reflect.has(target, key)
阅读全文
posted @ 2017-12-26 22:12
Ajanuw
摘要:MDN文档 Reflect 是一个内置的对象,它提供拦截 JavaScript 操作的方法。不可构造(not new)。 Reflect.apply // Reflect.apply(target, thisArgument, argumentsList) target, 目标函数。 thisArg
阅读全文
posted @ 2017-12-26 12:00
Ajanuw
摘要:类似nodejs的 child_process.fork() 动态创建server.js文件 js const workerJSString = ` // 接收主线程发来的的数据 onmessage = ({data})= { // 向主线程发送data console.log(\ ); postM
阅读全文
摘要:返回调用指定函数的函数. javascript function test() { if (test.caller === null) console.log('test 函数在全局调用'); // 获取调用 test函数, 的函数名 console.log(test.caller.name );
阅读全文
摘要:MDN 文档 首先你需要让用户上传图片 <input type="file" accept="image/*" id="upfile" /> 默认会让用户在 相册 或则 摄像头 中选择,如果加上 capture="camera" 则默认打开摄像头 当上传图片时,先在本地预览图片 document.q
阅读全文
摘要:```html ```
阅读全文
摘要:"MDN上说的很清楚" MutationObserver给开发者们提供了一种能在某个范围内的DOM树发生变化时作出适当反应的能力.该API设计用来替换掉在DOM3事件规范中引入的Mutation事件 config
阅读全文
摘要:## js正则表达式 ```javascript 'ajanuw'.replace(/a/g, 'x'); //"xjxnuw" 'ajanuw'.replace(new RegExp('a', 'g'), 'x'); //"xjxnuw" ``` ## 修饰符 flags ``` g 全局匹配,
阅读全文
posted @ 2017-12-06 23:35
Ajanuw
摘要:var {log} = console // Document.characterSet 返回文档使用的字符集。 log(`1 ${document.characterSet} \n\n`) // Document.compatMode Quirks 模式还是在 Strict 模式下渲染文档的 <!
阅读全文
posted @ 2017-11-28 15:02
Ajanuw