Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19485 > unrolled thread

about adding attribute class

Started by"Tony" <tony.johansson@inport.com>
First post2013-04-26 11:39 +0200
Last post2013-04-26 21:01 +0300
Articles 4 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  about adding attribute class "Tony" <tony.johansson@inport.com> - 2013-04-26 11:39 +0200
    Re: about adding attribute class "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-04-26 12:31 +0200
    Re: about adding attribute class JJ <duh@nah.meh> - 2013-04-27 00:35 +0700
      Re: about adding attribute class "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-04-26 21:01 +0300

#19485 — about adding attribute class

From"Tony" <tony.johansson@inport.com>
Date2013-04-26 11:39 +0200
Subjectabout adding attribute class
Message-ID<kldhrd$1t3$1@dont-email.me>
I just want to get a confirm if alternativ 1 and 2 is the same. It's just 
two different ways to do the the same thing.
For me it's just the same thing and the result on screen is also the same.


alternative 1
**********
slot = document.createElement("div");
slot.className = "slot " + type;

alternative 2
slot = document.createElement('div');
slot.setAttribute('class', 'slot ' + type);

//Tony 

[toc] | [next] | [standalone]


#19486

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2013-04-26 12:31 +0200
Message-ID<XnsA1AE7F55549E3eejj99@194.109.133.133>
In reply to#19485
Tony wrote on 26 apr 2013 in comp.lang.javascript:

> I just want to get a confirm if alternativ 1 and 2 is the same. It's
> just two different ways to do the the same thing.
> For me it's just the same thing and the result on screen is also the
> same. 

Depending on the browser.

> result on screen

Did you try older Netscape browsers?

> alternative 1
> **********
> slot = document.createElement("div");
> slot.className = "slot " + type;
> 
> alternative 2
> slot = document.createElement('div');
> slot.setAttribute('class', 'slot ' + type);

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#19490

FromJJ <duh@nah.meh>
Date2013-04-27 00:35 +0700
Message-ID<9ba8aj5lyqm5.g0syi11zz8f7$.dlg@40tude.net>
In reply to#19485
On Fri, 26 Apr 2013 11:39:56 +0200, Tony wrote:
> I just want to get a confirm if alternativ 1 and 2 is the same. It's just 
> two different ways to do the the same thing.
> For me it's just the same thing and the result on screen is also the same.
> 
> alternative 1
> **********
> slot = document.createElement("div");
> slot.className = "slot " + type;
> 
> alternative 2
> slot = document.createElement('div');
> slot.setAttribute('class', 'slot ' + type);
> 
> //Tony

Same by functionality.
But Alt#1 would be faster and has cleaner code.

[toc] | [prev] | [next] | [standalone]


#19492

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2013-04-26 21:01 +0300
Message-ID<klef71$236$1@dont-email.me>
In reply to#19490
2013-04-26 20:35, JJ wrote:

> But Alt#1 would be faster

By how many femtoseconds exactly?

> and has cleaner code.

Oh really.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web