Skip to main content

Bug Tracker

Side navigation

#7536 closed feature (wontfix)

Opened November 16, 2010 06:48PM UTC

Closed November 16, 2010 11:53PM UTC

Last modified March 14, 2012 07:33PM UTC

jQuery 1.4.5 - Having math fun with HTML5 selectors

Reported by: bart@bartmax.com 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();

Attachments (0)
Change History (4)

Changed November 16, 2010 09:00PM UTC by miketaylr comment:1

What would the use case be?

Changed November 16, 2010 10:08PM UTC by ajpiano comment:2

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?

Changed November 16, 2010 11:36PM UTC by bart@bartmax.com comment:3

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.

Changed November 16, 2010 11:53PM UTC by SlexAxton comment:4

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!