On Tue, 28 Aug 2012 11:12:22 -0700, Rob Moen <rmoen(a)wikimedia.org> wrote:
On Aug 28, 2012, at 10:52 AM, Trevor Parscal wrote:
jQuery internally maps '<tagName>'
to document.createElement( 'tagName'
).
This is a feature, and is used throughout jQuery internally. It's not
very
well documented as such, but Timo is adding it to the documentation as
to
resolve the confusion around this. $( '<div>' ) is a shortcut added to
jQuery for our convenience, and I think it's reasonable to use it.
+ 1
I've always used '<div />'. Recently though, I learned that you no
longer need to do that in jQuery.
And since have been using '<div>'.
That's an unintentional side effect. jQuery does not officially support $(
'<div>' ) without a closing </div> or />.
> On Tue, Aug 28, 2012 at 10:44 AM, Mark Holmquist
> <mtraceur(a)member.fsf.org>wrote;wrote:
>
>> In creating elements, maybe, but after creation, $.prop() is the
>> preferred
>> way to go because the DOM properties are more reliably synced with the
>> actual state of the UI--apparently jQuery doesn't always properly sync
>> the
>> HTML attributes to the browser state. I'm sure Timo can explain more
>> fully
>> (and maybe more accurately).
>>
>
> We had this discussion yesterday, and addClass is more direct than prop(
> 'className' ) in every way and unless you mean to actually replace all
> existing classes, addClass is preferred. prop is there for a reason and
> it's also safe to use as escaping goes, but obviously not all attributes
> are actually properties, so it's not like we should stop using attr.
>
> - Trevor
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l(a)lists.wikimedia.org
>
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [
http://daniel.friesen.name]