batiste / pug-vdom

PUG template to HyperScript Virtual DOM
MIT License
18 stars 6 forks source link

Keep `this` unchanged when using `for...in` loop. #32

Closed albb0920 closed 5 years ago

albb0920 commented 5 years ago

Hi

I've noticed when using for...in loop, this is changed inside the loop due to the use of forEach. The official implementation does intentionally preserve this.

https://github.com/pugjs/pug/blob/pug%402.0.3/packages/pug-code-gen/index.js#L767

Thank you!

albb0920 commented 5 years ago

Hi, another thing I find is that the expression is evaluated on every iteration. Do you want a separate PR or I should add this commit here.

https://github.com/albb0920/pug-vdom/commit/e9d024936b96402ba7e150c130af95a3d9200184

gryphonmyers commented 5 years ago

@albb0920 thanks for contributing! I will try to get around to merging this and publish a new version tomorrow.

Please do a separate pull request for the other fix, as I find it's best to keep PRs atomic

albb0920 commented 5 years ago

OK, I've opened another PR, thank you!

albb0920 commented 5 years ago

@batiste Rebased, thank you!