jQuery
New Wave Javascript


discuss » cross-browser compatibility with for attribute


Posted: Mon Feb 6 10:44:24 EST 2006
From: John Resig <jeresig at gmail.com >

Good catch Andrea!

Currently, jQuery doesn't interpret things like that, making them
sane. You'll also see this when working with the CSS attributes:
$("p").css("float","right");
vs
$("p").css("cssFloat","left");

and even the use of:
$("p").css("fontWeight","bold");
instead of:
$("p").css("font-weight","bold");

I'll see if I can't figure out a smart way to work around these issues.

--John

On 2/6/06, Andrea Ca'Zorzi <andrea.cazorzi at gmail.com> wrote:
> Hi,
>
> I love to work with this library because of the beatifully compact
> code it allows me to write.
>
> I think there is a browser compatibility problem with xpath searches
> using attributes like 'for' and 'class'. These work fine on
> gecko-based browsers, while you need to use 'htmlFor' and 'className'
> on IE6/Win.
>
> Try this:
>
> alert($("//div[@className]").size());
> alert($("//div[@class]").size());
>
> and this:
>
> alert($("//label[@htmlFor]").size());
> alert($("//label[@for]").size());
>
> on Firefox or IE6/Win and you'll see where the problem is.
>
> Otherwise, great work.
>
> Andrea Ca'Zorzi
>
> _______________________________________________
> jQuery mailing list
> discuss at jquery.com
> http://jquery.com/discuss/
>


--
John Resig
http://ejohn.org/
jeresig at gmail.com