$$(选择器)

news/2024/5/16 20:25:26 标签: javascript, java, web, js, html5

Gotta love the Firebug console, how can anyone not love the Firebug console. It makes testing random pieces of JavaScript a breeze and best of all - you're playing with the live page. Your page or any page for that matter.

一定会喜欢Firebug控制台,谁能不喜欢Firebug控制台呢? 它使轻松随机地测试JavaScript片段成为所有事情中最好的-您正在使用实时页面。 您的页面或任何与此相关的页面。

Two nice shortcuts you can use in the console are $ and $$.

您可以在控制台中使用的两个不错的快捷方式是$和$$。

The first is like document.getElementById() and the second allows you to get elements by using a selector, like w3c's document.querySelectorAll(), now available in the latest browser versions, including IE8.

第一个类似于document.getElementById() ,第二个允许您通过使用选择器来获取元素,例如w3c的document.querySelectorAll() ,现在可在包括IE8在内的最新浏览器版本中使用。

So go ahead, give $$ a try. For example you can visit yahoo.com, open up the console and try: >>> $$('.first') or >>> $$('.patabs .first') or >>> $$('#tabs1 li')

因此,继续尝试一下$$ 。 例如,您可以访问yahoo.com ,打开控制台,然后尝试: >>> $$('.first')>>> $$('.patabs .first')>>> $$('#tabs1 li')

Lots of fun!

很有意思!

So here's a little example application I came up with, it spits out unused selectors from your CSS. Just paste it in the multi-line console.

因此,这是我想到的一个小示例应用程序,它从CSS中吐出了未使用的选择器。 只需将其粘贴在多行控制台中即可。

for(var i = 0; i < document.styleSheets.length; i++) {
  for (var j = 0; j < document.styleSheets[i].cssRules.length; j++) {
    s = document.styleSheets[i].cssRules[j].selectorText; 
    if ($$(s).length === 0) console.log(s);
  }
}

Tell your friends about this post on Facebook and Twitter

在Facebook和Twitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/console-selectors/


http://www.niftyadmin.cn/n/1306279.html

相关文章

SHUOJ 1013 过河卒问题 (递推)

题目&#xff1a;SHUOJ 1013 题目链接&#xff1a;http://202.121.199.212/JudgeOnline/problem.php?id1013 题目&#xff1a; 1013: 过河卒 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1584 Solved: 464 [Submit][Status][Web Board] Description 如图&#xff0c;A…

母函数-以HDU-1398 Square Coins为例

额&#xff0c;其实这个题目不是很难&#xff0c;但因为是母函数的第一篇博客&#xff0c;也是学习母函数的第一次应用&#xff0c;所以就以此题为基础讲一下母函数。 母函数原理 既然是第一道母函数的题目&#xff0c;那就有必要先看一下母函数是什么&#xff0c;原理是什么&a…

WebService之CXF注解报错(三)

WebService之CXF注解 1、具体错误如下 五月 04, 2014 11:29:28 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass 信息: Creating Service {http://service.you.com/}IServiceService from class com.you.service.IService 五月 …

HDU 1028 Ignatius and the Princess III(母函数)

题目&#xff1a;HDU-1028 题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1028 题目&#xff1a; Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16806 …

IE9和JPEG-XR:第一印象

One of the new features in IE9 is the support for the JPEG-XR format, which reportedly has a better compression. Is it something we should dive into ASAP? IE9的新功能之一是对JPEG-XR格式的支持&#xff0c;据说该格式具有更好的压缩率。 我们应该尽快涉足吗&…

JavaScript实现获取table中某一列的值

JavaScript实现获取table中某一列的值 1、实现源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns"http://www.w3.org/1999/xhtml"> …

HDU 1085 Holding Bin-Laden Captive!(母函数)

题目&#xff1a;HDU-1085 题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1085 题目&#xff1a; Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19057 Accep…

WebService之CXF注解之一(封装类)

Teacher.java&#xff1a; /*** Title:Teacher.java* Package:com.you.model* Description:老师封装类* author:Youhaidong(游海东)* date:2014-5-5 下午11:03:13* version V1.0*/ package com.you.model;import java.io.Serializable;/*** 类功能说明* 类修改者 修改日期* 修改…