From 37db7edecf8dbf0ec33072dabe376531ae43d7e8 Mon Sep 17 00:00:00 2001 From: Owen <469564715@qq.com> Date: Wed, 18 May 2016 14:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 你好,阮老师,在282行的例子中,我使用新版本chrome 测试了例子,出现了错误 发现const dom 产生了暂时性死区 如理解有误,浪费了老师时间,望见谅 --- docs/proxy.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/proxy.md b/docs/proxy.md index 71ae788..570f27c 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -279,19 +279,6 @@ pipe(3).double.pow.reverseInt.get; // 63 下面的例子则是利用`get`拦截,实现一个生成各种DOM节点的通用函数`dom`。 ```javascript -const el = dom.div({}, - 'Hello, my name is ', - dom.a({href: '//example.com'}, 'Mark'), - '. I like:', - dom.ul({}, - dom.li({}, 'The web'), - dom.li({}, 'Food'), - dom.li({}, '…actually that\'s it') - ) -); - -document.body.appendChild(el); - const dom = new Proxy({}, { get(target, property) { return function(attrs = {}, ...children) { @@ -309,6 +296,19 @@ const dom = new Proxy({}, { } } }); + +const el = dom.div({}, + 'Hello, my name is ', + dom.a({href: '//example.com'}, 'Mark'), + '. I like:', + dom.ul({}, + dom.li({}, 'The web'), + dom.li({}, 'Food'), + dom.li({}, '…actually that\'s it') + ) +); + +document.body.appendChild(el); ``` ### set()