Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional jquery helper methods #121

Open
catmando opened this issue Jan 21, 2016 · 1 comment
Open

additional jquery helper methods #121

catmando opened this issue Jan 21, 2016 · 1 comment

Comments

@catmando
Copy link
Collaborator

Here are a couple of handy methods we have started to use in our code, that I would like to see appear in 0.8 or 0.9:

React::Element#append_to(dom_element)  # append this element to an existing DOM element i.e.

div { "some div stuff" }.append_to(Element['.put-a-div-here'])

Element#append(ele="<div></div>", &block) 

# append an element (default an empty div) to this dom element, and 
# render the block into the appended element (if the block exists)  i.e.

Element['.add-something'].append do
  div { button { "click me" } }
end

# The first parameter (ele) is maintained so its compatible with the existing jQuery 

Element#replace_with(ele="<div></div>", &block) 
# like append but the existing element is replaced.
@sollycatprint
Copy link

This issue was moved to ruby-hyperloop/hyper-react#121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants