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


Groups > comp.lang.javascript > #28052

Re: Interaction between CSS and JS

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: Interaction between CSS and JS
Date Mon, 08 Jun 2015 22:35:12 +0200
Organization solani.org
Lines 30
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>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace solani.org 1433795711 27838 eJwFwYEBwCAIA7CXxNLCO07p/ycsIRS6laKSpqf3XMQHrTmDfSnHa0QJlcxVz+7BqfI25wcZ9BEM (8 Jun 2015 20:35:11 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 8 Jun 2015 20:35:11 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
X-User-ID eJwFwQkBwDAIBDBLMH45UDj/EpaYOPsLdXM1GKJWqSg7PkleRXqh7owfbGIJ06LpczEhLT8RYREZ
In-Reply-To <16297177.zCTbze9WAx@PointedEars.de>
Cancel-Lock sha1:i7RJO3txA9XlCWKKxemNxA1XG4k=
X-NNTP-Posting-Host eJwFwQkBwDAIA0BLfCGtHAbFv4TdwVOzGYkMLPbJXMFzEec9ql9G0qy0iwuU9/BwuUKOm/wENhBA
Xref csiph.com comp.lang.javascript:28052

Show key headers only | 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