kylebarrow / chibi

A tiny JavaScript micro-library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodes variable is shared across all invocations of $()

statianzo opened this issue · comments

Any invocation of $('selector') resets the nodes value. That can lead to very unexpected behavior.
Consider this scenario:

<p class="foo">footext</p>
<p class="bar">bartext</p>
var foo = $('.foo');
var bar = $('.bar');

console.log(foo.html());

bartext will be logged instead of the expected footext.

I would suggest not scoping nodes at the library level.

Good point, will look into it.

I've moved nodes inside Chibi in 0.3 so this issue should be resolved.