Coder Social home page Coder Social logo

Comments (10)

Pandahisham avatar Pandahisham commented on May 15, 2024

oops descendant

from intercooler-js.

ThisNoName avatar ThisNoName commented on May 15, 2024

You mean like this? Works fine.

<button id='ping' ic-post-to='/ping' ic-target='#result > .second'>Ping</button>

<ul id='result'>
    <li>test1</li>
    <li class='second'>test2</li>
    <li>test3</li>
</ul>

from intercooler-js.

webholics avatar webholics commented on May 15, 2024

I have the same problem. In my opinion intercooler relies too heavily on defining unique global ids for DOM elements. This may work for small examples but not for complex cases where you may have lots of the same ajax components on the same page.

In my option all selectors used in Intercooler attributes should per default not be global but restricted to the children of the current element. And only if you really want to have a global selector you could put the keyword "global" in front of the selector.

Another thing which really frustrates me is that not all selectors are handled equally e.g. I can use "closest" on ic-target but not on ic-indicator.

from intercooler-js.

adaniello avatar adaniello commented on May 15, 2024

In doc you can read "attribute should be a valid global CSS/JQuery selector OR the string closest followed by a space, followed by a valid CSS selector, which will be evaluated as the closest parent matching the given selector".
And, as @whoever123 said, any "valid global CSS/JQuery selector" works fine.

from intercooler-js.

webholics avatar webholics commented on May 15, 2024

Yes but that is not my point. My point is that I want not a global selector ($(selector)) but a lokal one ($(selector, el)).

from intercooler-js.

adaniello avatar adaniello commented on May 15, 2024

Can you use "closest" reserved word (eg "closest div.modal-content")?
Or remember that the attribute may be placed on parent elements.

from intercooler-js.

adaniello avatar adaniello commented on May 15, 2024

Why not post a codepen sample?

from intercooler-js.

webholics avatar webholics commented on May 15, 2024

This is my case http://codepen.io/anon/pen/avRrbe

Its just the markup. My problem is that this is a component which is in use multiple times on the page and I don't want to create artifical unique id attributes for .voting or .voting__progress just to be able to select them.

from intercooler-js.

adaniello avatar adaniello commented on May 15, 2024

@webholics, i don't understand well what is your problem, but if you have multiple ".voting" blocks, everyone with its progress, take a look at http://codepen.io/anon/pen/rOqgeb (css is only for sample).
I hope this can help you

from intercooler-js.

1cg avatar 1cg commented on May 15, 2024

Hi webholics. I can see your point, generating unique IDs in repeated UX is ugly and annoying. It seems like a sane algorithm would be to try the selector first as a find() from the current element, then as a global selector.

I will try to get something along those lines in the next release.

from intercooler-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.