In that case, perhaps we should just say that all of the options are fine:
$( 'div' )
$( 'div/' )
$( 'div/div' )
but emphasize not to use attributes in the tag creation.
+1
All three will return the same, and this is not HTML, it's JavaScript. It
really is just a matter of personal flavor
On Thu, Aug 30, 2012 at 3:24 AM, Daniel Werner
daniel.wer...@wikimedia.dewrote:
By the way, you can also use
$( 'div/', { 'class': 'foo', 'title': 'myTitle', ... } );
Just be aware this also allows you to use things like 'html' and 'text'
which are not attributes at all, but call .html() or
I will rescue two facts listed in this thread, about using jquery and
creating tags
[quote][1]
Basically $( 'span class=foo' ) will break completely in IE7/IE8.
[quote][2]
It's important to note however that IE required that input and button tags
are created with a type (if they are going to
On Mon, Aug 27, 2012 at 9:39 PM, Chris Steipp cste...@wikimedia.org wrote:
On Mon, Aug 27, 2012 at 4:37 PM, Mark Holmquist mtrac...@member.fsf.org
wrote:
I also tried to get an answer about the better between $( 'div
class=a-class /' ) and $( 'div /' ).addClass( 'a-class' ), but
apparently
Rob is correct that using addClass is the preferable way to go for classes,
and attr is the preferable way to go for other attributes. They are both
are safe since they use setAttribute internally which escapes the values.
- Trevor
On Tue, Aug 28, 2012 at 10:29 AM, Rob Lanphier
On 12-08-28 10:40 AM, Trevor Parscal wrote:
Rob is correct that using addClass is the preferable way to go for classes,
and attr is the preferable way to go for other attributes. They are both
are safe since they use setAttribute internally which escapes the values.
In creating elements,
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
On 8/28/12 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
Timo where are you ?
+1 .addClass
as it directly manipulates the .className property.
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
Unfortunately, our resident Javascript master is eating dinner :)
Ryan Kaldari
On 8/28/12 11:00 AM, Rob Moen wrote:
Timo where are you ?
+1 .addClass
as it directly manipulates the .className property.
On Aug 28, 2012, at 10:52 AM, Trevor Parscal wrote:
jQuery internally maps 'tagName' to
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
On Tue, Aug 28, 2012 at 11:00 AM, Ryan Kaldari rkald...@wikimedia.orgwrote:
In that case, perhaps we should just say that all of the options are fine:
$( 'div' )
$( 'div/' )
$( 'div/div' )
but emphasize not to use attributes in the tag creation.
Unless you are creating an input or a
On Tue, 28 Aug 2012 11:12:22 -0700, Rob Moen rm...@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
On Tue, Aug 28, 2012 at 11:15 AM, Daniel Friesen dan...@nadir-seen-fire.com
wrote:
That's an unintentional side effect. jQuery does not officially support $(
'div' ) without a closing /div or /.
And yet they use it themselves internally? As I mentioned, Timo is a jQuery
maintainer and said
Okay, sorry for being away for 30 minutes while I enjoyed dinner.
Someone[1] pointed me to this thread and suggested I chime in, so here I go.
On Aug 28, 2012, at 2:50 AM, Daniel Friesen dan...@nadir-seen-fire.com wrote:
Either way $( 'div' ) is NOT something officially supported by jQuery
+1
Thank you for grounding this conversation in reality.
- Trevor
On Tue, Aug 28, 2012 at 12:18 PM, Krinkle krinklem...@gmail.com wrote:
Okay, sorry for being away for 30 minutes while I enjoyed dinner.
Someone[1] pointed me to this thread and suggested I chime in, so here I
go.
On Aug
On Tue, Aug 28, 2012 at 4:18 PM, Krinkle krinklem...@gmail.com wrote:
Moreover, aside from the performance and security, there's another important
factor to take into account. And that is the fact that IDs can contain
characters that have special meaning in CSS selectors (such as dots).
Hence, I think we should change our coding conventions to always use `$(
'div /' )`.
+1 for valid XHTML. Considering that bytes are cheap and validity is
good, this seems like a good idea.
I also tried to get an answer about the better between $( 'div
class=a-class /' ) and $( 'div /'
$( 'div' ) is the way to go.
- Trevor
On Mon, Aug 27, 2012 at 4:37 PM, Mark Holmquist mtrac...@member.fsf.orgwrote:
Hence, I think we should change our coding conventions to always use `$(
'div /' )`.
+1 for valid XHTML. Considering that bytes are cheap and validity is good,
this seems
On Monday, August 27, 2012 at 4:40 PM, Trevor Parscal wrote:
$( 'div' ) is the way to go.
Yeah. Mark Pilgrim's overview of the sordid history of XHTML is useful
background: http://diveintohtml5.info/past.html
--
Ori Livneh
o...@wikimedia.org
On Mon, 27 Aug 2012 16:57:52 -0700, Ori Livneh o...@wikimedia.org wrote:
On Monday, August 27, 2012 at 4:40 PM, Trevor Parscal wrote:
$( 'div' ) is the way to go.
Yeah. Mark Pilgrim's overview of the sordid history of XHTML is useful
background: http://diveintohtml5.info/past.html
--
On Monday, August 27, 2012 at 5:50 PM, Daniel Friesen wrote:
If you don't like the XHTML-ish shortcut that jQuery provides, then our
coding conventions should be to use `$( 'div/div' );`.
Either way $( 'div' ) is NOT something officially supported by jQuery
and makes it easy for
On Mon, Aug 27, 2012 at 4:37 PM, Mark Holmquist mtrac...@member.fsf.org wrote:
I also tried to get an answer about the better between $( 'div
class=a-class /' ) and $( 'div /' ).addClass( 'a-class' ), but
apparently there's little difference. At least when creating dynamic
interfaces, I'd like
23 matches
Mail list logo