Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7536 closed feature (wontfix)

jQuery 1.4.5 - Having math fun with HTML5 selectors

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.5
Component: selector Version:
Keywords: Cc:
Blocked by: Blocking:

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 (4)

comment:1 Changed 12 years ago by miketaylr

What would the use case be?

comment:2 Changed 12 years ago by ajpiano

Component: unfiledselector

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 12 years ago by [email protected]

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 12 years ago by SlexAxton

Resolution: wontfix
Status: newclosed

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.