P
Peter
How can I check, using JavaScript, if the CSS3 selector nth-child(odd)
is supported by the browser?
is supported by the browser?
How can I check, using JavaScript, if the CSS3 selector nth-child(odd)
is supported by the browser?
I don't see how assigning to an element's style property can help here.
What about inserting a rule (containing selector in question) into a
document; then testing whether an element matched by rule's selector is
affected by declaration?
RobG said:You missed the phrase "using it", in other words, use the CSS 3
selector to apply a rule, then check to see if it "worked".
Yes, that's what I meant.
RobG pisze:
Thank you for your advice. Now I'll write some code to this and see how
this works.
RobG pisze:Thank you for your advice. Now I'll write some code to this and see how
this works.
The following, using David Mark's MyLib.js[1] seems to do the job in
Safari, Firefox and IE at least.
<style type="text/css">
tr:nth-child(odd) {
background-color: red;
}
</style>
The following, using David Mark's MyLib.js[1] seems to do the job inRobG pisze:
Safari, Firefox and IE at least.
Cool! AFAIK, it works in virtually everything (and has sat virtually
untouched for 2 years.) Ironic that so many other people see endless
compatibility problems *despite* thousands of patches as progress.
I'm getting ready to close that server down.
Le 7/6/09 7:17 PM, David Mark a écrit :
RobG pisze:
The following, using David Mark's MyLib.js[1] seems to do the job in
Safari, Firefox and IE at least.Cool! AFAIK, it works in virtually everything (and has sat virtually
untouched for 2 years.) Ironic that so many other people see endless
compatibility problems *despite* thousands of patches as progress.I'm getting ready to close that server down.
Et voilà !
Huh?
We do not have time to take a look as it disappears from birth!
The following, using David Mark's MyLib.js[1] seems to do the job in
Safari, Firefox and IE at least.
Cool! AFAIK, it works in virtually everything (and has sat virtually
untouched for 2 years.) Ironic that so many other people see endless
compatibility problems *despite* thousands of patches as progress.
And get that thing while it lasts. I'm getting ready to close that
server down. Most of the best of that code will be in the next Dojo.
Can add this dynamically with the addStyle method if needed.
The following, using David Mark's MyLib.js[1] seems to do the job in
Safari, Firefox and IE at least.Cool! AFAIK, it works in virtually everything (and has sat virtually
untouched for 2 years.) Ironic that so many other people see endless
compatibility problems *despite* thousands of patches as progress.And get that thing while it lasts. I'm getting ready to close that
server down. Most of the best of that code will be in the next Dojo.
Thanks for the warning, I've grabbed your (sparse) documentation too -
I've been adding a little more detail and am happy to give it back,
but I guess you aren't interested in that now. ;-)
Perhaps with MyLib.js, but in general I'd need to determine whether
the library had actually added it as a style rule and let the browser
do the rest, or worked out that the UA didn't support nth-child() and
applied it using its own method.
But that leads to a whole new discussion...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.