jordanmessina/node-whiteboard — comment on commit 269c2b0df869f3dc40a6bb6b51916174c8f4d384
File:  line 0
By jordanmessina:

jquery returns a jQuery object when you use their selectors. You can't call getContext on a jQuery object. The canvas context object (which is what is returned when you do getElementById) is in the jquery object @ [0]. So, yes those lines are equivalent an the reason it's confusing is because jquery is doing more than just returning elements, they wrap their elements in jquery specific bs so you can do more shit. They obviously haven't looked into html5 / canvas much because this isn't the desired way to use jquery.

On Dec 4, 2011, at 23:09, Bill Culp wrote:

> the resize event has that same getPosition(canvas) so if it doesnt work then...
>
> also are these two lines equivalent?
>
> document.getElementById('drawing-area')
>
> $('#drawing-area')[0];
>
> confusing....
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jordanmessina/node-whiteboard/commit/269c2b0df869f3dc40a6bb6b51916174c8f4d384#commitcomment-768143