I am trying to define a JQuery statement for finding elements which have a greater (or lesser respectively) font-size
than an input value.
Possible input values:
"12px"
"14pt"
"120%"
and so on...
My first approach is more of a draft because it cannot work this way. But maybe you have ideas how to achieve a solution. Here is what i have so far (the input value comes from elsewhere and is variable):
$('*').filter(function() {
return $(this).css('font-size') > '12px';
})
Anyone?
Update
I was asked to explain why i would need something like this. I am writing an API using Selenium2 in Java, which is able to find elements and interact with them in an easier and more reliable way. This function will allow me to write code like browser.find().titleElements()
which selects all h1
, h2
,... tags, but also elements which have a greater font-size than the average text on the page.
The framework will also provide functions to select elements which are visually close to each other or in a specific direction:
HtmlElement nameLabel = browser.find().labelElement("name");
HtmlElement nameInput = browser.find().closestInputElement(nameLabel);
nameInput.below("tos").select();