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


Groups > comp.lang.javascript > #34042

Media CSS Rules

Path csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.westnet.com.au!news.westnet.com.au.POSTED!not-for-mail
NNTP-Posting-Date Wed, 27 Sep 2017 22:31:44 -0500
Newsgroups comp.lang.javascript
X-Mozilla-News-Host news://news.iinet.net.au:119
From Andrew Poulos <ap_prog@hotmail.com>
Subject Media CSS Rules
Date Thu, 28 Sep 2017 13:31:43 +1000
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Language en-GB
Content-Transfer-Encoding 7bit
Message-ID <-IidnUN5Wfq98FHEnZ2dnUU7-RPNnZ2d@westnet.com.au> (permalink)
Lines 22
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 124.171.16.146
X-Trace sv3-pyVBhOXmqLbkgl3o4/3RK2L0ev1YwmZ9sZ8DGCOhHktMZa2SjdRrYBbrOFDY+vbBD3R4jhon9evKLhc!5+CqmgsBBVEsv4Mo98VBxR4QZXDRENH5ARZIt31AsNTEiGY8JSFrmV/aDYvi3ZFw5SPGYaqXcf/0!dnzexGXVoj/2joLPWX6Qbg==
X-Complaints-To abuse@westnet.com.au
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1672
Xref csiph.com comp.lang.javascript:34042

Show key headers only | View raw


With this

var i,
     mySheet = document.styleSheets[0];

if (mySheet.cssRules && mySheet.cssRules.length) {
   for (i = 0; i < mySheet.cssRules.length; i++) {
     console.log(mySheet.cssRules[i].selectorText)
   }
}

I'm having a look at the rules in a style sheet. The sheet has some 
rules under

@media all and (max-width: 640px) {

but these don't get listed. How do I find all the media queries and 
return the rules in each?

Ideally I need to add/delete/modify rules in media queries.

Andrew Poulos

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


Thread

Media CSS Rules Andrew Poulos <ap_prog@hotmail.com> - 2017-09-28 13:31 +1000
  Re: Media CSS Rules Andrew Poulos <ap_prog@hotmail.com> - 2017-09-28 13:45 +1000
    Re: Media CSS Rules "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-28 10:10 +0200

csiph-web