Skip to content

Instantly share code, notes, and snippets.

@jacob414
Created February 9, 2012 17:40
Show Gist options
  • Save jacob414/1781484 to your computer and use it in GitHub Desktop.
Save jacob414/1781484 to your computer and use it in GitHub Desktop.
Pico jQuery faking
# Doesn't work yet, have patience..
fakeJqOb = new class FakeJqOb
constructor: (@els=[]) ->
append: (content) =>
@ap or= []
console.log "Adding #{content}"
@ap.push content
@
fakeJqOb.els['#an-id'] = new FakeJqOb()
fakeJq = (sel) ->
if fakeJqOb[sel]?
console.log 'add to el..'
fakeJqOb[sel]
else
fakeJqOb
el = fakeJq('#an-id').append('x').append('y')
console.log 'global', fakeJqOb
console.log 'el', el
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment