selector 相关问题

选择器可以是标识Objective-C或Smalltalk编程语言中的方法名称的字符串,也可以是计算机中用于将多行(I / O)连接到单行的特殊类型的开关。请不要将此标记用于jQuery / CSS选择器。

CSS 通用选择器不适用于 SVG

如果我有这个 HTML 如果我有这个 HTML <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <g id="repeat"> <path fill="currentColor" d="M20.3 13.43a1 1 0 0 0-1.25.65A7.14 7.14 0 0 1 12.18 19A7.1 7.1 0 0 1 5 12a7.1 7.1 0 0 1 7.18-7a7.26 7.26 0 0 1 4.65 1.67l-2.17-.36a1 1 0 0 0-1.15.83a1 1 0 0 0 .83 1.15l4.24.7h.17a1 1 0 0 0 .34-.06a.33.33 0 0 0 .1-.06a.78.78 0 0 0 .2-.11l.09-.11c0-.05.09-.09.13-.15s0-.1.05-.14a1.34 1.34 0 0 0 .07-.18l.75-4a1 1 0 0 0-2-.38l-.27 1.45A9.21 9.21 0 0 0 12.18 3A9.1 9.1 0 0 0 3 12a9.1 9.1 0 0 0 9.18 9A9.12 9.12 0 0 0 21 14.68a1 1 0 0 0-.7-1.25Z" /> </g> </svg> <svg id="btnRepeat" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="button"> <use href="#repeat"></use> </svg> 还有这个CSS :root { --norm-colour: green; --high-colour: red; } #btnRepeat { position: absolute; width: 15%; color: var(--norm-colour); } #btnRepeat:hover { color: var(--high-colour); cursor: pointer; } svg 颜色是正确的,并且悬停时会按预期变化。 如果我将选择器从 #btnRepeat:hover 更改为 svg[id^="btn"]:hover 的“通用”形式,则悬停时的颜色不会发生变化(尽管光标发生变化。)为什么通用形式失败了吗? 因为id选择器具有更高的优先级。 :root { --norm-colour: green; --high-colour: red; } [id^="btn"] { position: absolute; width: 15%; color: var(--norm-colour); } [id^="btn"]:hover { color: var(--high-colour); cursor: pointer; } <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <g id="repeat"> <path fill="currentColor" d="M20.3 13.43a1 1 0 0 0-1.25.65A7.14 7.14 0 0 1 12.18 19A7.1 7.1 0 0 1 5 12a7.1 7.1 0 0 1 7.18-7a7.26 7.26 0 0 1 4.65 1.67l-2.17-.36a1 1 0 0 0-1.15.83a1 1 0 0 0 .83 1.15l4.24.7h.17a1 1 0 0 0 .34-.06a.33.33 0 0 0 .1-.06a.78.78 0 0 0 .2-.11l.09-.11c0-.05.09-.09.13-.15s0-.1.05-.14a1.34 1.34 0 0 0 .07-.18l.75-4a1 1 0 0 0-2-.38l-.27 1.45A9.21 9.21 0 0 0 12.18 3A9.1 9.1 0 0 0 3 12a9.1 9.1 0 0 0 9.18 9A9.12 9.12 0 0 0 21 14.68a1 1 0 0 0-.7-1.25Z" /> </g> </svg> <svg id="btnRepeat" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="button"> <use href="#repeat"></use> </svg>

回答 1 投票 0

Puppeteer:如何单击其后代中包含特定值的元素

我第一次使用 Puppeteer,我有以下代码来单击某个元素: 等待 page.waitForSelector('.item-table > .grid-item > .grid-item-container > .grid-table-container ...

回答 1 投票 0

在什么情况下我们可以在 Swift 中使用不合格的 #selector() 表达式?

Objective-C 的 @selector() 表达式的 Swift 等价物是 #selector()。在 Xcode 中,Objective-C 的 @selector() 表达式将为所有可用的选择器和选择器提供自动补全功能

回答 1 投票 0

使用 ngrx 在 Angular 项目中从单独状态解析用户名时出现问题

我正在使用 ngrx 开发一个 Angular 项目,其中我有两种状态——一种用于用户,另一种用于项目。在项目状态下,每个项目都有一个作者和一个编辑。用户状态包含...

回答 1 投票 0

请解决selectorlib的问题,收到此消息但无法理解

主文件代码里面 导入请求 导入选择器库 URL = 'http://programmer100.pythonanywhere.com/tours/' 标头= { “用户代理”:“Mozilla/5.0(Macintosh;Intel Mac OS X 10_10_1)

回答 1 投票 0

CSS 使用通配符 * :not() 中的所有元素

我编写了一些 JS 来选择引导模式中的元素。确保所述 JS 仅选择属于模式本身的元素(即在其页眉/页脚内),但排除任何

回答 1 投票 0

如何让我的 webcraper 输入内容并从下拉列表中选择

所以我想从这个网站上抓取所有脊椎按摩师 https://chiropractic.ca/find-a-chiro/alberta/ 我使用一个叫Webscraper的工具,非常好,可以让我做分页和进一步的工作...

回答 1 投票 0

如何在WebdriverIO中获取元素完整的lxpath?

我有代码检查容器下是否显示具有特定文本的元素。 它工作得很好,虽然我使用了完整的 xpath,但是在我们更改选择器之后(它仍然得到......

回答 1 投票 0

如何更改JsColor的值并运行jscolor的函数?

我在使用 jscolor 或 http://jscolor.com/ 时遇到困难 我想更改 javscript 中颜色的值,而不仅仅是能够输入它或通过单击选择它。我调查过它...

回答 3 投票 0

在 jQuery 中通过 onclick 属性选择元素

我有这个标记: 我的问题:如何选择第二个链接

回答 2 投票 0

使用 asyncio 时无法使用 os.fork() 将多个进程绑定到一个套接字服务器

我们都知道使用 asyncio 可以显着提高套接字服务器的性能,如果我们能够利用 cpu 中的所有内核(也许通过

回答 2 投票 0

Testcafe:如何创建选择器来选择 HTML 标记之外的时间戳? <strong>时间戳:</strong> 12/13/2023 10:55 A.M.美国东部时间

我是 TestCafe 的新手。 下面是示例 HTML 代码,当我创建带有 id 的选择器时,它仅返回“当前时间戳:”,并且我需要当前时间的时间戳。 页面对象文件:

回答 1 投票 0

Objective-C 选择器包含无效字符?

与 Objective-C 运行时交互时,似乎选择器名称允许包含“非法”字符。人们可以使用这种选择器来添加新方法并在...中调用它们

回答 1 投票 0

Apache Camel 带有运算符的多重过滤器/选择器

我正在尝试使用过滤器在我的 Camel Route 中过滤来自 activeMQ 的消息,但当我使用 || 等运算符时,我无法使其工作。或者 && 所以基本上我收到了来自 acti 的消息...

回答 2 投票 0

Objective-C:使用多个参数调用选择器

在MyClass.m中,我定义了 - (void) myTest: (NSString *) withAString{ NSLog(@"hi, %@", withAString); } 以及 MyClass.h 中的适当声明。稍后我想打电话 [自我表演选择...

回答 9 投票 0

未捕获类型错误:allButtons.remove() 不是函数?

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>QuiZA</title> <link rel="stylesheet" href="css/style.css"/> <script src="js\app.js"></script> </head> <body> <div class="container"> <h1 class="frontlogo">QuiZA Logo </h1> <video autoplay loop src="assets\QZA3.mp4" class="Logo"></video> <div class="grid"> <button id="start" class="button-56" role="button">Start</button> <button class="button-56" role="button">Quiz List</button> <button class="button-56" role="button">Contact</button> </div> <!--Loading screen will start after this--> <div class="splash"> <h1 class="splash-header">Press Here...</h1> </div> </div> </body> </html> CSS .container{ background: white cover; height: 100vh; width: 100%; display: grid; } .grid{ display: grid; grid-auto-flow: row; margin: auto; gap: 1em; text-align: center; transition: all ease-in-out 0.6s; } .ButtonS:hover{ transform: scale(1.2); } .ButtonC:hover{ transform: scale(1.2); } .ButtonQ:hover{ transform: scale(1.2); } .ButtonS{ background: white; padding: 1em; border-radius: 30px; transition: all 0.2s ease-in-out; } .ButtonC{ background: white; padding: 1em; border-radius: 30px; transition: all 0.2s ease-in-out; } .ButtonQ{ background: white; padding: 1em; border-radius: 30px; transition: all 0.2s ease-in-out; } .button-56{ align-items: center; background-color: rgb(74, 227, 36); border: 2px solid #111; border-radius: 8px; box-sizing: border-box; color: #111; cursor: pointer; display: flex; font-size: 16px; height: 48px; justify-content: center; line-height: 24px; max-width: 100%; padding: 0 25px; position: relative; text-align: center; text-decoration: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; } .button-56:after{ background-color: #111; border-radius: 8px; content: ""; display: block; height: 48px; left: 0; width: 100%; position: absolute; top: -2px; transform: translate(8px, 8px); transition: transform .2s ease-out; z-index: -1; } .button-56:hover:after{ transform: translate(0, 0); } .button-56:active{ background-color: #ffdeda; outline: 0; } .button-56:hover{ outline: 0; } @media (min-width: 768px){ .button-56 { padding: 0 40px; } } .splash-header{ color: white; transition: all ease-in-out 0.6s; } .splash-header:hover{ transform: scale(1.5); } .frontlogo{ height: 90%; color: white; display: flex; justify-content: center; align-content: center; } .Logo{ display: flex; border-radius: 50%; max-height: 300px; justify-content: center; align-content: center; margin: auto; transition: all 2s ease; } JS const startButton = document.getElementById("start"); const allButtons = document.querySelectorAll('button-56'); const logoButton = document.getElementsByClassName("Logo"); addGlobalEventListener("click", ".button-56", e => { startGame(); }) function addGlobalEventListener(type, selector, callback){ document.addEventListener(type, e => { if (e.target.matches(selector)) callback(e) }) } function startGame(){ allButtons.remove(); logoButton.remove(); } 我正在继续一个测验应用程序项目,并且在 JS 的第 16 行遇到上述错误代码。它不会在编译器中显示此错误,并且会运行,当我检查我的文档时,我收到标题中列出的错误。 我正在尝试利用,allButtons.remove();和`logoButton.remove();如果用户单击开始按钮,所有按钮和徽标将从文档中删除,为我创建一个新的画布来显示测验问题和某种用户输入,例如多项选择或扫描仪。 (https://jsfiddle.net/vqc1onap/2/#&togetherjs=0OdOatkR6z) 我尝试过使用不同的选择器并尝试了不同的变量名称,但我还没有找到解决方案。 删除是在一个元素上,你有一个集合。 const allButtons = document.querySelectorAll('.button-56'); allButtons.forEach( btn => btn.remove() ); <button id="start" class="button-56" role="button">Start</button> <button class="button-56" role="button">Quiz List</button> <button class="button-56" role="button">Contact</button>

回答 1 投票 0

如何向 Angular HTML 元素选择器指令添加参数?

我有一个简单的指令,其中选择器是一个img。 @指示( { 选择器:'img' } ) 导出类 ImageDirective { ... } 如何向该指令添加布尔参数? 我尝试过 @Inp...

回答 1 投票 0

如何从表格的第一列获取文本?

网页中有一个表格(在我的例子中是http://developer.chrome.com/extensions/api_index),我想获取其中的所有方法名称 稳定的 API。所以我想得到一个数组,wh的元素...

回答 6 投票 0

如何使用 Xcode 在导航栏中添加共享按钮的操作

我正在尝试向导航栏中的共享按钮添加一个操作,但我不知道如何以及在哪里定义我的“shareAction”方法。要添加共享按钮,我在 viewWillAppear 中有以下代码:

回答 4 投票 0

.nav > li 或 .nav li 设置 .nav 类中所有列表的样式

选择 .nav 类中所有 li 项目的正确选择器是什么? 两者都尝试过,似乎都有效。想知道选择器的正确写法是什么 尝试设置所有列表的样式

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.