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


Groups > comp.lang.javascript > #28052

Re: Interaction between CSS and JS

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: Interaction between CSS and JS
Date 2015-06-08 22:35 +0200
Organization solani.org
Message-ID <ml4u9v$r5u$1@solani.org> (permalink)
References <ee169a03-8897-4861-8e7d-2d8eb0fc1d62@googlegroups.com> <ml4l69$omg$1@solani.org> <16297177.zCTbze9WAx@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> Christoph M. Becker wrote:
> 
>> Indeed, you can use the className property of the respective element to
>> dynamically assign and/or remove (a) CSS class(es).
> 
> This property should only be used if
> 
>   a) a class name is to be added and duplicate class names are not an issue;
>   b) the “classList” property is not available.
> 
> The disadvantage of the “className” property is that proper removal or 
> replacement of a class name requires regular expressions.  “classList” 
> allows the caller to use only string values.

classList is certainly preferable, if it is supported.  Unfortunately,
IE 8 seems to be still in widespread use.[1]

> However, it is not strictly necessary to use client-side scripting here.  
> Where the effect is supported, the :target selector is.

Thanks.  I have not been aware of that.

[1]
<https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=0>

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Interaction between CSS and JS bit-naughty@hotmail.com - 2015-06-08 10:25 -0700
  Re: Interaction between CSS and JS "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-08 19:44 +0200
  Re: Interaction between CSS and JS "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-08 19:59 +0200
    Re: Interaction between CSS and JS Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-08 22:18 +0200
      Re: Interaction between CSS and JS "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-08 22:35 +0200
        Re: Interaction between CSS and JS Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-09 01:06 +0200
  Re: Interaction between CSS and JS dhtml <dhtmlkitchen@gmail.com> - 2015-06-16 15:10 -0700

csiph-web