From: S.T. on
On 12/7/2009 8:59 AM, David Mark wrote:
> But it has the same old attr method. :(
>
> attr: function( elem, name, value ) {
>
> // don't set attributes on text and comment nodes
>
>... and on and on and on.

For all these massive bugs, future browser incompatibility issues, code
breaking on every library update and inept coding that you claim litters
jQuery -- I don't seem to see any effects of them. Ever. Nor do my
users. Nor other developers I communicate with.

Weird, isn't it?

Guess I'm just really, really lucky.

From: Garrett Smith on
Stefan Weiss wrote:
> On 11/12/09 08:35, Garrett Smith wrote:
>> Garrett Smith wrote:
>>> jQuery.attr has specific handling for many odd cases. What does attr
>>> have to do with:
>>>
>>> | if ( name == "selected" && elem.parentNode )
>>> | elem.parentNode.selectedIndex;
>>>
>> Note that the statement inside the if test is entirely useless, as it is
>> not assigned to anything.
>
> The two lines above the quoted part are:
>
> // Safari mis-reports the default selected property of a hidden option
> // Accessing the parent's selectedIndex property fixes it
>
> It would appear that this was intended as a bug workaround, and that
> reading the selectedIndex property is all that's required. Still, it's a
> strange thing to do, and could very well be optimized away by a minifier
> tool or by the JS engine itself.
>
A workaround, but to what problem?

<body onload ="alert(document.getElementById('c').selected)">
<select id="x">
<option id="a">a</option>
<option id="b">b</option>
<option id="c" style="visibility: hidden;" selected>c</option>
<option id="d">d</option>
</select>

In Safari, the 'c' is selected, the alert is - true - and when the
select is expanded, the 'c' option is blacked out.

Perhaps someone can demonstrate what the workaround actually fixes.

Anyway, attr is dealing with non-string value property.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Andrew Poulos on
On 12/12/2009 8:26 AM, S.T. wrote:
> On 12/7/2009 8:59 AM, David Mark wrote:
>> But it has the same old attr method. :(
>>
>> attr: function( elem, name, value ) {
>>
>> // don't set attributes on text and comment nodes
> >
>> ... and on and on and on.
>
> For all these massive bugs, future browser incompatibility issues, code
> breaking on every library update and inept coding that you claim litters
> jQuery -- I don't seem to see any effects of them. Ever. Nor do my
> users. Nor other developers I communicate with.
>
> Weird, isn't it?
>
> Guess I'm just really, really lucky.

Here's how I've seen it "work":

- A company's director lands a job

- The company's "technical" manager contacts the client and requests a
spec asking them to be sure to set out the target browser.

- The client, not knowing any better specifies, say IE 6 (or whatever
browser the client's company lets them use).

- The company builds the job and tests it only in the target browser

- The company, "happy" with job, sends it to client to verify

- The client tests it with their browser. By "testing" I mean the
client, who has no understanding of software testing procedure, runs
through the job for 15 minutes before they sign it off.

- The company happily adds the client's company's logo to their portfolio.

- Some time later after the client releases the completed job into the
wild and problems begin to be reported the company, with a avuncular
tone, points the client to the part of the client's own spec where they
nominated the target browser.

Yes, many developers are lucky.

Andrew Poulos
From: RobG on
On Dec 12, 7:26 am, "S.T." <a...(a)anon.com> wrote:
> On 12/7/2009 8:59 AM, David Mark wrote:
>
> > But it has the same old attr method.  :(
>
> > attr: function( elem, name, value ) {
>
> >    // don't set attributes on text and comment nodes
>
> >... and on and on and on.
>
> For all these massive bugs, future browser incompatibility issues, code
> breaking on every library update and inept coding that you claim litters
> jQuery -- I don't seem to see any effects of them. Ever. Nor do my
> users. Nor other developers I communicate with.
>
> Weird, isn't it?
>
> Guess I'm just really, really lucky.

Or don't read the jQuery GG forum. A quick scan over the last two days
of posts turned up the following:

Random problems with load()?????
<URL: http://groups.google.com.au/group/jquery-en/browse_frm/thread/cc155eede7fcc562?hl=en
>

Problem with Jquery Superfish in IE7
<URL: http://groups.google.com.au/group/jquery-en/browse_frm/thread/422d435663db6f65?hl=en#
>

IE 7-8 bug on menu loading when mouse is over the menu
<URL: http://groups.google.com.au/group/jquery-en/browse_frm/thread/87d54847af752079?hl=en#
>

load() function and IE8
<URL: http://groups.google.com.au/group/jquery-en/browse_frm/thread/a12e5d47c17e93a3?hl=en#
>


--
Rob.

From: David Mark on
On Dec 11, 12:08 pm, Matt Kruse <m...(a)thekrusefamily.com> wrote:
> On Dec 11, 10:47 am, David Mark <dmark.cins...(a)gmail.com> wrote:
>
> > > You must live in a bubble.
> > No, I deal with JS and JS developers every day.
>
> There's no point in going over this again. You cannot relate to those
> who face development situations and business cases different than
> yours. There are some really bad projects out there, being completed
> by really poor developers, at a quality level that is very low. If you
> never see or touch those, good for you. But they still exist.
>
> > Take just he basic attr and removeAttr methods.  They can't even run
> > the basic gamut of attributes without throwing exceptions.  Other
> > cases fail silently.  These quirky behaviors vary across browsers
> > _and_ jQuery versions.  So, what could be worse than that?
>
> Oh, things can be much worse.

Sure, you could hire a trained chimp to bang away at the keyboard at
random.

>
> > > Is it perfect? No. But it's better than the status quo.
> > It a team is writing bad code, you teach them how to write good code.
>
> If only it were that easy.

It really is. They typically don't have to write a CSS selector query
engine. You teach them how to do basic DOM scripting and soon they
are laughing at jQuery's foibles.

>
> > > Think of it this way - When js code quality is at a 1 or 2 on a scale
> > > of 1-10 (10 being best),
> > Easy.  Get new programmers.
>
> Of course! Everyone should just fire the people they have and hire the
> best!

Not everyone can afford the best, nor do most projects need them.
There's a big difference between the best and incompetents.

>
> > > then introducing jQuery and raising it to a 4
> > > or 5 with virtually no pain is an obvious win.
> > Not in my book.  Looks like a punt.
>
> It's progress. It's better than it was.

No, it's just trading one set of problems for another. A 4 or 5 is a
failing grade BTW. Why program for failure?

> Idealism is not always
> realistic. Sometimes "just make it work" is a lofty goal.

If something doesn't work, what good is it?

>
> > > Especially when js code quality is less of a concern compared to
> > > other, bigger problems.
> > I don't know what that means.
>
> When the js is running in a pseudo-xhtml document containing invalid
> markup, elements with multiple duplicated id's, 80k of whitespace
> bloat, styles and js embedded directly into the tags, css that is not
> cross-browser, table-based layouts, and spacer gif's...

And you don't care to fire the bums that slapped that together?
That's your problem.

> well, jQuery
> messing up an attr() call condition that will never actually be called
> seems like a minor concern.

You don't have any idea what arguments work with attr (or for which
version(s) of jQuery). And the messed up attr/removeAttr "pair" (just
two of many botched functions in jQuery) is indicative that your
chosen saviors are false prophets. It's been years and they are still
using the same old nonsense code. That's the main point.

>
> But seriously... this is the same old discussion of "don't you
> understand how bad it can get and why something like jQuery is
> actually an improvement?!" and there's really no point to it. I'm fine
> with just seeing it differently than you.
>

That's not the typical spin anyway. Persuse sites like Ajaxian and
you will see that many developers think jQuery is the greatest thing
to ever happen to the Web. :)