https://bugzilla.wikimedia.org/show_bug.cgi?id=40430

Krinkle <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|jquery.placeholder.js       |jquery.placeholder should
                   |should take the placeholder |take the placeholder value
                   |value as first parameter    |as first parameter

--- Comment #1 from Krinkle <[email protected]> 2012-09-22 16:18:54 UTC ---
We could "fix" it in jquery.placeholder, but on the other hand it could also be
used to make an example of: Don't use this "bad part" of jQuery.

Besides, we can't control every single plugin, there are also third-party
plugins, plugins made on individual wikis and gadgets etc. Its a lost cause /
useless battle.

What I mean is, even if we fix it in jquery.placeholder, it does not make it
"right" to use this jQuery feature, because there can still be any other jQuery
plugin active in your context that creates another plugin in that name, not to
mention, it could even overload the jquery.placeholder plugin, so even that
wouldn't be safe.

Given that it doesn't fix anything and only further encourages a bad practice,
I'm inclined to say, wontfix.

To set attributes, use .attr() with key value pairs.

To call other methods, just call those methods. The syntax in jQuery has
already been made a lot easier to work with. Now .attr(), .on(), .prop() and
.css() basically handle 80% of everything with other methods only pointing to
those. So if you like to use objects instead of calling a lot of methods, you
can. Just have to call one of those 3 first, like:

$('<input type="checkbox">').attr({
    foo: 'bar',
    baz: 'quux'
}).prop({
    value: 'Hello!',
    selected: true
}).on({
   click: function () {},
   focus: function () {},
   blur: function () {}
}).css({
   ...
}).data({
   ...
});

That's still pretty neat, but ensures that everything is very much explicit
without "guessing" whether that key-value pair is an attribute, property or
event.

Even when not considering plugins, the map in jQuery() constructor is still
unstable. Because what if you want to set the "checked" property?

$('<input type="checkbox">', { checked: true }).prop('checked');

That will fail and return false.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to