Bug Tracker

Ticket #7536 (closed feature: wontfix)

Opened 4 years ago

Last modified 3 years ago

jQuery 1.4.5 - Having math fun with HTML5 selectors

Reported by: bart@… Owned by:
Priority: undecided Milestone: 1.5
Component: selector Version:
Keywords: Cc:
Blocking: Blocked by:

Description

Maybe will be usefull to have some math into selectors like this :

Math with Selector for new html5 input elements like number with MAX / MIN. So you can instead of :

$('input[max]').each (function () {

this.attr('max') <= 100 ? this.show() : return(false);

})

like :

$('input[max<=100]').show();

Change History

comment:1 Changed 4 years ago by miketaylr

What would the use case be?

comment:2 Changed 4 years ago by ajpiano

  • Component changed from unfiled to selector

While this seems like a nifty feature, given the lack of support for a lot of the new HTML5 input types at the present time, and the fact that this seems like kind of an edge-case type of selector, AND the fact that jQuery is trying to avoid adding NEW custom non-querySelectorAll compatible selectors (like this one) which tend not to perform as well as QSA compatible ones (which can bypass Sizzle entirely), leads me to think that this might be functionality that's better achieved in some sort of custom extension, which can perhaps be included in time, if it proves popular enough. Does that seem reasonable to you?

comment:3 Changed 4 years ago by bart@…

I totally agree ajpiano.

and to add to miketaylr, this wouldn't be a popular extension.

Case use, could be additional support of styling due to the fack that CSS lacks this kind of selector at all. Also you can do maths in range elements to ....... < add anything > where the input is about a x % of the max, usefull in games or surveys.

I was thinking also on using regexp on other input types, adding operators could lead to potential SPECIFIC cases, but that just it, SPECIFIC, therefor, custom extension will do the trick pretty well.

Thanks *and sorry* for your time.

Greetings, Bart.

comment:4 Changed 4 years ago by SlexAxton

  • Status changed from new to closed
  • Resolution set to wontfix

No need to apologize for submitting ideas to the project. We appreciate them. We just have to figure out which ones belong in core and which ones belong as plugins. We'd love to see you make this custom extension though! If you need help, most of us hang out in #jquery on irc.

Thanks!

Note: See TracTickets for help on using tickets.