Open qq99 opened 10 years ago
I don't mind this, but it would be kinda difficult to do while still using querySelectorAll https://github.com/Shopify/turbograft/blob/76b4f6d2bda49d71c42aa8bdd2e4518a1ee8e1c1/lib/assets/javascripts/turbograft/turbolinks.coffee#L143
:+1: for this.
We could use this http://api.jquery.com/attribute-contains-selector/
$("[refresh*='#{key}']")
humm, maybe not. Would not work for compound words.
$("[refresh~='#{key}']")
seems to work.
yeah it's looking more & more like we may need to use jQ not sure if there's a nice DOM native way
In that case why couldn't we use a separate refresh key <div id="container" refresh="foo"> ?
Maybe I am missing something, but this does not seem necessary.
On Thu, Nov 13, 2014 at 11:22 AM, Anthony Cameron notifications@github.com wrote:
yeah it's looking more & more like we may need to use jQ not sure if there's a nice DOM native way
— Reply to this email directly or view it on GitHub https://github.com/Shopify/turbograft/issues/36#issuecomment-62919579.
Well, previous constraints on the page make it so I cannot change the refresh key on the container (cause then the container does not update when another operation's refresh fires)
I propose that there's a good argument for having nodes with more than 1 key per
refresh
attribute.Simulation:
Say I want to refresh the innards of
div#bar
without refreshingdiv#container
, because perhaps the controls that I'm using to refreshdiv#bar
exist inside thediv#ohno
.However, I also want to refresh the
div#modal
element, but I can't, because due to previous constraints, it's already got the keyfoo
and refreshes along withdiv#container
div. Now, I can't refresh justrefresh=bar
anddiv#modal
without refreshingdiv#container
Allowing you to supply a list of refresh keys would be nice, so I could have my modal look like this:
and semantically this means that
div#modal
gets refreshed wheneverfoo
-like orbar
-like content changes.I'm pretty sure this is not how things behave now
cc @patrickdonovan @nsimmons @pushrax @celsodantas